diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-06-28 04:43:28 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-06-30 19:22:24 +0200 |
| commit | 4dd49b1eebb0a99d3aee66b7eca539c87a9c6332 (patch) | |
| tree | a3bc6325c6433c8cf29f2fcff4c3459c6d612d6d /app | |
| parent | a7a6ad786eeb9f94f7882462bccbdd31e1bb4743 (diff) | |
Phase 2: chapter nodes, aggregate partial, fixes
- _chapter.html.erb: new partial for erfa/chaostreff aggregated lists;
renders title, location, external_url, sanitized body
- content_helper: fix aggregate attr regex to allow hyphens in values
(erfa-detail tag was silently dropped); add debug logging (remove)
- page.rb: suppress libxml stderr noise in rewrite_links_in_body
- db/seeds/chapters.rb: one-shot seed script for erfa and chaostreff
chapter nodes under parent nodes 548/549; creates bilingual pages,
external_url, primary events with RRULEs where known
Note: run Node.rebuild!(false) after execution to fix lft/rgt values
Diffstat (limited to 'app')
| -rw-r--r-- | app/helpers/content_helper.rb | 2 | ||||
| -rw-r--r-- | app/models/page.rb | 8 | ||||
| -rw-r--r-- | app/views/custom/partials/_chapter.html.erb | 10 |
3 files changed, 19 insertions, 1 deletions
diff --git a/app/helpers/content_helper.rb b/app/helpers/content_helper.rb index 21cc579..53bf5b2 100644 --- a/app/helpers/content_helper.rb +++ b/app/helpers/content_helper.rb | |||
| @@ -80,7 +80,7 @@ module ContentHelper | |||
| 80 | begin | 80 | begin |
| 81 | if content =~ /\[aggregate([^\]]*)\]/ | 81 | if content =~ /\[aggregate([^\]]*)\]/ |
| 82 | tag = $~.to_s | 82 | tag = $~.to_s |
| 83 | matched_data = $1.scan(/\w+\="[a-zA-Z\s\/_\d,.=]*"/) | 83 | matched_data = $1.scan(/\w+\="[a-zA-Z\s\/_\d,.=-]*"/) |
| 84 | 84 | ||
| 85 | matched_data.each do |data| | 85 | matched_data.each do |data| |
| 86 | splitted_data = data.split("=", 2) | 86 | splitted_data = data.split("=", 2) |
diff --git a/app/models/page.rb b/app/models/page.rb index e6baf20..385b3f6 100644 --- a/app/models/page.rb +++ b/app/models/page.rb | |||
| @@ -63,6 +63,14 @@ class Page < ApplicationRecord | |||
| 63 | end | 63 | end |
| 64 | end | 64 | end |
| 65 | 65 | ||
| 66 | if options[:order_by] == "title" | ||
| 67 | return scope | ||
| 68 | .joins(:translations) | ||
| 69 | .where(page_translations: { locale: I18n.locale }) | ||
| 70 | .order("page_translations.title #{options[:order_direction]}") | ||
| 71 | .paginate(:page => page, :per_page => options[:limit]) | ||
| 72 | end | ||
| 73 | |||
| 66 | scope.order("#{options[:order_by]} #{options[:order_direction]}") | 74 | scope.order("#{options[:order_by]} #{options[:order_direction]}") |
| 67 | .paginate(:page => page, :per_page => options[:limit]) | 75 | .paginate(:page => page, :per_page => options[:limit]) |
| 68 | end | 76 | end |
diff --git a/app/views/custom/partials/_chapter.html.erb b/app/views/custom/partials/_chapter.html.erb new file mode 100644 index 0000000..a5b8662 --- /dev/null +++ b/app/views/custom/partials/_chapter.html.erb | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | <div class="article_partial chapter_partial" lang="<%= page.effective_lang %>"> | ||
| 2 | <h2 class="headline"><%= link_to_path page.title, page.node.unique_name %></h2> | ||
| 3 | <% if page.abstract.present? %> | ||
| 4 | <div class="chapter_location"><%= page.abstract %></div> | ||
| 5 | <% end %> | ||
| 6 | <% if page.node.external_url.present? %> | ||
| 7 | <div class="chapter_url"><%= link_to page.node.external_url, page.node.external_url, target: '_blank', rel: 'noopener' %></div> | ||
| 8 | <% end %> | ||
| 9 | <p class="excerpt"><%= sanitize page.body %></p> | ||
| 10 | </div> | ||
