simple-navigation-acl 0.1.2 → 0.1.3

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: 44533625930b4bbeb0113b6f09eb759655caa231
4
- data.tar.gz: 44bdfbe67ee60d6e0fff103aa6177afe48bce08f
3
+ metadata.gz: fdb8332bcf728cb3dc6929fd66efc3c14c9ae075
4
+ data.tar.gz: f2f2f3bf37a53df4b321bf7c6c4e02148f7e390b
5
5
  SHA512:
6
- metadata.gz: cbf70c8d790c3374a1b3be466ad9e9ebe9cd380bcc29e09a0fea3affb21049bd47a82bf15571d9ed8c8359cb1b4c2a2a7b4162dc6912322e7c02483012acd372
7
- data.tar.gz: ab4541c501eeeeb31f792b4b12258b2dd5f22a83ba15b8f207a1b69d7c5a58b0fa68f84335dad55644063bb88f7460bc5f392c72597f052eebb49fcd5afacc69
6
+ metadata.gz: 676dccb0ab8b820259e1f4cc73bfb35573edc5fefcbad4f22ed2a2265bc76d84d3b582829e9985102c9288916ac76a47d7166212704608adb4944ca7e7c3335b
7
+ data.tar.gz: ec854928da332e87c2c61a65c3eb8a7a4cb975e2167250e19279d9ff2e2a4a41410bc5dbcac3b6a3cf2e5b1117659a34a05f88b0cfd9d39d92207db91fddfcc4
data/README.md CHANGED
@@ -28,7 +28,12 @@ Add it to your **app/assets/javascripts/application.js**
28
28
 
29
29
  Modify simple-navigation helper `render_navigation` in your views to simple-navigation-acl helper `render_navigation_acl` and add param `acl_id`, like:
30
30
  ```haml
31
- = render_navigation_acl acl_id: current_user.role, level:(1..3), :renderer => :bootstrap3, :expand_all => true
31
+ = render_navigation_acl acl_id: current_user.role
32
+ ```
33
+
34
+ If you need to see all navigations like a Super Admin, pass `:all` to **acl_id**:
35
+ ```haml
36
+ = render_navigation_acl acl_id: :all
32
37
  ```
33
38
 
34
39
 
@@ -35,9 +35,10 @@ module SimpleNavigationAcl
35
35
 
36
36
  def apply_acl(navigation, id, context)
37
37
  context=:default if context.nil?
38
- rules_keys = SimpleNavigationAcl::AclRule.where(id: id, context: context).pluck(:key)
38
+ rules_keys = SimpleNavigationAcl::AclRule.where(context: context)
39
+ rules_keys = rules_keys.where(id: id) unless id==:all
39
40
  container = navigation.is_a?(SimpleNavigation::Configuration) ? navigation.instance_variable_get(:@primary_navigation) : navigation
40
- filter_simple_navigation_with_rules!(container, rules_keys)
41
+ filter_simple_navigation_with_rules!(container, rules_keys.pluck(:key))
41
42
  true
42
43
  end
43
44
 
@@ -1,3 +1,3 @@
1
1
  module SimpleNavigationAcl
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-navigation-acl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno Porto