From 5692777652a28ee66463fa4a4b79928fd90c79fc Mon Sep 17 00:00:00 2001 From: erdgeist Date: Mon, 3 Aug 2026 18:08:58 +0200 Subject: Share one flag stack between the account roster and the events list --- app/helpers/admin_helper.rb | 7 +++++++ app/views/events/index.html.erb | 9 ++++++--- app/views/users/_user.html.erb | 23 +++++++---------------- 3 files changed, 20 insertions(+), 19 deletions(-) (limited to 'app') diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb index 2684fffb..5a1a42a3 100644 --- a/app/helpers/admin_helper.rb +++ b/app/helpers/admin_helper.rb @@ -7,4 +7,11 @@ module AdminHelper link_to raw('Deutsch'), url_for(params.permit(:locale, :page_path).to_h.merge('locale' => 'de')) end end + + def flag(icon_name, hint, tier: nil) + classes = ["flag", tier && "flag_#{tier}"].compact.join(" ") + content_tag(:span, icon(icon_name, library: "tabler", "aria-hidden": true), + :role => "img", :class => classes, + :title => hint, "aria-label" => hint) + end end diff --git a/app/views/events/index.html.erb b/app/views/events/index.html.erb index 7dfb854c..d07d6f82 100644 --- a/app/views/events/index.html.erb +++ b/app/views/events/index.html.erb @@ -15,7 +15,6 @@ <%= Event.human_attribute_name(:start_time) %> <%= Event.human_attribute_name(:end_time) %> <%= Event.human_attribute_name(:rrule) %> - <%= Event.human_attribute_name(:allday) %> <%= Event.human_attribute_name(:url) %> <%= Event.human_attribute_name(:start_node) %> @@ -23,11 +22,15 @@ <% @events.each do |event| %> - <%= link_to event.display_title, event %> + + + <%= flag("clock-off", Event.human_attribute_name(:allday)) if event.allday %> + + <%= link_to event.display_title, event %> + <%= admin_datetime(event.start_time) %> <%= admin_datetime(event.end_time) %> <%= rrule_with_break_opportunities(event.rrule) %> - <%= t("admin.common.#{event.allday ? "yes" : "no"}") %> <%= external_url_link(event.url) %> <%= event.node ? link_to(event.node.unique_name, node_path(event.node)) : "" %> <%= link_to t(".edit_link"), edit_event_path(event) %> diff --git a/app/views/users/_user.html.erb b/app/views/users/_user.html.erb index aa65cc3d..be92ad1d 100644 --- a/app/views/users/_user.html.erb +++ b/app/views/users/_user.html.erb @@ -1,28 +1,19 @@ <% users.each do |user| %> - + <% if user.otp_enrolled? %> - " aria-label="<%= t(".otp_enrolled") %>"> - <%= icon("shield-check", library: "tabler", "aria-hidden": true) %> - + <%= flag("shield-check", t(".otp_enrolled")) %> <% elsif user.otp_pending_secret.present? %> - " aria-label="<%= t(".otp_pending") %>"> - <%= icon("shield-half", library: "tabler", "aria-hidden": true) %> - + <%= flag("shield-half", t(".otp_pending"), :tier => :attention) %> <% else %> - " aria-label="<%= t(".otp_missing") %>"> - <%= icon("shield-off", library: "tabler", "aria-hidden": true) %> - + <%= flag("shield-off", t(".otp_missing"), :tier => :attention) %> <% end %> <% if (tier = user.staleness_tier) %> <% hint = tier == :never ? t(".stale_never") - : t(".stale_#{tier}", :year => user.last_login_at.year) %> - - <%= icon(tier == :amber ? "clock-exclamation" : "alert-triangle", - library: "tabler", "aria-hidden": true) %> - + : t(".stale_#{tier}", :year => user.last_login_at.year) %> + <%= flag(tier == :amber ? "clock-exclamation" : "alert-triangle", hint, + :tier => tier == :amber ? :attention : :alert) %> <% end %> <%= user.login %> -- cgit v1.3