Sha256: e33d94727a5886276db26e29f21761fce8458f0b2472f3a2e56e8982fd8ddac7

Contents?: true

Size: 1.24 KB

Versions: 14

Compression:

Stored size: 1.24 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'
      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

14 entries across 14 versions & 1 rubygems

Version Path
admin_it-1.3.4 lib/admin_it/helpers/toolbar.rb
admin_it-1.3.3 lib/admin_it/helpers/toolbar.rb
admin_it-1.3.2 lib/admin_it/helpers/toolbar.rb
admin_it-1.3.1 lib/admin_it/helpers/toolbar.rb
admin_it-1.3.0 lib/admin_it/helpers/toolbar.rb
admin_it-1.2.8 lib/admin_it/helpers/toolbar.rb
admin_it-1.2.7 lib/admin_it/helpers/toolbar.rb
admin_it-1.2.6 lib/admin_it/helpers/toolbar.rb
admin_it-1.2.5 lib/admin_it/helpers/toolbar.rb
admin_it-1.2.4 lib/admin_it/helpers/toolbar.rb
admin_it-1.2.3 lib/admin_it/helpers/toolbar.rb
admin_it-1.2.2 lib/admin_it/helpers/toolbar.rb
admin_it-1.2.1 lib/admin_it/helpers/toolbar.rb
admin_it-1.2.0 lib/admin_it/helpers/toolbar.rb