Module: SimplePages::PagesHelper

Defined in:
app/helpers/simple_pages/pages_helper.rb

Instance Method Summary collapse

Instance Method Details

#author_vcard(author) ⇒ Object



14
15
16
17
18
# File 'app/helpers/simple_pages/pages_helper.rb', line 14

def author_vcard(author)
   :span, class: 'author vcard' do
    t('helpers.posted_by', name: (:span, author)).html_safe
  end
end

#local_published_at(object) ⇒ Object



24
25
26
# File 'app/helpers/simple_pages/pages_helper.rb', line 24

def local_published_at(object)
  object.published_at? ? object.published_at.localtime : nil
end

#page_author_optionsObject



28
29
30
31
32
# File 'app/helpers/simple_pages/pages_helper.rb', line 28

def page_author_options
  ::User.unscoped.map do |author|
    [author.name, author.simple_page_owner_option]
  end
end

#page_cluster_optionsObject



34
35
36
37
38
# File 'app/helpers/simple_pages/pages_helper.rb', line 34

def page_cluster_options
  ::Role.enabled.map do |role|
    [t(role.name, scope: 'roles.names'), role.name]
  end
end

#page_layout_at_optionsObject



40
41
42
43
44
# File 'app/helpers/simple_pages/pages_helper.rb', line 40

def page_layout_at_options
  page_layout_at.map do |key|
    [t(key, scope: 'simple_pages.layout_at'), key]
  end
end

#publish_time(published_at, updated_at) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'app/helpers/simple_pages/pages_helper.rb', line 3

def publish_time(published_at, updated_at)
  return unless published_at
  options = {
    datetime: published_at,
    pubdate: true,
    :'data-updated' => (updated_at != published_at ? 'true' : nil ),
    class: 'published_at'
  }
   :time, ::I18n.l(published_at, format: :long), options
end

#selected_page_author(object) ⇒ Object



20
21
22
# File 'app/helpers/simple_pages/pages_helper.rb', line 20

def selected_page_author(object)
  object.author.try :simple_page_owner_option
end