-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #452 from patriciomacadden/improve-scaffold-views
Improve scaffold views
- Loading branch information
Showing
10 changed files
with
53 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
PATH | ||
remote: . | ||
specs: | ||
tailwindcss-rails (3.0.0) | ||
tailwindcss-rails (3.1.0) | ||
railties (>= 7.0.0) | ||
tailwindcss-ruby | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 5 additions & 3 deletions
8
lib/generators/tailwindcss/scaffold/templates/edit.html.erb.tt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
<div class="mx-auto md:w-2/3 w-full"> | ||
<%% content_for :title, "Editing <%= human_name.downcase %>" %> | ||
|
||
<div class="md:w-2/3 w-full"> | ||
<h1 class="font-bold text-4xl">Editing <%= human_name.downcase %></h1> | ||
|
||
<%%= render "form", <%= singular_table_name %>: @<%= singular_table_name %> %> | ||
|
||
<%%= link_to "Show this <%= human_name.downcase %>", <%= model_resource_name(prefix: "@") %>, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> | ||
<%%= link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper(type: :path) %>, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> | ||
<%%= link_to "Show this <%= human_name.downcase %>", <%= model_resource_name(prefix: "@") %>, class: "ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %> | ||
<%%= link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper(type: :path) %>, class: "ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %> | ||
</div> |
22 changes: 13 additions & 9 deletions
22
lib/generators/tailwindcss/scaffold/templates/index.html.erb.tt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,25 @@ | ||
<%% content_for :title, "<%= human_name.pluralize %>" %> | ||
|
||
<div class="w-full"> | ||
<%% if notice.present? %> | ||
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice"><%%= notice %></p> | ||
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-md inline-block" id="notice"><%%= notice %></p> | ||
<%% end %> | ||
|
||
<%% content_for :title, "<%= human_name.pluralize %>" %> | ||
|
||
<div class="flex justify-between items-center"> | ||
<h1 class="font-bold text-4xl"><%= human_name.pluralize %></h1> | ||
<%%= link_to "New <%= human_name.downcase %>", new_<%= singular_route_name %>_path, class: "rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium" %> | ||
<%%= link_to "New <%= human_name.downcase %>", new_<%= singular_route_name %>_path, class: "rounded-md px-3.5 py-2.5 bg-blue-600 hover:bg-blue-500 text-white block font-medium" %> | ||
</div> | ||
|
||
<div id="<%= plural_table_name %>" class="min-w-full"> | ||
<%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %> | ||
<%%= render <%= singular_table_name %> %> | ||
<p> | ||
<%%= link_to "Show this <%= human_name.downcase %>", <%= model_resource_name(singular_table_name) %>, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> | ||
</p> | ||
<%% if @<%= plural_table_name %>.any? %> | ||
<%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %> | ||
<%%= render <%= singular_table_name %> %> | ||
<p> | ||
<%%= link_to "Show this <%= human_name.downcase %>", <%= model_resource_name(singular_table_name) %>, class: "ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %> | ||
</p> | ||
<%% end %> | ||
<%% else %> | ||
<p class="text-center my-10">No <%= human_name.downcase.pluralize %> found.</p> | ||
<%% end %> | ||
</div> | ||
</div> |
6 changes: 4 additions & 2 deletions
6
lib/generators/tailwindcss/scaffold/templates/new.html.erb.tt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
<div class="mx-auto md:w-2/3 w-full"> | ||
<%% content_for :title, "New <%= human_name.downcase %>" %> | ||
|
||
<div class="md:w-2/3 w-full"> | ||
<h1 class="font-bold text-4xl">New <%= human_name.downcase %></h1> | ||
|
||
<%%= render "form", <%= singular_table_name %>: @<%= singular_table_name %> %> | ||
|
||
<%%= link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper(type: :path) %>, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> | ||
<%%= link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper(type: :path) %>, class: "ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,5 @@ | |
<%%= <%= singular_name %>.<%= attribute.column_name %> %> | ||
<% end -%> | ||
</p> | ||
|
||
<% end -%> | ||
</div> |
28 changes: 15 additions & 13 deletions
28
lib/generators/tailwindcss/scaffold/templates/show.html.erb.tt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
<div class="mx-auto md:w-2/3 w-full flex"> | ||
<div class="mx-auto"> | ||
<%% if notice.present? %> | ||
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice"><%%= notice %></p> | ||
<%% end %> | ||
|
||
<%%= render @<%= singular_table_name %> %> | ||
|
||
<%%= link_to "Edit this <%= human_name.downcase %>", <%= edit_helper(type: :path) %>, class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> | ||
<%%= link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper %>_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> | ||
<div class="inline-block ml-2"> | ||
<%%= button_to "Destroy this <%= human_name.downcase %>", <%= model_resource_name(prefix: "@") %>, method: :delete, class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium" %> | ||
</div> | ||
<%% content_for :title, "Showing <%= human_name.downcase %>" %> | ||
|
||
<div class="md:w-2/3 w-full"> | ||
<%% if notice.present? %> | ||
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-md inline-block" id="notice"><%%= notice %></p> | ||
<%% end %> | ||
|
||
<h1 class="font-bold text-4xl">Showing <%= human_name.downcase %></h1> | ||
|
||
<%%= render @<%= singular_table_name %> %> | ||
|
||
<%%= link_to "Edit this <%= human_name.downcase %>", <%= edit_helper(type: :path) %>, class: "mt-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %> | ||
<%%= link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper %>_path, class: "ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %> | ||
<div class="inline-block ml-2"> | ||
<%%= button_to "Destroy this <%= human_name.downcase %>", <%= model_resource_name(prefix: "@") %>, method: :delete, class: "mt-2 rounded-md px-3.5 py-2.5 text-white bg-red-600 hover:bg-red-500 font-medium" %> | ||
</div> | ||
</div> |