diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-08-20 19:39:39 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-08-20 19:39:39 +0200 |
| commit | a986b1f2b5676624f02373cb54eb3b81b18f3f79 (patch) | |
| tree | 7ea53301f7c00bcec2b9e0349fb9633e0d9e956a /app/models/node.rb | |
| parent | b689127a29b050b9eefac1381fe150ec0da695a8 (diff) | |
Add banner render logic
Diffstat (limited to 'app/models/node.rb')
| -rw-r--r-- | app/models/node.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/node.rb b/app/models/node.rb index ef981a97..8f59de43 100644 --- a/app/models/node.rb +++ b/app/models/node.rb | |||
| @@ -632,6 +632,17 @@ class Node < ApplicationRecord | |||
| 632 | .distinct | 632 | .distinct |
| 633 | end | 633 | end |
| 634 | 634 | ||
| 635 | def self.current_banners | ||
| 636 | parent = Node.find_by(:unique_name => CccConventions::BANNER_PARENT_NAME) | ||
| 637 | return Node.none unless parent | ||
| 638 | |||
| 639 | parent.children | ||
| 640 | .joins(:head) | ||
| 641 | .where("pages.published_at IS NULL OR pages.published_at <= ?", Time.now) | ||
| 642 | .order("pages.published_at DESC") | ||
| 643 | .includes(:head => { :related_assets => :asset }) | ||
| 644 | end | ||
| 645 | |||
| 635 | # This one is for admin-only views, where finding a draft is the point. | 646 | # This one is for admin-only views, where finding a draft is the point. |
| 636 | # Substring match on whichever of head/draft is present. | 647 | # Substring match on whichever of head/draft is present. |
| 637 | def self.editor_search(term) | 648 | def self.editor_search(term) |
