From ff2edea873de50c5be41cd24bb7a8d1e0d75d9ee Mon Sep 17 00:00:00 2001 From: erdgeist Date: Thu, 9 Jul 2026 19:27:47 +0200 Subject: Modernize events#edit: node re-link guard, editable Title, layout overhaul Converts the

-per-field layout to node_description/node_content, matching every other converted view. The RRULE builder's internal markup and JS-driven show/hide are untouched -- only its containing block moved. Adds the same node picker and optional Title field events#new just got, with one addition specific to edit: an already-linked event shows its node as a plain link, with the picker itself gated behind a

disclosure. Re-linking a live event to a different node is rare and has real side effects (which page it appears under, which tag-prefill applies), so it gets an extra click rather than sitting as easy to trigger as the unlinked case, which stays unguarded. Moves Destroy out of the subnav and into the page body, matching events#show. Required extracting it (and Back) into their own block outside form_for -- button_to generates its own nested
, which the browser silently drops when nested inside another; this is the same failure mode nodes#edit hit earlier in this branch. Reuses the existing .node_action_bar class rather than the naked block that would've resulted, adding a "standalone_action_bar" modifier for the two things specific to living outside #page_editor: the -125px margin every other line in the form gets for free, and link underline visibility, since this is the first .node_action_bar instance with a bare rather than only buttons. --- app/views/events/edit.html.erb | 151 +++++++++++++++++++++++------------------ public/stylesheets/admin.css | 5 ++ 2 files changed, 90 insertions(+), 66 deletions(-) diff --git a/app/views/events/edit.html.erb b/app/views/events/edit.html.erb index d37c299..6cb04bd 100644 --- a/app/views/events/edit.html.erb +++ b/app/views/events/edit.html.erb @@ -1,76 +1,95 @@ -<% content_for :subnavigation do %> - <%= link_to 'back', safe_return_to(params[:return_to] || events_path) %> - <%= button_to 'destroy', event_path(@event), method: :delete, form: { data: { confirm: 'Delete this event?' }, class: 'button_to destructive' } %> -<% end %> -

Editing event

+
+ <%= link_to 'Back', safe_return_to(params[:return_to] || events_path) %> + <%= button_to 'Destroy', event_path(@event), method: :delete, + form: { data: { confirm: 'Delete this event?' }, class: 'button_to destructive' } %> +
+ <%= form_for(@event) do |f| %> <%= hidden_field_tag :return_to, @return_to %> <%= form_error_messages(f) %> -

- <%= f.label :start_time %>
- <%= f.datetime_select :start_time %> -

-

- <%= f.label :end_time %>
- <%= f.datetime_select :end_time %> -

-

- <%= f.label :rrule, "Recurrence" %> -

-

- - -

-
-

-

- <% %w[MO TU WE TH FR SA SU].each do |code| %> - - <% end %> -

+
+
+
Node
+
+ <% if @event.node %> + <%= link_to @event.node.title, node_path(@event.node) %> +
+ Change node + <%= text_field_tag :event_node_search_term %> +
+ This will re-link the event to a different node — rarely needed. +
+ <% else %> + <%= text_field_tag :event_node_search_term %> +
+ Optional — search and pick a node to associate this event with a page. + <% end %> + <%= f.hidden_field :node_id %> +
+ +
Start time
+
<%= f.datetime_select :start_time %>
+ +
End time
+
<%= f.datetime_select :end_time %>
+ +
Recurrence
+
+
+

+ + +

+
+

+

+ <% %w[MO TU WE TH FR SA SU].each do |code| %> + + <% end %> +

+
+ +

+ + <%= select_tag "rrule_excluded_month", options_for_select((1..12).map { |m| [RruleHumanizer::MONTH_NAMES[:de][m-1], m] }), style: "display: none;" %> +

+ Builds the field below automatically. If your pattern is more complex than this covers, just edit it directly below - these controls won't touch it unless you use them. +
+ <%= f.text_field :rrule, id: "event_rrule" %>
- - <%= f.text_field :rrule, id: "event_rrule" %> -

-

- <%= f.label :tag_list, "Tags" %>
- <%= f.text_field :tag_list %> -

-

- <%= f.label :allday %>
- <%= f.check_box :allday %> -

-

- <%= f.label :url %>
- <%= f.text_field :url %> -

-

- <%= f.label :latitude %>
- <%= f.text_field :latitude %> -

-

- <%= f.label :longitude %>
- <%= f.text_field :longitude %> -

-

- <%= f.hidden_field :node_id %> -

-

- <%= f.submit 'Update' %> -

+
<% end %> diff --git a/public/stylesheets/admin.css b/public/stylesheets/admin.css index 3f95b0c..fa36c18 100644 --- a/public/stylesheets/admin.css +++ b/public/stylesheets/admin.css @@ -31,6 +31,7 @@ table.events_table a, table.user_table a, table.revisions_table a, .add_child_links a, +.standalone_action_bar a, div#draft_list table td.actions a { text-decoration: underline; -webkit-text-decoration-style: wavy; @@ -83,6 +84,10 @@ input[type=radio] { .node_action_bar.node_action_bar_save { margin-left: 120px; } + + .standalone_action_bar { + margin-left: -125px; + } } @media(max-width:1015px) { #wrapper { -- cgit v1.3