Sha256: 9d18b86899e841c7cd953406f63a5324d9abc68dc23f46f6b47e831484725de5

Contents?: true

Size: 1.06 KB

Versions: 8

Compression:

Stored size: 1.06 KB

Contents

require 'pagy'
module CmAdmin
  module ViewHelpers
    module NavigationHelper
      include Pagy::Frontend
      def navigation_links(navigation_type)
        CmAdmin.cm_admin_models.map { |model|
          path = CmAdmin::Engine.mount_path + '/' + model.name.underscore.pluralize
          if navigation_type == "sidebar"
            content_tag(:a, href: path) do
              content_tag(:div, class: 'menu-item') do
                content_tag(:span, class: 'menu-icon') do
                  concat tag.i class: 'fa fa-th-large'
                end +
                model.name
              end
            end
          elsif navigation_type == "quick_links"
            content_tag(:a, href: path, class: 'visible') do
              content_tag(:div, class: 'result-item') do
                content_tag(:span) do
                  concat tag.i class: 'fa fa-th-large'
                end +
                content_tag(:span) do
                  model.name
                end
              end
            end
          end
        }.join.html_safe
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
cm-admin-0.5.3 lib/cm_admin/view_helpers/navigation_helper.rb
cm-admin-0.5.2 lib/cm_admin/view_helpers/navigation_helper.rb
cm-admin-0.5.0 lib/cm_admin/view_helpers/navigation_helper.rb
cm-admin-0.4.4 lib/cm_admin/view_helpers/navigation_helper.rb
cm-admin-0.4.3 lib/cm_admin/view_helpers/navigation_helper.rb
cm-admin-0.4.2 lib/cm_admin/view_helpers/navigation_helper.rb
cm-admin-0.4.1 lib/cm_admin/view_helpers/navigation_helper.rb
cm-admin-0.4.0 lib/cm_admin/view_helpers/navigation_helper.rb