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/models/page.rb | |
| 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/models/page.rb')
| -rw-r--r-- | app/models/page.rb | 8 |
1 files changed, 8 insertions, 0 deletions
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 |
