Sha256: 41dd735b2007eca4411c82973c76ad833d22c0353fa2526a0b74a36b0be004ab

Contents?: true

Size: 1.23 KB

Versions: 45

Compression:

Stored size: 1.23 KB

Contents

module ExpressAdmin
  class MegaMenu < ExpressTemplates::Components::Base
    tag :li

    before_build -> {
      add_class('has-sub-menu')
    }

    contains -> {
      menu_wrapper {
        if helpers.admin_menus.any?
          helpers.admin_menus.each do |menu|
            menu_item(menu)
          end
        else
          para(class: 'lead text-muted') {
            "No modules added yet."
          }
        end
      }
    }

    def extra_menu
      render(partial: 'shared/express_admin/express_admin_extra_menu') rescue nil
    end

    def menu_item(menu)
      li {
        a(href: helpers.instance_eval(menu.path)) {
          i(class: "icon icon-express_#{menu.title.gsub(/\s+/, '').underscore}")
          span menu.title
        }
      }
    end

    def menu_wrapper
      li(class: "has-sub-menu") {
        a(class: "sub-menu-expander", href: '#', onClick: 'return false;') {
          span(class: 'item') {'Manage' }
          i(class: "ion-arrow-down-b")
        }
        div(class: 'sub-menu hidden') {
          ul(class: 'sub-menu-items') {
            li(class: 'title') { 'Modules' }
            yield
          }
          ul(class: 'sub-menu-items') {
            extra_menu
          }
        }
      }
    end
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
express_admin-1.7.20 app/components/express_admin/mega_menu.rb
express_admin-1.7.19 app/components/express_admin/mega_menu.rb
express_admin-1.7.18 app/components/express_admin/mega_menu.rb
express_admin-1.7.17 app/components/express_admin/mega_menu.rb
express_admin-1.7.16 app/components/express_admin/mega_menu.rb
express_admin-1.7.16.pre1 app/components/express_admin/mega_menu.rb
express_admin-1.7.15 app/components/express_admin/mega_menu.rb
express_admin-1.7.14 app/components/express_admin/mega_menu.rb
express_admin-1.7.13 app/components/express_admin/mega_menu.rb
express_admin-1.7.12 app/components/express_admin/mega_menu.rb
express_admin-1.7.11 app/components/express_admin/mega_menu.rb
express_admin-1.7.10 app/components/express_admin/mega_menu.rb
express_admin-1.7.9 app/components/express_admin/mega_menu.rb
express_admin-1.7.8 app/components/express_admin/mega_menu.rb
express_admin-1.7.7 app/components/express_admin/mega_menu.rb
express_admin-1.7.5 app/components/express_admin/mega_menu.rb
express_admin-1.7.4 app/components/express_admin/mega_menu.rb
express_admin-1.7.3 app/components/express_admin/mega_menu.rb
express_admin-1.7.2 app/components/express_admin/mega_menu.rb
express_admin-1.7.1 app/components/express_admin/mega_menu.rb