Module: Pageflow::EntriesHelper
- Defined in:
- app/helpers/pageflow/entries_helper.rb
Instance Method Summary collapse
- #entry_css_class(entry) ⇒ Object
- #entry_file_rights(entry) ⇒ Object
- #entry_global_links(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_css_class(entry) ⇒ Object
60 61 62 63 64 65 |
# File 'app/helpers/pageflow/entries_helper.rb', line 60 def entry_css_class(entry) [ (entry), entry.emphasize_chapter_beginning ? 'emphasize_chapter_beginning' : nil ].compact.join(' ') end |
#entry_file_rights(entry) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/helpers/pageflow/entries_helper.rb', line 7 def entry_file_rights(entry) rights = Pageflow.config.file_types.map do |file_type| entry.files(file_type.model).map do |file| file.rights.presence || entry.account.default_file_rights.presence end end.flatten.compact.sort.uniq if rights.any? content_tag :p, class: 'rights' do I18n.t('pageflow.helpers.entries.image_rights') + ": " + rights * ', ' end else '' end end |
#entry_global_links(entry) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/helpers/pageflow/entries_helper.rb', line 23 def entry_global_links(entry) links = [] if entry.theming.imprint_link_label.present? && entry.theming.imprint_link_url.present? links << link_to(raw(entry.theming.imprint_link_label), entry.theming.imprint_link_url, :target => '_blank', :tabindex => 2, :class => 'legal') end if entry.theming.copyright_link_label.present? && entry.theming.copyright_link_url.present? links << link_to(raw(entry.theming.copyright_link_label), entry.theming.copyright_link_url, :target => '_blank', :tabindex => 2, :class => 'copy') end if links.any? content_tag(:h2, I18n.t('pageflow.helpers.entries.global_links'), :class => 'hidden') + safe_join(links, ''.html_safe) else '' end end |
#entry_header_css_class(entry) ⇒ Object
67 68 69 70 71 72 73 |
# File 'app/helpers/pageflow/entries_helper.rb', line 67 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
52 53 54 55 56 57 58 |
# File 'app/helpers/pageflow/entries_helper.rb', line 52 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
43 44 45 46 47 48 49 50 |
# File 'app/helpers/pageflow/entries_helper.rb', line 43 def entry_stylesheet_link_tag(entry) url = polymorphic_path(entry.stylesheet_model, v: entry.stylesheet_cache_key, p: Pageflow::VERSION, format: 'css') stylesheet_link_tag(url, media: 'all') end |
#entry_summary(entry) ⇒ Object
75 76 77 78 |
# File 'app/helpers/pageflow/entries_helper.rb', line 75 def entry_summary(entry) return '' if entry.summary.blank? (entry.summary.gsub(/<br ?\/?>/, ' ').squish) end |
#entry_theme_stylesheet_link_tag(entry) ⇒ Object
39 40 41 |
# File 'app/helpers/pageflow/entries_helper.rb', line 39 def entry_theme_stylesheet_link_tag(entry) stylesheet_link_tag(entry.theming.theme.stylesheet_path, :media => 'all') end |