Sha256: 69414ab41a44a74fd040f57d7d6ec9cc41e80b13435c4924dc5aa0ce202aa226

Contents?: true

Size: 583 Bytes

Versions: 2

Compression:

Stored size: 583 Bytes

Contents

module AdminHelper
  def admin_pages
    # TODO: something more elegant
    non_scaffold_pages = %w(dashboard sessions passwords)

    Dir.glob(Rails.root.join('app', 'controllers', 'admin', '*.rb')).map do |path|
      filename      = File.basename(path)
      resource_name = filename.sub(/_controller\.rb$/, '')

      unless non_scaffold_pages.include? resource_name
        {
            name:       resource_name.humanize,
            controller: "#{resource_name}",
            url:        self.send("admin_#{resource_name}_path")
        }
      end
    end.compact
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
admin-panel-0.1.3 lib/generators/admin_panel/install/templates/helpers/admin_helper.rb
admin-panel-0.1.2 lib/generators/admin_panel/install/templates/helpers/admin_helper.rb