active_admin-subnav 0.0.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 956c5b117fae4020911254d663079fdf4c1c2162
|
4
|
+
data.tar.gz: edb905db6ef3a072af7ea9c96ab1a567042f7708
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9945683265bcf887314715a9412300c5bd960af8b580d541e53de1021b2e115bc57328e898627e7aab68ccac2553a28e75ff0f8c59032a0e2a646b3a5c9c0917
|
7
|
+
data.tar.gz: daec0b8998707d5f59a634bac08f9a99b9816f982e3156e5ef551c968233ad0249409459fccfcc0e29574893a39e516ce6c27df29b7018607fd84b04f25262ac
|
data/Changelog.md
ADDED
data/README.md
CHANGED
@@ -1,18 +1,71 @@
|
|
1
|
-
#
|
1
|
+
# ActiveAdmin::Subnav
|
2
2
|
|
3
|
-
|
3
|
+
[](http://badge.fury.io/rb/active_admin-subnav)
|
4
4
|
|
5
|
-
|
6
|
-
navigation menu for all resources related to that parent resource. This gem
|
7
|
-
provides a sub navigation menu for those resources.
|
5
|
+
## Description
|
8
6
|
|
9
|
-
|
7
|
+
Enhanced sub-navigation for nested ActiveAdmin resources.
|
8
|
+
|
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.
|
13
|
+
|
14
|
+
**Note**: Optional belongs_to configurations are not supported!
|
15
|
+
|
16
|
+
## Usage
|
17
|
+
|
18
|
+
Resource `belongs_to` configuration does not require any extra configuration
|
19
|
+
beyond the default. Below the Post resource belongs to Site.
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
# admin/site.rb
|
23
|
+
ActiveAdmin.register Site
|
24
|
+
|
25
|
+
# admin/post.rb
|
26
|
+
ActiveAdmin.register Post do
|
27
|
+
belongs_to :site
|
28
|
+
end
|
29
|
+
```
|
30
|
+
|
31
|
+
Registering `belongs_to` pages requires more setup to properly access the
|
32
|
+
parent record. This is a side effect of how [Arbre][] references parent
|
33
|
+
HTML nodes. Below a new method, `#site`, is created to provide access to the
|
34
|
+
parent record.
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
# admin/site_statistics.rb
|
38
|
+
ActiveAdmin.register_page "Statistics" do
|
39
|
+
belongs_to :site
|
40
|
+
|
41
|
+
content do
|
42
|
+
statistics = site.statistics
|
43
|
+
# ...
|
44
|
+
end
|
45
|
+
|
46
|
+
controller do
|
47
|
+
|
48
|
+
# Provide access to the parent resource record: Site.
|
49
|
+
#
|
50
|
+
# Without this extra setup the parent record will not be accessible. Any
|
51
|
+
# calls to `#parent` will return the Arbre parent element and not the
|
52
|
+
# ActiveAdmin resource.
|
53
|
+
alias_method :site, :parent
|
54
|
+
|
55
|
+
# Expose the method as a helper making it available to the view
|
56
|
+
helper_method :site
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
60
|
+
```
|
10
61
|
|
11
62
|
## Installation
|
12
63
|
|
13
64
|
Add this line to your application's Gemfile:
|
14
65
|
|
15
|
-
|
66
|
+
```ruby
|
67
|
+
gem 'active_admin-subnav'
|
68
|
+
```
|
16
69
|
|
17
70
|
And then execute:
|
18
71
|
|
@@ -20,18 +73,28 @@ And then execute:
|
|
20
73
|
|
21
74
|
Add the subnav's styles to your `active_admin.css.scss` stylesheet:
|
22
75
|
|
23
|
-
|
76
|
+
```scss
|
77
|
+
//= require active_admin/subnav
|
24
78
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
79
|
+
// Align subnav with main navigation by padding the width of the site's
|
80
|
+
// title.
|
81
|
+
#header div.subnav {
|
82
|
+
padding-left: 8.333em;
|
83
|
+
}
|
84
|
+
```
|
30
85
|
|
31
86
|
## Contributing
|
32
87
|
|
33
|
-
1. Fork it ( https://github.com/zorab47/
|
88
|
+
1. Fork it ( https://github.com/zorab47/active_admin-subnav/fork )
|
34
89
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
35
90
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
36
91
|
4. Push to the branch (`git push origin my-new-feature`)
|
37
92
|
5. Create a new Pull Request
|
93
|
+
|
94
|
+
## Versioning
|
95
|
+
|
96
|
+
Follows [Semantic Versioning 2.0.0][Semver]
|
97
|
+
|
98
|
+
[ActiveAdmin]: https://github.com/gregbell/active_admin
|
99
|
+
[Semver]: http://semver.org/spec/v2.0.0.html
|
100
|
+
[Arbre]: https://github.com/activeadmin/arbre
|
data/active_admin-subnav.gemspec
CHANGED
@@ -14,7 +14,7 @@ Currently, ActiveAdmin 1.0pre resets the top navigation menu to display the sub
|
|
14
14
|
navigation menu for all resources related to that parent resource. This gem
|
15
15
|
provides a sub navigation menu for those resources.
|
16
16
|
DESC
|
17
|
-
spec.homepage = ""
|
17
|
+
spec.homepage = "https://github.com/zorab47/active_admin-subnav"
|
18
18
|
spec.license = "MIT"
|
19
19
|
|
20
20
|
spec.files = `git ls-files -z`.split("\x0")
|
File without changes
|
File without changes
|
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: 0.0
|
4
|
+
version: 1.0.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:
|
11
|
+
date: 2016-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeadmin
|
@@ -105,12 +105,13 @@ extensions: []
|
|
105
105
|
extra_rdoc_files: []
|
106
106
|
files:
|
107
107
|
- ".gitignore"
|
108
|
+
- Changelog.md
|
108
109
|
- Gemfile
|
109
110
|
- LICENSE.txt
|
110
111
|
- README.md
|
111
112
|
- Rakefile
|
112
113
|
- active_admin-subnav.gemspec
|
113
|
-
- app/assets/stylesheets/active_admin/subnav.
|
114
|
+
- app/assets/stylesheets/active_admin/subnav.scss
|
114
115
|
- lib/active_admin/subnav.rb
|
115
116
|
- lib/active_admin/subnav/extensions/base_controller.rb
|
116
117
|
- lib/active_admin/subnav/extensions/namespace.rb
|
@@ -120,8 +121,8 @@ files:
|
|
120
121
|
- lib/active_admin/subnav/extensions/tabbed_navigation.rb
|
121
122
|
- lib/active_admin/subnav/version.rb
|
122
123
|
- lib/active_admin/subnav/views/header_with_subnav.rb
|
123
|
-
-
|
124
|
-
homepage:
|
124
|
+
- spec/subnav_spec.rb
|
125
|
+
homepage: https://github.com/zorab47/active_admin-subnav
|
125
126
|
licenses:
|
126
127
|
- MIT
|
127
128
|
metadata: {}
|
@@ -141,9 +142,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
142
|
version: '0'
|
142
143
|
requirements: []
|
143
144
|
rubyforge_project:
|
144
|
-
rubygems_version: 2.
|
145
|
+
rubygems_version: 2.5.1
|
145
146
|
signing_key:
|
146
147
|
specification_version: 4
|
147
148
|
summary: Provide sub-navigation menu for resources belonging to a parent resource.
|
148
|
-
test_files:
|
149
|
-
|
149
|
+
test_files:
|
150
|
+
- spec/subnav_spec.rb
|