Sha256: 6d2afb5d1a27750784f704d2c9e38febb2a8d2e2d1e35525d906f7d66ac81ae5

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

Contents

module Plutonium
  module Application
    module Controller
      extend ActiveSupport::Concern
      include Plutonium::Core::Controllers::Base

      included do
        helper_method :registered_resources
      end

      private

      # # Menu Builder
      # def build_namespace_node(namespaces, resource, parent)
      #   current = namespaces.shift
      #   if namespaces.size.zero?
      #     parent[current.pluralize] = url_for(resource_url_for(resource, parent: nil))
      #   else
      #     parent[current] = {}
      #     build_namespace_node(namespaces, resource, parent[current])
      #   end
      #   # parent.sort!
      # end

      # def build_namespace_tree(resources)
      #   root = {}
      #   resources.each do |resource|
      #     namespaces = resource.name.split("::")
      #     build_namespace_node(namespaces, resource, root)
      #   end
      #   root
      # end

      # def build_sidebar_menu
      #   build_namespace_tree(current_engine.resource_register)
      # end

      def registered_resources
        current_engine.resource_register.resources
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
plutonium-0.14.1 lib/plutonium/application/controller.rb
plutonium-0.14.0 lib/plutonium/application/controller.rb