Skip to content

Commit 0507a0c

Browse files
authored
Merge pull request #503 from patriciomacadden/mobile-improvements
Improve views for mobile devices
2 parents 08486ae + 51f6aba commit 0507a0c

File tree

9 files changed

+18
-18
lines changed

9 files changed

+18
-18
lines changed

lib/generators/tailwindcss/authentication/templates/app/views/passwords/edit.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</div>
1616

1717
<div class="inline">
18-
<%%= form.submit "Save", class: "rounded-md px-3.5 py-2.5 bg-blue-600 hover:bg-blue-500 text-white inline-block font-medium cursor-pointer" %>
18+
<%%= form.submit "Save", class: "w-full sm:w-auto text-center rounded-md px-3.5 py-2.5 bg-blue-600 hover:bg-blue-500 text-white inline-block font-medium cursor-pointer" %>
1919
</div>
2020
<%% end %>
2121
</div>

lib/generators/tailwindcss/authentication/templates/app/views/passwords/new.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</div>
1212

1313
<div class="inline">
14-
<%%= form.submit "Email reset instructions", class: "rounded-lg px-3.5 py-2.5 bg-blue-600 hover:bg-blue-500 text-white inline-block font-medium cursor-pointer" %>
14+
<%%= form.submit "Email reset instructions", class: "w-full sm:w-auto text-center rounded-lg px-3.5 py-2.5 bg-blue-600 hover:bg-blue-500 text-white inline-block font-medium cursor-pointer" %>
1515
</div>
1616
<%% end %>
1717
</div>

lib/generators/tailwindcss/authentication/templates/app/views/sessions/new.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
<div class="col-span-6 sm:flex sm:items-center sm:gap-4">
2222
<div class="inline">
23-
<%%= form.submit "Sign in", class: "rounded-md px-3.5 py-2.5 bg-blue-600 hover:bg-blue-500 text-white inline-block font-medium cursor-pointer" %>
23+
<%%= form.submit "Sign in", class: "w-full sm:w-auto text-center rounded-md px-3.5 py-2.5 bg-blue-600 hover:bg-blue-500 text-white inline-block font-medium cursor-pointer" %>
2424
</div>
2525

2626
<div class="mt-4 text-sm text-gray-500 sm:mt-0">

lib/generators/tailwindcss/scaffold/templates/_form.html.erb.tt

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@
3838

3939
<% end -%>
4040
<div class="inline">
41-
<%%= form.submit class: "rounded-md px-3.5 py-2.5 bg-blue-600 hover:bg-blue-500 text-white inline-block font-medium cursor-pointer" %>
41+
<%%= form.submit class: "w-full sm:w-auto rounded-md px-3.5 py-2.5 bg-blue-600 hover:bg-blue-500 text-white inline-block font-medium cursor-pointer" %>
4242
</div>
4343
<%% end %>

lib/generators/tailwindcss/scaffold/templates/edit.html.erb.tt

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55

66
<%%= render "form", <%= singular_table_name %>: @<%= singular_table_name %> %>
77

8-
<%%= 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" %>
9-
<%%= 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" %>
8+
<%%= link_to "Show this <%= human_name.downcase %>", <%= model_resource_name(prefix: "@") %>, class: "w-full sm:w-auto text-center mt-2 sm:mt-0 sm:ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
9+
<%%= link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper(type: :path) %>, class: "w-full sm:w-auto text-center mt-2 sm:mt-0 sm:ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
1010
</div>

lib/generators/tailwindcss/scaffold/templates/index.html.erb.tt

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
<div id="<%= plural_table_name %>" class="min-w-full divide-y divide-gray-200 space-y-5">
1414
<%% if @<%= plural_table_name %>.any? %>
1515
<%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
16-
<div class="flex justify-between items-center">
16+
<div class="flex flex-col sm:flex-row justify-between items-center pb-5 sm:pb-0">
1717
<%%= render <%= singular_table_name %> %>
18-
<div class="space-x-2">
19-
<%%= link_to "Show", <%= model_resource_name(singular_table_name) %>, class: "rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
20-
<%%= link_to "Edit", <%= edit_helper(singular_table_name, type: :path) %>, class: "rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
21-
<div class="inline-block">
22-
<%%= button_to "Destroy", <%= model_resource_name %>, method: :delete, class: "rounded-md px-3.5 py-2.5 text-white bg-red-600 hover:bg-red-500 font-medium cursor-pointer", data: { turbo_confirm: "Are you sure?" } %>
18+
<div class="w-full sm:w-auto flex flex-col sm:flex-row space-x-2 space-y-2">
19+
<%%= link_to "Show", <%= model_resource_name(singular_table_name) %>, class: "w-full sm:w-auto text-center rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
20+
<%%= link_to "Edit", <%= edit_helper(singular_table_name, type: :path) %>, class: "w-full sm:w-auto text-center rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
21+
<div class="sm:inline-block">
22+
<%%= button_to "Destroy", <%= model_resource_name %>, method: :delete, class: "w-full sm:w-auto rounded-md px-3.5 py-2.5 text-white bg-red-600 hover:bg-red-500 font-medium cursor-pointer", data: { turbo_confirm: "Are you sure?" } %>
2323
</div>
2424
</div>
2525
</div>

lib/generators/tailwindcss/scaffold/templates/new.html.erb.tt

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55

66
<%%= render "form", <%= singular_table_name %>: @<%= singular_table_name %> %>
77

8-
<%%= 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" %>
8+
<%%= link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper(type: :path) %>, class: "w-full sm:w-auto text-center mt-2 sm:mt-0 sm:ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
99
</div>

lib/generators/tailwindcss/scaffold/templates/partial.html.erb.tt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div id="<%%= dom_id <%= singular_name %> %>" class="my-5 space-y-5">
1+
<div id="<%%= dom_id <%= singular_name %> %>" class="w-full sm:w-auto my-5 space-y-5">
22
<% attributes.reject(&:password_digest?).each do |attribute| -%>
33
<div>
44
<strong class="block font-medium mb-1"><%= attribute.human_name %>:</strong>

lib/generators/tailwindcss/scaffold/templates/show.html.erb.tt

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
<%%= render @<%= singular_table_name %> %>
1111

12-
<%%= 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" %>
13-
<%%= 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" %>
14-
<div class="inline-block ml-2">
15-
<%%= 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 cursor-pointer", data: { turbo_confirm: "Are you sure?" } %>
12+
<%%= link_to "Edit this <%= human_name.downcase %>", <%= edit_helper(type: :path) %>, class: "w-full sm:w-auto text-center rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
13+
<%%= link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper %>_path, class: "w-full sm:w-auto text-center mt-2 sm:mt-0 sm:ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
14+
<div class="sm:inline-block mt-2 sm:mt-0 sm:ml-2">
15+
<%%= button_to "Destroy this <%= human_name.downcase %>", <%= model_resource_name(prefix: "@") %>, method: :delete, class: "w-full rounded-md px-3.5 py-2.5 text-white bg-red-600 hover:bg-red-500 font-medium cursor-pointer", data: { turbo_confirm: "Are you sure?" } %>
1616
</div>
1717
</div>

0 commit comments

Comments
 (0)