From 4f502046ed34a09564f21e5026fef3b668a1bf3d Mon Sep 17 00:00:00 2001 From: Tsvetozar Penov Date: Tue, 17 Dec 2024 11:27:59 +0100 Subject: [PATCH] Fix admin spacing --- .../components/admin/admin_components.ex | 70 ++++++++++--------- .../generic_admin_html/show.html.heex | 58 ++++++++------- 2 files changed, 72 insertions(+), 56 deletions(-) diff --git a/lib/sanbase_web/components/admin/admin_components.ex b/lib/sanbase_web/components/admin/admin_components.ex index a9246ac206..f7d945d053 100644 --- a/lib/sanbase_web/components/admin/admin_components.ex +++ b/lib/sanbase_web/components/admin/admin_components.ex @@ -261,19 +261,21 @@ defmodule SanbaseWeb.AdminComponents do def show_table(assigns) do ~H""" -
-

Show <%= Inflex.singularize(@resource) %>

-
-
- +
+

+ Show <%= Inflex.singularize(@resource) %> +

+
+
+
<%= for field <- @fields do %> - <.td_show - class="px-6 py-4 border-b border-gray-200" + class="px-3 py-2 border-b border-gray-200 whitespace-pre-wrap break-words" value={ result = if @assocs[@data.id][field], @@ -430,19 +432,21 @@ defmodule SanbaseWeb.AdminComponents do <% end %> <.search fields={@search_fields} resource={@resource} search={@search} /> -
-
+ <%= to_string(field) %>
- <.thead fields={@fields} actions={@actions} /> - <.tbody - resource={@resource} - rows={@rows} - fields={@fields} - assocs={@assocs} - field_type_map={@field_type_map} - actions={@actions} - funcs={@funcs} - /> -
+
+
+ + <.thead fields={@fields} actions={@actions} /> + <.tbody + resource={@resource} + rows={@rows} + fields={@fields} + assocs={@assocs} + field_type_map={@field_type_map} + actions={@actions} + funcs={@funcs} + /> +
+
<.pagination resource={@resource} @@ -459,13 +463,13 @@ defmodule SanbaseWeb.AdminComponents do def thead(assigns) do ~H""" - + <%= for field <- @fields do %> - <%= field %> + <%= field %> <% end %> <%= if @actions do %> - Actions + Actions <% end %> @@ -479,7 +483,7 @@ defmodule SanbaseWeb.AdminComponents do <%= for field <- @fields do %> <%= if field == :id do %> - + <.a resource={@resource} action={:show} row={row} label={Map.get(row, field)} /> <% else %> @@ -505,11 +509,13 @@ defmodule SanbaseWeb.AdminComponents do <% end %> <% end %> <%= if @actions do %> - - <% index_actions = @actions -- [:new] %> - <%= for action <- index_actions do %> - <.index_action_btn resource={@resource} action={action} label={action} row={row} /> - <% end %> + +
+ <% index_actions = @actions -- [:new] %> + <%= for action <- index_actions do %> + <.index_action_btn resource={@resource} action={action} label={action} row={row} /> + <% end %> +
<% end %> @@ -676,7 +682,7 @@ defmodule SanbaseWeb.AdminComponents do def td_index(assigns) do ~H""" - + <%= @value %> """ @@ -742,7 +748,7 @@ defmodule SanbaseWeb.AdminComponents do def pagination(assigns) do ~H""" -
+
<.pagination_buttons resource={@resource} rows_count={@rows_count} @@ -751,7 +757,7 @@ defmodule SanbaseWeb.AdminComponents do action={@action} search={@search} /> - + Showing <%= @current_page * @page_size + 1 %> to <%= Enum.min([ (@current_page + 1) * @page_size, @rows_count diff --git a/lib/sanbase_web/templates/generic_admin_html/show.html.heex b/lib/sanbase_web/templates/generic_admin_html/show.html.heex index 90996d6a5d..4c1253b975 100644 --- a/lib/sanbase_web/templates/generic_admin_html/show.html.heex +++ b/lib/sanbase_web/templates/generic_admin_html/show.html.heex @@ -20,31 +20,41 @@ <%= for bt <- @belongs_to do %>
-

<%= bt.name %>

- - - <%= for field <- bt.fields do %> - - - - - <% end %> - -
<%= field.field_name %>
<%= field.data %>
+

<%= bt.name %>

+
+
+ + + <%= for field <- bt.fields do %> + + + + + <% end %> + +
+ <%= field.field_name %> + +
<%= field.data %>
+
+
+
- <%= for action <- bt.actions do %> - - <%= link(to_string(action), - to: - Routes.generic_admin_path(SanbaseWeb.Endpoint, :show_action, - action: action, - resource: @resource, - id: @data.id - ), - class: "flex-shrink-0 border-4 text-teal-500 hover:text-teal-800 py-1 px-2 rounded" - ) %> - - <% end %> +
+ <%= for action <- bt.actions do %> + + <%= link(to_string(action), + to: + Routes.generic_admin_path(SanbaseWeb.Endpoint, :show_action, + action: action, + resource: @resource, + id: @data.id + ), + class: "text-xs text-blue-500 hover:text-blue-700 mr-2" + ) %> + + <% end %> +
<% end %>