From ac01156d00b24d14225c8e75979fb59bba69640d Mon Sep 17 00:00:00 2001 From: erdgeist Date: Tue, 4 Aug 2026 17:13:18 +0200 Subject: Tidy up headings on house keeping views - Collapse page headers into one action row with an optional hint - limit will_paginate to one row --- app/views/assets/index.html.erb | 10 +++++----- app/views/events/index.html.erb | 12 +++++------- app/views/menu_items/index.html.erb | 10 +++++----- app/views/nodes/_node_list.html.erb | 8 +------- app/views/nodes/index.html.erb | 14 ++++++-------- app/views/shared/_page_actions.html.erb | 32 ++++++++++++++++++++++++++++++++ app/views/users/_user.html.erb | 6 +++--- app/views/users/index.html.erb | 18 +++++++----------- 8 files changed, 64 insertions(+), 46 deletions(-) create mode 100644 app/views/shared/_page_actions.html.erb (limited to 'app/views') diff --git a/app/views/assets/index.html.erb b/app/views/assets/index.html.erb index 81d2686a..af11f54f 100644 --- a/app/views/assets/index.html.erb +++ b/app/views/assets/index.html.erb @@ -1,8 +1,8 @@ -

<%= t(".title") %>

- -<%= link_to new_asset_path, class: 'action_button' do %> - <%= icon("plus", library: "tabler", "aria-hidden": true) %> <%= t(".create_asset") %> -<% end %> +<%= render "shared/page_actions", + :title => t(".title"), + :icon_name => "photo-plus", + :label => t(".create_asset"), + :options => [[t(".create_asset"), new_asset_path]] %> <%= will_paginate @assets %> diff --git a/app/views/events/index.html.erb b/app/views/events/index.html.erb index cc3f163d..c4f0a7f9 100644 --- a/app/views/events/index.html.erb +++ b/app/views/events/index.html.erb @@ -1,10 +1,8 @@ -

<%= t(".title") %>

- -
- <%= link_to new_event_path, class: 'action_button' do %> - <%= icon("plus", library: "tabler", "aria-hidden": true) %> <%= t(".create_event") %> - <% end %> -
+<%= render "shared/page_actions", + :title => t(".title"), + :icon_name => "calendar-plus", + :label => t(".create_event"), + :options => [[t(".create_event"), new_event_path]] %> <%= will_paginate @events %> diff --git a/app/views/menu_items/index.html.erb b/app/views/menu_items/index.html.erb index 0eacc34a..b1c235da 100644 --- a/app/views/menu_items/index.html.erb +++ b/app/views/menu_items/index.html.erb @@ -1,8 +1,8 @@ -

<%= t(".title") %>

- -<%= link_to new_menu_item_path, class: 'action_button' do %> - <%= icon("plus", library: "tabler", "aria-hidden": true) %> <%= t(".create_item") %> -<% end %> +<%= render "shared/page_actions", + :title => t(".title"), + :icon_name => "list-details", + :label => t(".create_item"), + :options => [[t(".create_item"), new_menu_item_path]] %>

<%= t(".reorder_hint") %>

diff --git a/app/views/nodes/_node_list.html.erb b/app/views/nodes/_node_list.html.erb index 458ab1ae..f3101058 100644 --- a/app/views/nodes/_node_list.html.erb +++ b/app/views/nodes/_node_list.html.erb @@ -14,11 +14,6 @@ <%= will_paginate @nodes %> - - - - - <% @nodes.each do |node| %> "> - <% end %>
<%= t("admin.columns.title") %><%= t("admin.columns.actions") %><%= t("admin.columns.rev") %>
@@ -30,7 +25,7 @@ t(".flag_embargo", :date => admin_datetime(node.head.published_at)), :tier => :attention) if node.embargoed? %> <%= flag("file-pencil", t(".flag_draft")) if node.draft %> - <%= flag("file-off", t(".flag_no_head")) unless node.head %> + <%= flag("world-off", t(".flag_no_head")) unless node.head %>
<%= link_to title_for_node(node), node_path(node) %>
@@ -54,7 +49,6 @@
<%= node.head ? node.head.revision : t(".no_revision") %>
diff --git a/app/views/nodes/index.html.erb b/app/views/nodes/index.html.erb index 357c938b..b88eca06 100644 --- a/app/views/nodes/index.html.erb +++ b/app/views/nodes/index.html.erb @@ -1,10 +1,8 @@ -

<%= t(".title") %>

- -
- <%= link_to new_node_path, class: 'action_button' do %> - <%= icon("plus", library: "tabler", "aria-hidden": true) %> <%= t(".create_node") %> - <% end %> - <%= t(".create_hint") %> -
+<%= render "shared/page_actions", + :title => t(".title"), + :icon_name => "file-plus", + :label => t(".create_node"), + :options => [[t(".create_node"), new_node_path]], + :hint => t(".create_hint") %> <%= render 'node_list' %> diff --git a/app/views/shared/_page_actions.html.erb b/app/views/shared/_page_actions.html.erb new file mode 100644 index 00000000..66aeb785 --- /dev/null +++ b/app/views/shared/_page_actions.html.erb @@ -0,0 +1,32 @@ +
+

<%= title %>

+ + <% if options.size == 1 %> + <%= link_to options.first.last, class: "action_button", + "aria-label" => options.first.first, title: options.first.first do %> + <%= icon(icon_name, library: "tabler", "aria-hidden": true) %> + <% end %> + <% else %> +
+
+ + <%= icon(icon_name, library: "tabler", "aria-hidden": true) %> + <%= icon("chevron-down", library: "tabler", "aria-hidden": true) %> + +
+ <% options.each do |option_label, path| %> + <%= link_to option_label, path, class: "action_button" %> + <% end %> +
+
+ + <% if local_assigns[:hint].present? %> +
+ " + title="<%= t("admin.common.explain") %>">? +

<%= hint %>

+
+ <% end %> +
+ <% end %> +
diff --git a/app/views/users/_user.html.erb b/app/views/users/_user.html.erb index 028ee02f..e70c7032 100644 --- a/app/views/users/_user.html.erb +++ b/app/views/users/_user.html.erb @@ -79,7 +79,7 @@ form: { data: { confirm: t(".confirm_revoke_redaktion", :login => user.login) }, class: 'button_to destructive' }, "aria-label" => t(".revoke_redaktion"), title: t(".revoke_redaktion") do %> - <%= icon("user-minus", library: "tabler", "aria-hidden": true) %> + <%= icon("users-minus", library: "tabler", "aria-hidden": true) %> <% end %> <% end %> <% elsif user.otp_enrolled? %> @@ -87,13 +87,13 @@ form: { data: { confirm: t(".confirm_grant_redaktion", :login => user.login) }, class: 'button_to state_changing' }, "aria-label" => t(".grant_redaktion"), title: t(".grant_redaktion") do %> - <%= icon("user-plus", library: "tabler", "aria-hidden": true) %> + <%= icon("users-plus", library: "tabler", "aria-hidden": true) %> <% end %> <% else %> <% end %> <% end %> diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index 2936bbea..71102c2c 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -1,14 +1,10 @@ -

<%= t(".title") %>

- -

- <% UsersController::ROLE_PRESETS.each_key do |preset| %> - <%= link_to new_user_path(:preset => preset), class: 'action_button' do %> - <%= icon("plus", library: "tabler", "aria-hidden": true) %> - <%= t(".create_#{preset}") %> - <% end %> - <% end %> -

-

<%= t(".admin_hint") %>

+<%= render "shared/page_actions", + :title => t(".title"), + :icon_name => "user-plus", + :label => t(".create_account"), + :options => UsersController::ROLE_PRESETS.each_key.map { |preset| + [t(".create_#{preset}"), new_user_path(:preset => preset)] }, + :hint => t(".admin_hint") %> <% UsersController::GROUP_ORDER.each do |group| %> <% members = @users[group] || [] %> -- cgit v1.3