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



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

def build_action(action)
  (:div, class: 'actions-control pull-right') do  
    link_to(action[:url], class: 'btn btn-default btn-shadow') do
      (
        (fa_icon(action[:icon], class: 'fa-fw') if action[:icon]) +
        action[:label]
      ).html_safe
    end
  end
end

#page_top_bar(options = {}) ⇒ Object



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

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

    if (actions = actions_for(options[:type]))
      actions.map(&method(:build_action)).join('').html_safe
    end
  end
end