diff options
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) |
