Module: Pageflow::EntriesHelper

Defined in:
app/helpers/pageflow/entries_helper.rb

Instance Method Summary collapse

Instance Method Details

#entry_collection_for_parent(parent) ⇒ Object



11
12
13
14
15
16
17
# File 'app/helpers/pageflow/entries_helper.rb', line 11

def entry_collection_for_parent(parent)
  if parent.is_a?(User)
    parent..entries - parent.entries
  else
    parent..entries
  end
end

#entry_file_rights(entry) ⇒ Object



19
20
21
22
23
24
25
# File 'app/helpers/pageflow/entries_helper.rb', line 19

def entry_file_rights(entry)
  [:audio_files, :image_files, :video_files].map do |collection|
    entry.send(collection).map do |file|
      file.rights.presence || entry..default_file_rights
    end
  end.flatten.sort.uniq * ', '
end

#entry_header_css_class(entry) ⇒ Object



43
44
45
46
47
48
49
# File 'app/helpers/pageflow/entries_helper.rb', line 43

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



35
36
37
38
39
40
41
# File 'app/helpers/pageflow/entries_helper.rb', line 35

def entry_mobile_navigation_pages(entry)
  entry.pages.displayed_in_navigation.tap do |pages|
    if entry.pages.any? && !entry.pages.first.display_in_navigation
      pages.unshift(entry.pages.first)
    end
  end
end

#entry_stylesheet_link_tag(entry) ⇒ Object



31
32
33
# File 'app/helpers/pageflow/entries_helper.rb', line 31

def entry_stylesheet_link_tag(entry)
  stylesheet_link_tag(polymorphic_path(entry.stylesheet_model, :format => 'css'), :media => 'all')
end

#entry_summary(entry) ⇒ Object



51
52
53
54
# File 'app/helpers/pageflow/entries_helper.rb', line 51

def entry_summary(entry)
  return '' if entry.summary.blank?
  strip_tags(entry.summary.gsub(/<br ?\/?>/, ' ').squish)
end

#entry_theme_stylesheet_link_tag(entry) ⇒ Object



27
28
29
# File 'app/helpers/pageflow/entries_helper.rb', line 27

def entry_theme_stylesheet_link_tag(entry)
  stylesheet_link_tag(entry.theming.theme.stylesheet_path, :media => 'all')
end

#pretty_entry_url(entry) ⇒ Object



3
4
5
6
7
8
9
# File 'app/helpers/pageflow/entries_helper.rb', line 3

def pretty_entry_url(entry)
  if entry.theming.cname.present?
    short_entry_url(entry.to_model, :host => entry.theming.cname)
  else
    short_entry_url(entry.to_model)
  end
end