Sha256: 69388515b863e5b780f91870fec9860b89390c886af7319717ab8ec75fc3c1e2

Contents?: true

Size: 1.25 KB

Versions: 4

Compression:

Stored size: 1.25 KB

Contents

module AdminIt
  #
  module Helpers
    #
    class ToolbarItem < WrapIt::Link
      attr_accessor :icon, :dialog, :add_class, :add_data
      option :icon
      option :add_class
      option :add_data
      option :dialog
      section :icon
      place :icon, before: :body

      before_capture do
        unless icon.nil?
          self[:icon] << html_safe("<i class=\"fa fa-#{icon}\"></i> ")
        end
        html_class << add_class
        data = add_data.is_a?(Hash) ? add_data : {}
        unless dialog.nil? || dialog.empty?
          data[:toggle] = 'modal'
          data[:target] = dialog
        end
        html_data.merge!(data)
#        options = { tag: 'li' }
#        options[:class] = 'active' if resource == @template.resource
#        wrap(options)
      end
    end

    #
    class ToolbarButtons < WrapIt::Container
      html_class 'btn-group'
      child :button, ToolbarItem, class: 'btn navbar-btn'
    end

    #
    class Toolbar < WrapIt::Container
      default_tag 'nav'
      html_class 'navbar admin-it-toolbar'
      child :item, ToolbarItem
      child :button, ToolbarItem, class: 'btn navbar-btn'
      child :buttons, ToolbarButtons

      after_initialize { self.deffered_render = true }
    end

    register :toolbar, Toolbar
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
admin_it-1.3.8 lib/admin_it/helpers/toolbar.rb
admin_it-1.3.7 lib/admin_it/helpers/toolbar.rb
admin_it-1.3.6 lib/admin_it/helpers/toolbar.rb
admin_it-1.3.5 lib/admin_it/helpers/toolbar.rb