active_admin_menu 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d57449bdcecd4cac16edaaf94377ea49a90d7b47
4
+ data.tar.gz: fe1faf28ad26ec69a66f31f41120380c12ea6c01
5
+ SHA512:
6
+ metadata.gz: 4c4c11dd16b27ed8148c2a3e8795136ea1770927ff73e5d866823c10f5719c313af60f97c684031cb4eddd5a902940cb903d80f47661626499e40ca3e626ca59
7
+ data.tar.gz: 9e60a1712247606a71c04a245ecba1175898e673b74e5c28e97ff848539f86a726a7392b0f4c079eb68db073c9be5ad85717fc0e0442913da5bba9c5766c4c3d
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,14 @@
1
+ inherit_from:
2
+ - .ruby-style.yml
3
+
4
+ AllCops:
5
+ Exclude:
6
+ - "bin/*"
7
+ - "vendor/**/*"
8
+ - Gemfile
9
+ - Rakefile
10
+ DisplayCopNames: true
11
+ TargetRubyVersion: 2.1
12
+
13
+ Metrics/LineLength:
14
+ Enabled: false
data/.ruby-style.yml ADDED
@@ -0,0 +1,242 @@
1
+ AllCops:
2
+ Exclude:
3
+ - "vendor/**/*"
4
+ UseCache: false
5
+ Style/CollectionMethods:
6
+ Description: Preferred collection methods.
7
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size
8
+ Enabled: true
9
+ PreferredMethods:
10
+ collect: map
11
+ collect!: map!
12
+ find: detect
13
+ find_all: select
14
+ reduce: inject
15
+ Style/DotPosition:
16
+ Description: Checks the position of the dot in multi-line method calls.
17
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains
18
+ Enabled: true
19
+ EnforcedStyle: trailing
20
+ SupportedStyles:
21
+ - leading
22
+ - trailing
23
+ Style/FileName:
24
+ Description: Use snake_case for source file names.
25
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-files
26
+ Enabled: false
27
+ Exclude: []
28
+ Style/GuardClause:
29
+ Description: Check for conditionals that can be replaced with guard clauses
30
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals
31
+ Enabled: false
32
+ MinBodyLength: 1
33
+ Style/IfUnlessModifier:
34
+ Description: Favor modifier if/unless usage when you have a single-line body.
35
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier
36
+ Enabled: false
37
+ MaxLineLength: 80
38
+ Style/OptionHash:
39
+ Description: Don't use option hashes when you can use keyword arguments.
40
+ Enabled: false
41
+ Style/PercentLiteralDelimiters:
42
+ Description: Use `%`-literal delimiters consistently
43
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-literal-braces
44
+ Enabled: false
45
+ PreferredDelimiters:
46
+ "%": "()"
47
+ "%i": "()"
48
+ "%q": "()"
49
+ "%Q": "()"
50
+ "%r": "{}"
51
+ "%s": "()"
52
+ "%w": "()"
53
+ "%W": "()"
54
+ "%x": "()"
55
+ Style/PredicateName:
56
+ Description: Check the names of predicate methods.
57
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark
58
+ Enabled: true
59
+ NamePrefix:
60
+ - is_
61
+ - has_
62
+ - have_
63
+ NamePrefixBlacklist:
64
+ - is_
65
+ Exclude:
66
+ - spec/**/*
67
+ Style/RaiseArgs:
68
+ Description: Checks the arguments passed to raise/fail.
69
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#exception-class-messages
70
+ Enabled: false
71
+ EnforcedStyle: exploded
72
+ SupportedStyles:
73
+ - compact
74
+ - exploded
75
+ Style/SignalException:
76
+ Description: Checks for proper usage of fail and raise.
77
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#fail-method
78
+ Enabled: false
79
+ EnforcedStyle: semantic
80
+ SupportedStyles:
81
+ - only_raise
82
+ - only_fail
83
+ - semantic
84
+ Style/SingleLineBlockParams:
85
+ Description: Enforces the names of some block params.
86
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#reduce-blocks
87
+ Enabled: false
88
+ Methods:
89
+ - reduce:
90
+ - a
91
+ - e
92
+ - inject:
93
+ - a
94
+ - e
95
+ Style/SingleLineMethods:
96
+ Description: Avoid single-line methods.
97
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-single-line-methods
98
+ Enabled: false
99
+ AllowIfMethodIsEmpty: true
100
+ Style/StringLiterals:
101
+ Description: Checks if uses of quotes match the configured preference.
102
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-string-literals
103
+ Enabled: true
104
+ EnforcedStyle: double_quotes
105
+ SupportedStyles:
106
+ - single_quotes
107
+ - double_quotes
108
+ Style/StringLiteralsInInterpolation:
109
+ Description: Checks if uses of quotes inside expressions in interpolated strings
110
+ match the configured preference.
111
+ Enabled: true
112
+ EnforcedStyle: single_quotes
113
+ SupportedStyles:
114
+ - single_quotes
115
+ - double_quotes
116
+ Style/TrailingCommaInArguments:
117
+ Description: 'Checks for trailing comma in argument lists.'
118
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
119
+ Enabled: false
120
+ EnforcedStyleForMultiline: no_comma
121
+ SupportedStyles:
122
+ - comma
123
+ - consistent_comma
124
+ - no_comma
125
+ Style/TrailingCommaInLiteral:
126
+ Description: 'Checks for trailing comma in array and hash literals.'
127
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
128
+ Enabled: false
129
+ EnforcedStyleForMultiline: no_comma
130
+ SupportedStyles:
131
+ - comma
132
+ - consistent_comma
133
+ - no_comma
134
+ Metrics/AbcSize:
135
+ Description: A calculated magnitude based on number of assignments, branches, and
136
+ conditions.
137
+ Enabled: false
138
+ Max: 15
139
+ Metrics/ClassLength:
140
+ Description: Avoid classes longer than 100 lines of code.
141
+ Enabled: false
142
+ CountComments: false
143
+ Max: 100
144
+ Metrics/ModuleLength:
145
+ CountComments: false
146
+ Max: 100
147
+ Description: Avoid modules longer than 100 lines of code.
148
+ Enabled: false
149
+ Metrics/CyclomaticComplexity:
150
+ Description: A complexity metric that is strongly correlated to the number of test
151
+ cases needed to validate a method.
152
+ Enabled: false
153
+ Max: 6
154
+ Metrics/MethodLength:
155
+ Description: Avoid methods longer than 10 lines of code.
156
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#short-methods
157
+ Enabled: false
158
+ CountComments: false
159
+ Max: 10
160
+ Metrics/ParameterLists:
161
+ Description: Avoid parameter lists longer than three or four parameters.
162
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#too-many-params
163
+ Enabled: false
164
+ Max: 5
165
+ CountKeywordArgs: true
166
+ Metrics/PerceivedComplexity:
167
+ Description: A complexity metric geared towards measuring complexity for a human
168
+ reader.
169
+ Enabled: false
170
+ Max: 7
171
+ Lint/AssignmentInCondition:
172
+ Description: Don't use assignment in conditions.
173
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition
174
+ Enabled: false
175
+ AllowSafeAssignment: true
176
+ Style/InlineComment:
177
+ Description: Avoid inline comments.
178
+ Enabled: false
179
+ Style/AccessorMethodName:
180
+ Description: Check the naming of accessor methods for get_/set_.
181
+ Enabled: false
182
+ Style/Alias:
183
+ Description: Use alias_method instead of alias.
184
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#alias-method
185
+ Enabled: false
186
+ Style/Documentation:
187
+ Description: Document classes and non-namespace modules.
188
+ Enabled: false
189
+ Style/DoubleNegation:
190
+ Description: Checks for uses of double negation (!!).
191
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-bang-bang
192
+ Enabled: false
193
+ Style/EachWithObject:
194
+ Description: Prefer `each_with_object` over `inject` or `reduce`.
195
+ Enabled: false
196
+ Style/EmptyLiteral:
197
+ Description: Prefer literals to Array.new/Hash.new/String.new.
198
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#literal-array-hash
199
+ Enabled: false
200
+ Style/ModuleFunction:
201
+ Description: Checks for usage of `extend self` in modules.
202
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#module-function
203
+ Enabled: false
204
+ Style/OneLineConditional:
205
+ Description: Favor the ternary operator(?:) over if/then/else/end constructs.
206
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#ternary-operator
207
+ Enabled: false
208
+ Style/PerlBackrefs:
209
+ Description: Avoid Perl-style regex back references.
210
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers
211
+ Enabled: false
212
+ Style/Send:
213
+ Description: Prefer `Object#__send__` or `Object#public_send` to `send`, as `send`
214
+ may overlap with existing methods.
215
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#prefer-public-send
216
+ Enabled: false
217
+ Style/SpecialGlobalVars:
218
+ Description: Avoid Perl-style global variables.
219
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms
220
+ Enabled: false
221
+ Style/VariableInterpolation:
222
+ Description: Don't interpolate global, instance and class variables directly in
223
+ strings.
224
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#curlies-interpolate
225
+ Enabled: false
226
+ Style/WhenThen:
227
+ Description: Use when x then ... for one-line cases.
228
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#one-line-cases
229
+ Enabled: false
230
+ Lint/EachWithObjectArgument:
231
+ Description: Check for immutable argument given to each_with_object.
232
+ Enabled: true
233
+ Lint/HandleExceptions:
234
+ Description: Don't suppress exception.
235
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions
236
+ Enabled: false
237
+ Lint/LiteralInCondition:
238
+ Description: Checks of literals used in conditions.
239
+ Enabled: false
240
+ Lint/LiteralInInterpolation:
241
+ Description: Checks for literals used in interpolation.
242
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.1
5
+ before_install: gem install bundler -v 1.13.1
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in active_admin_menu.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Yoshiyuki Hirano
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,101 @@
1
+ # ActiveAdminMenu
2
+
3
+ Manage menu with YAML for [Active Admin](https://github.com/activeadmin/activeadmin)
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'active_admin_menu'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install active_admin_menu
20
+
21
+ ## Usage
22
+
23
+ Install and prepare Rails and ActiveAdmin before install `active_admin_menu` with `bundle`, and run it:
24
+
25
+ $ bundle exec rails generate active_admin_menu:install
26
+ create config/initializers/active_admin_menu.rb
27
+ create config/active_admin_menu.yml
28
+
29
+ And edit `config/active_admin_menu.yml`:
30
+
31
+ ```yaml
32
+ default: &default
33
+ root:
34
+ - Dashboard
35
+ Admin:
36
+ - AdminUser
37
+
38
+ development:
39
+ <<: *default
40
+
41
+ test:
42
+ <<: *default
43
+
44
+ production:
45
+ <<: *default
46
+ ```
47
+
48
+ And edit `config/locales/en.yml`:
49
+
50
+ ```yaml
51
+ en:
52
+ active_admin:
53
+ menu:
54
+ admin: Administrator
55
+ dashboard: Admin Dashboard
56
+ ```
57
+
58
+ ## Configuration
59
+
60
+ See `config/initializers/active_admin_menu.rb`:
61
+
62
+ ```ruby
63
+ ActiveAdminMenu.configure do |config|
64
+ config.source = Rails.root.join("config", "active_admin_menu.yml")
65
+ config.namespace = Rails.env
66
+ config.uncategorize_key_name = "root"
67
+ config.i18n_scope_prefix[:parent] = "active_admin.menu"
68
+ config.i18n_scope_prefix[:label] = "active_admin.menu"
69
+ end
70
+ ```
71
+
72
+ | attribute | type | content |
73
+ |:----------|:-----|:--------|
74
+ | source | `/path/to/yaml` or Hash | Source of menu |
75
+ | namespace | String | The key of source |
76
+ | uncategorize_key_name | String | Uncategorize key name (default: `root`) |
77
+ | i18n_scope_prefix[:parent] | String | Looking up i18n scope for parent |
78
+ | i18n_scope_prefix[:label] | String | Looking up i18n scope for register_page |
79
+
80
+ If the resource is not `register_page`, label will translate from `activerecord.models` on locale.
81
+
82
+ ## Tips
83
+
84
+ ### How to sort menu links on top level?
85
+
86
+ It' impossible to sort by `priority` option. So you need to add numeric prefix on i18n keys.
87
+
88
+ You need to change like this:
89
+
90
+ ```yaml
91
+ en:
92
+ active_admin:
93
+ menu:
94
+ user: "01 User"
95
+ admin: "02 Admin"
96
+ dashboard: "Dashboard"
97
+ ```
98
+
99
+ ## License
100
+
101
+ [MIT License](http://opensource.org/licenses/MIT)
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,30 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "active_admin_menu/version"
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "active_admin_menu"
8
+ gem.version = ActiveAdminMenu::VERSION
9
+ gem.authors = ["Yoshiyuki Hirano"]
10
+ gem.email = ["yhirano@me.com"]
11
+
12
+ gem.summary = "manage menu with YAML for Active Admin"
13
+ gem.description = gem.summary
14
+ gem.homepage = "https://github.com/yhirano55/active_admin_menu"
15
+ gem.license = "MIT"
16
+
17
+ gem.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ gem.bindir = "bin"
19
+ gem.executables = gem.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
+ gem.require_paths = ["lib"]
21
+
22
+ gem.required_ruby_version = ">= 2.1.0"
23
+ gem.add_runtime_dependency "activeadmin", "~> 1.0.0.pre4"
24
+
25
+ gem.add_development_dependency "bundler", "~> 1.13"
26
+ gem.add_development_dependency "rake", "~> 10.0"
27
+ gem.add_development_dependency "rspec", "~> 3.0"
28
+ gem.add_development_dependency "pry", "~> 0.10.0"
29
+ gem.add_development_dependency "rubocop", "~> 0.40.0"
30
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "active_admin_menu"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,17 @@
1
+ module ActiveAdminMenu
2
+ module Allocator
3
+ def register(*arg, &block)
4
+ super(*arg) do
5
+ allocate_to_menu
6
+ instance_eval(&block)
7
+ end
8
+ end
9
+
10
+ def register_page(*args, &block)
11
+ super(*args) do
12
+ allocate_to_menu(is_page: true)
13
+ instance_eval(&block)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,39 @@
1
+ require "yaml"
2
+
3
+ module ActiveAdminMenu
4
+ class << self
5
+ def configure
6
+ yield(config)
7
+ rescue NoMethodError => e
8
+ raise Config::InvalidAttribute, ":#{e.name.to_s.chop} is invalid attribute"
9
+ end
10
+
11
+ def config
12
+ @_config ||= Config.new
13
+ end
14
+ end
15
+
16
+ class Config
17
+ class InvalidAttribute < StandardError; end
18
+ class FileNotFound < StandardError; end
19
+
20
+ attr_reader :source
21
+ attr_accessor :namespace, :uncategorize_key_name, :i18n_scope_prefix
22
+
23
+ def initialize
24
+ @source = {}
25
+ @uncategorize_key_name = "root"
26
+ @i18n_scope_prefix = { parent: "active_admin.menu", label: "active_admin.menu" }
27
+ end
28
+
29
+ def source=(value)
30
+ @source = value.is_a?(Hash) ? value : YAML.load_file(value.to_s)
31
+ rescue => e
32
+ raise FileNotFound, e.message
33
+ end
34
+
35
+ def namespaced_source
36
+ source[namespace] || source
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,18 @@
1
+ module ActiveAdminMenu
2
+ module DSL
3
+ def allocate_to_menu(is_page: false)
4
+ if item = active_admin_menu.find_item_by(resource_name: config.resource_name.name)
5
+ item.is_page = is_page
6
+ menu(item.to_options)
7
+ else
8
+ menu(if: -> { false })
9
+ end
10
+ end
11
+
12
+ private
13
+
14
+ def active_admin_menu
15
+ @_active_admin_menu ||= ::ActiveAdminMenu::Menu.build
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,33 @@
1
+ module ActiveAdminMenu
2
+ class Item
3
+ attr_reader :resource_name, :parent, :priority
4
+ attr_accessor :is_page
5
+
6
+ def initialize(resource_name:, parent:, priority:)
7
+ @resource_name = resource_name
8
+ @parent = parent
9
+ @priority = priority
10
+ end
11
+
12
+ def to_options
13
+ { priority: priority }.tap do |options|
14
+ options.store(:parent, I18n.t(parent_i18n_scope, default: parent)) if parent
15
+ options.store(:label, I18n.t(label_i18n_scope, default: resource_name)) if is_page
16
+ end
17
+ end
18
+
19
+ private
20
+
21
+ def parent_i18n_scope
22
+ [config.i18n_scope_prefix[:parent], parent.downcase].join(".")
23
+ end
24
+
25
+ def label_i18n_scope
26
+ [config.i18n_scope_prefix[:label], resource_name.downcase].join(".")
27
+ end
28
+
29
+ def config
30
+ @_config ||= ::ActiveAdminMenu.config
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,44 @@
1
+ module ActiveAdminMenu
2
+ class Menu
3
+ attr_reader :items
4
+
5
+ def initialize
6
+ @items = []
7
+ end
8
+
9
+ def find_item_by(resource_name:)
10
+ items.detect { |item| item.resource_name == resource_name }
11
+ end
12
+
13
+ def add(resource_name:, parent: nil)
14
+ items << Item.new(resource_name: resource_name, parent: parent, priority: items.length + 1)
15
+ end
16
+
17
+ class << self
18
+ def build
19
+ new.tap do |menu|
20
+ namespaced_source.each do |key, resource_names|
21
+ parent = key == uncategorize_key_name ? nil : key
22
+ resource_names.each do |resource_name|
23
+ menu.add(resource_name: resource_name, parent: parent)
24
+ end
25
+ end
26
+ end
27
+ end
28
+
29
+ private
30
+
31
+ def namespaced_source
32
+ config.namespaced_source
33
+ end
34
+
35
+ def uncategorize_key_name
36
+ config.uncategorize_key_name
37
+ end
38
+
39
+ def config
40
+ @_config ||= ::ActiveAdminMenu.config
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,10 @@
1
+ require "rails"
2
+
3
+ module ActiveAdminMenu
4
+ class Railtie < ::Rails::Railtie
5
+ config.after_initialize do
6
+ ActiveAdmin::DSL.send :include, ActiveAdminMenu::DSL
7
+ ActiveAdmin::Application.send :prepend, ActiveAdminMenu::Allocator
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,3 @@
1
+ module ActiveAdminMenu
2
+ VERSION = "0.1.0".freeze
3
+ end
@@ -0,0 +1,7 @@
1
+ require "active_admin_menu/allocator"
2
+ require "active_admin_menu/config"
3
+ require "active_admin_menu/dsl"
4
+ require "active_admin_menu/item"
5
+ require "active_admin_menu/menu"
6
+ require "active_admin_menu/railtie"
7
+ require "active_admin_menu/version"
@@ -0,0 +1,5 @@
1
+ Description:
2
+ Generates the necessary files to get you up and running with ActiveAdminMenu gem
3
+
4
+ Examples:
5
+ rails generate active_admin_menu:install
@@ -0,0 +1,15 @@
1
+ module ActiveAdminMenu
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+ source_root File.expand_path("../templates", __FILE__)
5
+
6
+ def copy_initializer_file
7
+ template "initializer.rb", "config/initializers/active_admin_menu.rb"
8
+ end
9
+
10
+ def copy_config_file
11
+ template "active_admin_menu.yml", "config/active_admin_menu.yml"
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,14 @@
1
+ default: &default
2
+ root:
3
+ - Dashboard
4
+ Admin:
5
+ - AdminUser
6
+
7
+ development:
8
+ <<: *default
9
+
10
+ test:
11
+ <<: *default
12
+
13
+ production:
14
+ <<: *default
@@ -0,0 +1,7 @@
1
+ ActiveAdminMenu.configure do |config|
2
+ config.source = Rails.root.join("config", "active_admin_menu.yml")
3
+ config.namespace = Rails.env
4
+ config.uncategorize_key_name = "root"
5
+ config.i18n_scope_prefix[:parent] = "active_admin.menu"
6
+ config.i18n_scope_prefix[:label] = "active_admin.menu"
7
+ end
metadata ADDED
@@ -0,0 +1,154 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: active_admin_menu
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Yoshiyuki Hirano
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-11-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activeadmin
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.0.0.pre4
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.0.0.pre4
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.13'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.13'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.10.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.10.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.40.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.40.0
97
+ description: manage menu with YAML for Active Admin
98
+ email:
99
+ - yhirano@me.com
100
+ executables:
101
+ - console
102
+ - setup
103
+ extensions: []
104
+ extra_rdoc_files: []
105
+ files:
106
+ - ".gitignore"
107
+ - ".rspec"
108
+ - ".rubocop.yml"
109
+ - ".ruby-style.yml"
110
+ - ".travis.yml"
111
+ - Gemfile
112
+ - LICENSE.txt
113
+ - README.md
114
+ - Rakefile
115
+ - active_admin_menu.gemspec
116
+ - bin/console
117
+ - bin/setup
118
+ - lib/active_admin_menu.rb
119
+ - lib/active_admin_menu/allocator.rb
120
+ - lib/active_admin_menu/config.rb
121
+ - lib/active_admin_menu/dsl.rb
122
+ - lib/active_admin_menu/item.rb
123
+ - lib/active_admin_menu/menu.rb
124
+ - lib/active_admin_menu/railtie.rb
125
+ - lib/active_admin_menu/version.rb
126
+ - lib/generators/active_admin_menu/USAGE
127
+ - lib/generators/active_admin_menu/install_generator.rb
128
+ - lib/generators/active_admin_menu/templates/active_admin_menu.yml
129
+ - lib/generators/active_admin_menu/templates/initializer.rb
130
+ homepage: https://github.com/yhirano55/active_admin_menu
131
+ licenses:
132
+ - MIT
133
+ metadata: {}
134
+ post_install_message:
135
+ rdoc_options: []
136
+ require_paths:
137
+ - lib
138
+ required_ruby_version: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ version: 2.1.0
143
+ required_rubygems_version: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ requirements: []
149
+ rubyforge_project:
150
+ rubygems_version: 2.5.1
151
+ signing_key:
152
+ specification_version: 4
153
+ summary: manage menu with YAML for Active Admin
154
+ test_files: []