Module: Para::Admin::PageHelper

Defined in:
app/helpers/para/admin/page_helper.rb

Instance Method Summary collapse

Instance Method Details

#actions_for(type) ⇒ Object



25
26
27
28
29
# File 'app/helpers/para/admin/page_helper.rb', line 25

def actions_for(type)
  Para.config.page_actions_for(type).map do |action|
    instance_eval(&action)
  end.compact
end

#build_action(action) ⇒ Object



16
17
18
19
20
21
22
23
# File 'app/helpers/para/admin/page_helper.rb', line 16

def build_action(action)
  link_to(action[:url], class: 'btn btn-default') do
    (
      (fa_icon(action[:icon]) if action[:icon]) +
      action[:label]
    ).html_safe
  end
end

#page_top_bar(options = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'app/helpers/para/admin/page_helper.rb', line 4

def page_top_bar(options = {})
  (:div, class: 'page-title') do
    (:h1, options[:title]) +

    if (actions = actions_for(options[:type]))
      (:div, class: 'page-actions') do
        actions.map(&method(:build_action)).join('').html_safe
      end
    end
  end
end