Module: Pageflow::EntriesHelper
- Defined in:
- app/helpers/pageflow/entries_helper.rb
Instance Method Summary collapse
- #entry_collection_for_parent(parent) ⇒ Object
- #entry_file_rights(entry) ⇒ Object
- #entry_header_css_class(entry) ⇒ Object
- #entry_mobile_navigation_pages(entry) ⇒ Object
- #entry_stylesheet_link_tag(entry) ⇒ Object
- #entry_summary(entry) ⇒ Object
- #entry_theme_stylesheet_link_tag(entry) ⇒ Object
- #pretty_entry_url(entry) ⇒ Object
Instance Method Details
#entry_collection_for_parent(parent) ⇒ Object
7 8 9 10 11 12 13 |
# File 'app/helpers/pageflow/entries_helper.rb', line 7 def entry_collection_for_parent(parent) if parent.is_a?(User) parent.account.entries - parent.entries else parent.account.entries end end |
#entry_file_rights(entry) ⇒ Object
15 16 17 18 19 20 21 |
# File 'app/helpers/pageflow/entries_helper.rb', line 15 def entry_file_rights(entry) [:audio_files, :image_files, :video_files].map do |collection| entry.send(collection).map do |file| file.rights.presence || entry.account.default_file_rights end end.flatten.sort.uniq * ', ' end |
#entry_header_css_class(entry) ⇒ Object
39 40 41 42 43 44 45 |
# File 'app/helpers/pageflow/entries_helper.rb', line 39 def entry_header_css_class(entry) css_class = 'header' if entry.pages.any? && entry.pages.first.configuration['invert'] css_class += ' invert' end css_class end |
#entry_mobile_navigation_pages(entry) ⇒ Object
31 32 33 34 35 36 37 |
# File 'app/helpers/pageflow/entries_helper.rb', line 31 def (entry) entry.pages..tap do |pages| if entry.pages.any? && !entry.pages.first. pages.unshift(entry.pages.first) end end end |
#entry_stylesheet_link_tag(entry) ⇒ Object
27 28 29 |
# File 'app/helpers/pageflow/entries_helper.rb', line 27 def entry_stylesheet_link_tag(entry) stylesheet_link_tag(polymorphic_path(entry.stylesheet_model, v: entry.stylesheet_cache_key, format: 'css'), media: 'all') end |
#entry_summary(entry) ⇒ Object
47 48 49 50 |
# File 'app/helpers/pageflow/entries_helper.rb', line 47 def entry_summary(entry) return '' if entry.summary.blank? (entry.summary.gsub(/<br ?\/?>/, ' ').squish) end |
#entry_theme_stylesheet_link_tag(entry) ⇒ Object
23 24 25 |
# File 'app/helpers/pageflow/entries_helper.rb', line 23 def entry_theme_stylesheet_link_tag(entry) stylesheet_link_tag(entry.theming.theme.stylesheet_path, :media => 'all') end |