Sha256: 258452e697b056466dcce56badf4e142c30ba0c89254a4c04f39521ea070570b

Contents?: true

Size: 954 Bytes

Versions: 1

Compression:

Stored size: 954 Bytes

Contents

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

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

      def build_action(action)
        link_options = action.fetch(:link_options, {})
        link_options[:class] ||= "btn btn-default btn-shadow"

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
para-0.8.10 app/helpers/para/admin/page_helper.rb