diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-06-30 03:55:42 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-06-30 19:22:24 +0200 |
| commit | 51629c5c42270a346885057a441095c964101cc1 (patch) | |
| tree | c2eaf148feb443ef51b20d3147fc9e368239ab12 /app/helpers/nodes_helper.rb | |
| parent | 4705ef970469a852c7bdb4c097ba748e972c8f63 (diff) | |
Fix events CRUD for standalone events and add events to admin menu
- event_params now permits title, description, is_primary
- event_information helper lists all node.events, not just the first
- Occurrence.generate handles nil node (standalone events)
- Page.aggregate order_by title uses correlated subquery to avoid
GROUP BY conflict with tag-filter path; order_direction whitelisted
to ASC/DESC to prevent SQL injection
- Events link added to admin menu bar
- events/index shows title, is_primary; drops latitude/longitude columns
Diffstat (limited to 'app/helpers/nodes_helper.rb')
| -rw-r--r-- | app/helpers/nodes_helper.rb | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/app/helpers/nodes_helper.rb b/app/helpers/nodes_helper.rb index d88d12a..4293628 100644 --- a/app/helpers/nodes_helper.rb +++ b/app/helpers/nodes_helper.rb | |||
| @@ -30,19 +30,17 @@ module NodesHelper | |||
| 30 | end | 30 | end |
| 31 | 31 | ||
| 32 | def event_information | 32 | def event_information |
| 33 | if @node.events.first | 33 | events = @node.events.order(:start_time) |
| 34 | event = @node.events.first | 34 | items = events.map do |event| |
| 35 | safe_join([ | 35 | safe_join([ |
| 36 | "#{event.start_time.to_fs(:db)} - #{event.end_time.to_fs(:db)} > ", | 36 | "#{event.start_time&.to_fs(:db)} - #{event.end_time&.to_fs(:db)} > ", |
| 37 | link_to('show', event_path(event)), | 37 | link_to('edit', edit_event_path(event)), |
| 38 | ' > ', | ||
| 39 | link_to('edit', edit_event_path(event)) | ||
| 40 | ]) | ||
| 41 | else | ||
| 42 | safe_join([ | ||
| 43 | 'no event attached > ', | ||
| 44 | link_to('add', new_event_path(:node_id => @node.id)) | ||
| 45 | ]) | 38 | ]) |
| 46 | end | 39 | end |
| 40 | safe_join([ | ||
| 41 | safe_join(items, ' | '), | ||
| 42 | ' > ', | ||
| 43 | link_to('add event', new_event_path(:node_id => @node.id)) | ||
| 44 | ]) | ||
| 47 | end | 45 | end |
| 48 | end | 46 | end |
