summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-08-06 01:59:58 +0200
committererdgeist <erdgeist@erdgeist.org>2026-08-06 01:59:58 +0200
commit6290c20464ad5c622e902b4dd0de217c374b5905 (patch)
treeb0c46f13b9a6104ddfe7a0589599e1405945e1c2
parentaf2c6fd85e13139be3e3b2329a51c3a35acb3c40 (diff)
Reduce the events list to title, when and actions
-rw-r--r--app/helpers/events_helper.rb33
-rw-r--r--app/views/events/index.html.erb57
-rw-r--r--config/locales/de.yml8
-rw-r--r--config/locales/en.yml12
-rw-r--r--public/stylesheets/admin.css60
5 files changed, 137 insertions, 33 deletions
diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb
index 1e2e91dc..b14395ab 100644
--- a/app/helpers/events_helper.rb
+++ b/app/helpers/events_helper.rb
@@ -13,6 +13,37 @@ module EventsHelper
13 13
14 def external_url_link(url) 14 def external_url_link(url)
15 return nil if url.blank? 15 return nil if url.blank?
16 url.match?(%r{\Ahttps?://}i) ? link_to(url, url) : h(url) 16 return h(url) unless url.match?(%r{\Ahttps?://}i)
17 link_to(url, url, :target => "_blank", :rel => "noopener")
17 end 18 end
19
20 def event_date_range(event)
21 return t("events.schedule.none") if event.start_time.blank?
22
23 from = event.start_time
24 to = event.end_time
25
26 return one_day_range(from, event.allday) if to.blank? || to.to_date == from.to_date
27
28 if !event.allday && (to - from) <= 12.hours
29 return t("events.schedule.evening",
30 :date => admin_date(from),
31 :from => I18n.l(from, :format => :time),
32 :to => I18n.l(to, :format => :time))
33 end
34
35 key = from.year == to.year && from.month == to.month ? :same_month : :spanning
36 t("events.schedule.#{key}",
37 :from_day => from.day, :to_day => to.day,
38 :from_month => I18n.l(from, :format => :ccc_month),
39 :to_month => I18n.l(to, :format => :ccc_month),
40 :from_full => admin_date(from), :to_full => admin_date(to))
41 end
42
43 private
44
45 def one_day_range(from, allday)
46 return admin_date(from) if allday
47 admin_datetime(from)
48 end
18end 49end
diff --git a/app/views/events/index.html.erb b/app/views/events/index.html.erb
index 14790526..51269282 100644
--- a/app/views/events/index.html.erb
+++ b/app/views/events/index.html.erb
@@ -11,11 +11,7 @@
11<table class="events_table"> 11<table class="events_table">
12 <tr class="header"> 12 <tr class="header">
13 <th><%= t("admin.columns.title") %></th> 13 <th><%= t("admin.columns.title") %></th>
14 <th><%= Event.human_attribute_name(:start_time) %></th> 14 <th><%= t(".when") %></th>
15 <th><%= Event.human_attribute_name(:end_time) %></th>
16 <th><%= Event.human_attribute_name(:rrule) %></th>
17 <th><%= Event.human_attribute_name(:url) %></th>
18 <th><%= Event.human_attribute_name(:start_node) %></th>
19 <th></th> 15 <th></th>
20 </tr> 16 </tr>
21 17
@@ -24,17 +20,52 @@
24 <td> 20 <td>
25 <div class="title_with_flags"> 21 <div class="title_with_flags">
26 <span class="flag_stack"> 22 <span class="flag_stack">
27 <%= flag("clock-off", Event.human_attribute_name(:allday)) if event.allday %> 23 <%= flag("hours-24", Event.human_attribute_name(:allday)) if event.allday %>
24 <%= flag("sticker", t(".flag_own_title")) if event.title.present? %>
25 </span>
26 <div class="title_body">
27 <div class="event_title"><%= link_to event.display_title, event %></div>
28 <% if event.node %>
29 <div class="event_meta">
30 <%= icon("file", library: "tabler", "aria-hidden": true) %>
31 <%= link_to event.node.unique_name, node_path(event.node) %>
32 </div>
33 <% end %>
34 <% if event.url.present? %>
35 <div class="event_meta">
36 <%= icon("external-link", library: "tabler", "aria-hidden": true) %>
37 <%= external_url_link(event.url) %>
38 </div>
39 <% end %>
40 </div>
41 </div>
42 </td>
43 <td class="event_when">
44 <% if event.rrule.present? %>
45 <span class="rrule_raw" title="<%= event.rrule %>"><%= event_schedule_text(event) %></span>
46 <% if event.humanize_rrule.nil? && event.start_time %>
47 <div class="event_meta"><%= admin_date(event.start_time) %></div>
48 <% end %>
49 <% else %>
50 <%= event_date_range(event) %>
51 <% end %>
52 </td>
53 <td class="actions">
54 <div class="action_grid">
55 <span class="action_item">
56 <%= link_to event_path(event), "aria-label" => t("admin.common.show"),
57 title: t("admin.common.show") do %>
58 <%= icon("eye", library: "tabler", "aria-hidden": true) %>
59 <% end %>
60 </span>
61 <span class="action_item">
62 <%= link_to edit_event_path(event), "aria-label" => t("admin.common.edit"),
63 title: t("admin.common.edit") do %>
64 <%= icon("edit", library: "tabler", "aria-hidden": true) %>
65 <% end %>
28 </span> 66 </span>
29 <div class="title_body"><%= link_to event.display_title, event %></div>
30 </div> 67 </div>
31 </td> 68 </td>
32 <td><%= admin_datetime(event.start_time) %></td>
33 <td><%= admin_datetime(event.end_time) %></td>
34 <td class="rrule_cell"><span class="rrule_text"><%= rrule_with_break_opportunities(event.rrule) %></span></td>
35 <td class="url_cell"><span class="truncate"><%= external_url_link(event.url) %></span></td>
36 <td><%= event.node ? link_to(event.node.unique_name, node_path(event.node)) : "" %></td>
37 <td><%= link_to t(".edit_link"), edit_event_path(event) %></td>
38 </tr> 69 </tr>
39<% end %> 70<% end %>
40</table> 71</table>
diff --git a/config/locales/de.yml b/config/locales/de.yml
index df52da4c..1cd72106 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -41,6 +41,7 @@ de:
41 short: "%e. %B, %H:%M Uhr" 41 short: "%e. %B, %H:%M Uhr"
42 ccc: "%e. %B %Y, %H:%M Uhr" 42 ccc: "%e. %B %Y, %H:%M Uhr"
43 ccc_date: "%e. %B %Y" 43 ccc_date: "%e. %B %Y"
44 ccc_month: "%B %Y"
44 long: "%A, %e. %B %Y, %H:%M Uhr" 45 long: "%A, %e. %B %Y, %H:%M Uhr"
45 time: "%H:%M" 46 time: "%H:%M"
46 47
@@ -580,8 +581,8 @@ de:
580 index: 581 index:
581 title: "Termine" 582 title: "Termine"
582 create_event: "Termin anlegen" 583 create_event: "Termin anlegen"
583 edit_link: "bearbeiten"
584 search_placeholder: "Titel, Beschreibung, Ort, Tags durchsuchen…" 584 search_placeholder: "Titel, Beschreibung, Ort, Tags durchsuchen…"
585 flag_own_title: "Hat einen eigenen Titel"
585 show: 586 show:
586 title: "Termin" 587 title: "Termin"
587 title_for_node: "Termin für Node %{path}" 588 title_for_node: "Termin für Node %{path}"
@@ -595,6 +596,11 @@ de:
595 node_hint: "Optional — Node suchen und auswählen, um diesen Termin mit einer Seite zu verknüpfen." 596 node_hint: "Optional — Node suchen und auswählen, um diesen Termin mit einer Seite zu verknüpfen."
596 recurrence: "Wiederholung" 597 recurrence: "Wiederholung"
597 title_hint: "Optional. Bleibt das Feld leer, wird der Titel des verknüpften Nodes verwendet." 598 title_hint: "Optional. Bleibt das Feld leer, wird der Titel des verknüpften Nodes verwendet."
599 schedule:
600 none: "kein Datum"
601 same_month: "%{from_day}.–%{to_day}. %{to_month}"
602 spanning: "%{from_full} – %{to_full}"
603 evening: "%{date}, %{from}–%{to} Uhr"
598 rrule_builder: 604 rrule_builder:
599 weekly: "Wöchentlich" 605 weekly: "Wöchentlich"
600 monthly: "Monatlich" 606 monthly: "Monatlich"
diff --git a/config/locales/en.yml b/config/locales/en.yml
index f67016b9..9bd57c79 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -23,8 +23,9 @@ en:
23 23
24 time: 24 time:
25 formats: 25 formats:
26 ccc: "%d %B, %Y %H:%M" 26 ccc: "%-d %B %Y, %H:%M"
27 ccc_date: "%d %B, %Y" 27 ccc_date: "%-d %B %Y"
28 ccc_month: "%B %Y"
28 29
29 will_paginate: 30 will_paginate:
30 previous_label: "&#8592;" 31 previous_label: "&#8592;"
@@ -527,8 +528,8 @@ en:
527 index: 528 index:
528 title: "Events" 529 title: "Events"
529 create_event: "Create event" 530 create_event: "Create event"
530 edit_link: "edit"
531 search_placeholder: "Search title, description, location, tags…" 531 search_placeholder: "Search title, description, location, tags…"
532 flag_own_title: "Has its own title"
532 edit: 533 edit:
533 title: "Editing event" 534 title: "Editing event"
534 change_node: "Change node" 535 change_node: "Change node"
@@ -542,6 +543,11 @@ en:
542 node_hint: "Optional — search and pick a node to associate this event with a page." 543 node_hint: "Optional — search and pick a node to associate this event with a page."
543 recurrence: "Recurrence" 544 recurrence: "Recurrence"
544 title_hint: "Optional — if left blank, the associated node's title is used." 545 title_hint: "Optional — if left blank, the associated node's title is used."
546 schedule:
547 none: "no date"
548 same_month: "%{from_day}.–%{to_day}. %{to_month}"
549 spanning: "%{from_full} – %{to_full}"
550 evening: "%{date}, %{from}–%{to}"
545 rrule_builder: 551 rrule_builder:
546 weekly: "Weekly" 552 weekly: "Weekly"
547 monthly: "Monthly" 553 monthly: "Monthly"
diff --git a/public/stylesheets/admin.css b/public/stylesheets/admin.css
index b959597f..bd0c8412 100644
--- a/public/stylesheets/admin.css
+++ b/public/stylesheets/admin.css
@@ -763,21 +763,6 @@ table.revisions_table tr:hover {
763 background-color: var(--surface-tint); 763 background-color: var(--surface-tint);
764} 764}
765 765
766.events_table .rrule_text {
767 display: inline-block;
768 max-width: 300px;
769 overflow-wrap: break-word;
770}
771
772.events_table .truncate {
773 display: inline-block;
774 max-width: 200px;
775 overflow: hidden;
776 text-overflow: ellipsis;
777 white-space: nowrap;
778 vertical-align: bottom;
779}
780
781#diffview del { 766#diffview del {
782 background: var(--diff-del-bg); 767 background: var(--diff-del-bg);
783 color: var(--diff-del-fg); 768 color: var(--diff-del-fg);
@@ -832,6 +817,50 @@ table.revisions_table tr:hover {
832 padding-right: 0; 817 padding-right: 0;
833} 818}
834 819
820.events_table td.title,
821.events_table th.title {
822 padding-right: 0.75rem;
823}
824
825.events_table .event_title {
826 font-weight: bold;
827}
828
829.events_table .event_meta {
830 display: flex;
831 align-items: center;
832 gap: 0.3rem;
833 margin-top: 0.15rem;
834 font-size: 0.875rem;
835}
836
837.events_table .event_meta svg {
838 width: 0.875rem;
839 height: 0.875rem;
840 flex-shrink: 0;
841}
842
843.events_table .event_meta a {
844 overflow-wrap: anywhere;
845 color: var(--text-muted);
846}
847
848.events_table .event_when {
849 overflow-wrap: normal;
850 min-width: 7rem;
851 padding-right: 0.75rem;
852}
853
854.events_table .event_when .rrule_raw {
855 overflow-wrap: anywhere;
856}
857
858.events_table td.actions {
859 width: 1px;
860 white-space: nowrap;
861 padding-right: 0;
862}
863
835.action_grid { 864.action_grid {
836 display: grid; 865 display: grid;
837 gap: 0.4rem; 866 gap: 0.4rem;
@@ -840,6 +869,7 @@ table.revisions_table tr:hover {
840 869
841.user_table .action_grid { grid-template-columns: repeat(3, auto); } 870.user_table .action_grid { grid-template-columns: repeat(3, auto); }
842.node_table .action_grid { grid-template-columns: repeat(2, auto); } 871.node_table .action_grid { grid-template-columns: repeat(2, auto); }
872.events_table .action_grid { grid-template-columns: repeat(2, auto); }
843 873
844/* min-height keeps a row the same height whether or not the viewer may see 874/* min-height keeps a row the same height whether or not the viewer may see
845 the lower controls. */ 875 the lower controls. */