active_admin-subnav 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 956c5b117fae4020911254d663079fdf4c1c2162
4
- data.tar.gz: edb905db6ef3a072af7ea9c96ab1a567042f7708
3
+ metadata.gz: 3dfe4b81008a6996309d174ac3383f0e1bade7ca
4
+ data.tar.gz: 9dab7380fc0e53e1792cf9325beb09025332a04c
5
5
  SHA512:
6
- metadata.gz: 9945683265bcf887314715a9412300c5bd960af8b580d541e53de1021b2e115bc57328e898627e7aab68ccac2553a28e75ff0f8c59032a0e2a646b3a5c9c0917
7
- data.tar.gz: daec0b8998707d5f59a634bac08f9a99b9816f982e3156e5ef551c968233ad0249409459fccfcc0e29574893a39e516ce6c27df29b7018607fd84b04f25262ac
6
+ metadata.gz: 76421ef162ecda5c6a54c27cd2fcbca6f593f5553eb78837a133989496881a6a826b4acc0c4fab663bef2b8214450fb40d207bc6d66c6ff704a82d090213320a
7
+ data.tar.gz: 7c0f7e74460a2936564d22584515b8cf52f70af7787bfe481159b65e3a72803556e6af9a92582f8761ab3e466dc686aada19d74dc72178ee9e770e3b9db7fa4f
@@ -1,6 +1,24 @@
1
1
  # Change Log
2
2
 
3
- ## 1.0.0
3
+ ## [1.1.0] - 2017-05-24
4
+
5
+ ### Added
6
+
7
+ - Support for ActiveAdmin v1.0.0
8
+ - Example image as a preview
9
+
10
+ ### Fixed
11
+
12
+ - Overrides `ActiveAdmin::Page#belongs_to` to properly nest menus within the
13
+ sub navigation
14
+
15
+ ## [1.0.0] - 2016-09-08
16
+
17
+ ### Changed
4
18
 
5
19
  - Rename subnav.css.scss to subnav.scss to avoid Sprockets deprecation warning
6
20
  - No incompatible changes from v0.0.1
21
+
22
+
23
+ [1.0.1]: https://github.com/zorab47/active_admin-subnav/compare/v1.1.0...v1.0.0
24
+ [1.0.0]: https://github.com/zorab47/active_admin-subnav/compare/v0.0.1...v1.0.0
data/README.md CHANGED
@@ -2,14 +2,16 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/active_admin-subnav.svg)](http://badge.fury.io/rb/active_admin-subnav)
4
4
 
5
- ## Description
6
-
7
5
  Enhanced sub-navigation for nested ActiveAdmin resources.
8
6
 
9
- Currently, the base [ActiveAdmin][] install resets the top navigation menu to
10
- display the nested navigation menu, but it can be confusing to lose the main
11
- navigation context. This project keeps the main navigation visible and displays
12
- a secondary navigation bar for nested resources.
7
+ Currently, the base [ActiveAdmin][] resets the top navigation menu to display the
8
+ nested navigation menu, but it can be confusing to lose the main navigation
9
+ context. This project keeps the main navigation visible and displays a secondary
10
+ navigation bar for nested resources.
11
+
12
+ ![ActiveAdmin::Subnav Example](docs/example.png)
13
+
14
+ Supports both ActiveAdmin v1.0.0+ and older v0.6.4+ versions.
13
15
 
14
16
  **Note**: Optional belongs_to configurations are not supported!
15
17
 
@@ -18,13 +18,10 @@ module ActiveAdmin
18
18
  end
19
19
  end
20
20
 
21
-
22
21
  # Register a TabbedNavigation view for the sub navigation.
23
22
  ActiveAdmin::ViewFactory.register sub_navigation: ActiveAdmin::Views::TabbedNavigation,
24
23
  header: ActiveAdmin::Views::HeaderWithSubnav
25
24
 
26
- ActiveAdmin::Page.send :include, ActiveAdmin::Subnav::Page
27
-
28
25
  ActiveAdmin.after_load do
29
26
  ActiveAdmin::BaseController.send :include, ActiveAdmin::Subnav::MenuExtensions
30
27
  end
@@ -1,11 +1,13 @@
1
1
  module ActiveAdmin
2
- module Subnav
3
- module Page
4
- extend ActiveSupport::Concern
2
+ class Page
3
+ def belongs_to(target, options = {})
4
+ @belongs_to = Resource::BelongsTo.new(self, target, options)
5
+ self.sub_navigation_menu_name = target
6
+ controller.send :belongs_to, target, options.dup
7
+ end
5
8
 
6
- def show_sub_menu?(*)
7
- false
8
- end
9
+ def show_sub_menu?(*)
10
+ false
9
11
  end
10
12
  end
11
13
  end
@@ -1,7 +1,5 @@
1
1
  module ActiveAdmin
2
2
  class Resource
3
-
4
- # TODO: Support for optional belongs_to
5
3
  def belongs_to(target, options = {})
6
4
  @belongs_to = Resource::BelongsTo.new(self, target, options)
7
5
  self.sub_navigation_menu_name = target
@@ -1,5 +1,5 @@
1
1
  module Activeadmin
2
2
  module Subnav
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_admin-subnav
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charles Maresh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-09 00:00:00.000000000 Z
11
+ date: 2017-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeadmin
@@ -95,22 +95,18 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  description: |
98
- Currently, ActiveAdmin 1.0pre resets the top navigation menu to display the sub
99
- navigation menu for all resources related to that parent resource. This gem
100
- provides a sub navigation menu for those resources.
98
+ Currently, ActiveAdmin resets the top navigation menu to display the sub
99
+ navigation menu for all resources related to the parent resource. This gem
100
+ adds a sub-navigation menu for those resources.
101
101
  email:
102
102
  - charles.maresh@orm-tech.com
103
103
  executables: []
104
104
  extensions: []
105
105
  extra_rdoc_files: []
106
106
  files:
107
- - ".gitignore"
108
107
  - Changelog.md
109
- - Gemfile
110
108
  - LICENSE.txt
111
109
  - README.md
112
- - Rakefile
113
- - active_admin-subnav.gemspec
114
110
  - app/assets/stylesheets/active_admin/subnav.scss
115
111
  - lib/active_admin/subnav.rb
116
112
  - lib/active_admin/subnav/extensions/base_controller.rb
@@ -121,7 +117,6 @@ files:
121
117
  - lib/active_admin/subnav/extensions/tabbed_navigation.rb
122
118
  - lib/active_admin/subnav/version.rb
123
119
  - lib/active_admin/subnav/views/header_with_subnav.rb
124
- - spec/subnav_spec.rb
125
120
  homepage: https://github.com/zorab47/active_admin-subnav
126
121
  licenses:
127
122
  - MIT
@@ -142,9 +137,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
137
  version: '0'
143
138
  requirements: []
144
139
  rubyforge_project:
145
- rubygems_version: 2.5.1
140
+ rubygems_version: 2.5.2
146
141
  signing_key:
147
142
  specification_version: 4
148
143
  summary: Provide sub-navigation menu for resources belonging to a parent resource.
149
- test_files:
150
- - spec/subnav_spec.rb
144
+ test_files: []
data/.gitignore DELETED
@@ -1,22 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
18
- *.bundle
19
- *.so
20
- *.o
21
- *.a
22
- mkmf.log
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in activeadmin-subnav.gemspec
4
- gemspec
data/Rakefile DELETED
@@ -1,2 +0,0 @@
1
- require "bundler/gem_tasks"
2
-
@@ -1,32 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'active_admin/subnav/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "active_admin-subnav"
8
- spec.version = Activeadmin::Subnav::VERSION
9
- spec.authors = ["Charles Maresh"]
10
- spec.email = ["charles.maresh@orm-tech.com"]
11
- spec.summary = %q{Provide sub-navigation menu for resources belonging to a parent resource.}
12
- spec.description = <<DESC
13
- Currently, ActiveAdmin 1.0pre resets the top navigation menu to display the sub
14
- navigation menu for all resources related to that parent resource. This gem
15
- provides a sub navigation menu for those resources.
16
- DESC
17
- spec.homepage = "https://github.com/zorab47/active_admin-subnav"
18
- spec.license = "MIT"
19
-
20
- spec.files = `git ls-files -z`.split("\x0")
21
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
22
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
23
- spec.require_paths = ["lib"]
24
-
25
- spec.add_dependency "activeadmin"
26
-
27
- spec.add_development_dependency "bundler", "~> 1.6"
28
- spec.add_development_dependency "rake"
29
- spec.add_development_dependency "minitest"
30
- spec.add_development_dependency "minitest-spec-expect"
31
- spec.add_development_dependency "sass-rails"
32
- end
@@ -1,67 +0,0 @@
1
- require 'bundler/setup'
2
- require 'minitest/autorun'
3
- require 'minitest/spec/expect'
4
-
5
- require 'active_admin/subnav'
6
- require 'sass-rails'
7
-
8
- class Minitest::SharedExamples < Module
9
- include Minitest::Spec::DSL
10
- end
11
-
12
- ResourceMenuSpec = Minitest::SharedExamples.new do
13
- it "to have sub navigation menu name accessor" do
14
- expect(resource).to_respond_to :sub_navigation_menu_name
15
- expect(resource).to_respond_to :sub_navigation_menu_name=
16
- end
17
-
18
- it "is a sub menu item when sub_navigation_menu_name is set" do
19
- expect(resource.sub_menu_item?).to_equal false
20
- resource.sub_navigation_menu_name = "Dashboard"
21
- expect(resource.sub_menu_item?).to_equal true
22
- end
23
- end
24
-
25
- describe "activeadmin-subnav" do
26
- it "registers a sub navigation view" do
27
- expect(ActiveAdmin::ViewFactory.new.default_for(:sub_navigation)).to_equal ActiveAdmin::Views::TabbedNavigation
28
- end
29
-
30
- it "registers a header with subn navigation" do
31
- expect(ActiveAdmin::ViewFactory.new.default_for(:header)).to_equal ActiveAdmin::Views::HeaderWithSubnav
32
- end
33
-
34
- def namespace
35
- app = ActiveAdmin::Application.new
36
- app.namespace(:admin)
37
- end
38
-
39
- describe "extends ActiveAdmin::Namespace" do
40
- it "adds sub menus" do
41
- expect(namespace).to_respond_to :sub_menus
42
- end
43
- end
44
-
45
- describe "extends Page" do
46
- let(:page) { ActiveAdmin::Page.new(namespace, "Dashboard", {}) }
47
- alias_method :resource, :page
48
-
49
- include ResourceMenuSpec
50
-
51
- it "to never show sub menus" do
52
- expect(page.show_sub_menu?).to_equal false
53
- end
54
- end
55
-
56
- describe "extends Resource" do
57
- class Post; end
58
- let(:resource) { ActiveAdmin::Resource.new(namespace, Post) }
59
-
60
- include ResourceMenuSpec
61
-
62
- it "to assign nested resources" do
63
- resource.nested_resources = "nested"
64
- expect(resource.has_nested_resources?).to_equal "nested"
65
- end
66
- end
67
- end