access_manager 0.0.6 → 0.1.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: 27681d637de0b8195a21099f3d17169106a61c2c
4
- data.tar.gz: 8498a6330271d30be5b34ed07d8ee906747e0f5c
3
+ metadata.gz: a44076b88453152b0ff5d98bac2f98d92ac3f3ab
4
+ data.tar.gz: aeb2a1d0a310e816c540adc119a8f55dadb9075f
5
5
  SHA512:
6
- metadata.gz: 988f12727b9276cee92f88708f754f0776dabab2ae508a050bf44e672a976623edf6022cd66d50dccccd281e412c4121c9050511a91469e64cd6c8fb1aa8c562
7
- data.tar.gz: 952db84790759b65452d8102ce72cfd35ffec9bf573fd882844790e97908f1cc4ea43ca07dd1716abb67d0eb24192b2f0f79a1bcc9853244d83888e6b77ae32a
6
+ metadata.gz: 8e973227a715128a2b1c148df9184373333c2577d4115bf3e051e9d69c4fc97b28af5848487376db66292ef55bd3c0870f0ecf5197923bc80f2b32bb6331c769
7
+ data.tar.gz: afce5aa7895d25d029f39d848ced9622b9848e09381112c7548a956ff47f5be7e88099e8218bbfd37570049abad72d6e4ce9ef44fe14cc35dd4edde561208d66
data/CHANGELOG.md CHANGED
@@ -21,3 +21,7 @@
21
21
  ## v0.0.6
22
22
 
23
23
  * Actions are deduced now by action_codes method
24
+
25
+ ## v0.1.0
26
+
27
+ * Added assets and view helpers
@@ -0,0 +1,4 @@
1
+ module AccessManager
2
+ class Engine < ::Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,7 @@
1
+ module AccessManager
2
+ class Railtie < Rails::Railtie
3
+ initializer "access_manager.view_helpers" do |app|
4
+ ActionView::Base.send :include, ViewHelpers
5
+ end
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module AccessManager
2
- VERSION = "0.0.6"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -0,0 +1,7 @@
1
+ module AccessManager
2
+ module ViewHelpers
3
+ def initialize_user_actions!(user)
4
+ hidden_field_tag 'current_user_actions', user.action_codes.to_json
5
+ end
6
+ end
7
+ end
@@ -1,2 +1,13 @@
1
1
  require 'access_manager/control'
2
2
  require 'access_manager/rules'
3
+ require 'access_manager/version'
4
+
5
+ if defined? (Rails)
6
+ require 'access_manager/view_helpers'
7
+ require 'access_manager/railtie'
8
+
9
+ if Gem::Requirement.new('>= 3.1').satisfied_by?(Gem::Version.new(Rails.version))
10
+ require 'access_manager/engine'
11
+ end
12
+ end
13
+
@@ -0,0 +1,27 @@
1
+ // Access Manager 0.1.0
2
+ // (c) 2014
3
+ // Access Manager may be freely distributed under the MIT license.
4
+
5
+ $(function () {
6
+ var userActions = jQuery.parseJSON($('#current_user_actions').val());
7
+
8
+ _.each($('[data-required-action]'), function (val) {
9
+ var requiredActions = $(val).data('required-action').split(',');
10
+
11
+ if (_.intersection(userActions, requiredActions).length == 0) {
12
+ $(val).remove();
13
+ }
14
+ });
15
+
16
+ _.each($('[data-menu=submenu]'), function (val) {
17
+ if ($(val).find('[data-required-action]').length == 0) {
18
+ $(val).remove();
19
+ }
20
+ });
21
+
22
+ _.each($('[data-menu=menu]'), function (val) {
23
+ if ($(val).find('[data-required-action]').length == 0) {
24
+ $(val).remove();
25
+ }
26
+ });
27
+ });
@@ -0,0 +1,6 @@
1
+ .dropdown-submenu{position:relative;}
2
+ .dropdown-submenu>.dropdown-menu{top:0;left:100%;margin-top:-6px;margin-left:-1px;-webkit-border-radius:0 6px 6px 6px;-moz-border-radius:0 6px 6px 6px;border-radius:0 6px 6px 6px;}
3
+ .dropdown-submenu:hover>.dropdown-menu{display:block;}
4
+ .dropdown-submenu>a:after{display:block;content:" ";float:right;width:0;height:0;border-color:transparent;border-style:solid;border-width:5px 0 5px 5px;border-left-color:#cccccc;margin-top:5px;margin-right:-10px;}
5
+ .dropdown-submenu:hover>a:after{border-left-color:#ffffff;}
6
+ .dropdown-submenu.pull-left{float:none;}.dropdown-submenu.pull-left>.dropdown-menu{left:-100%;margin-left:10px;-webkit-border-radius:6px 0 6px 6px;-moz-border-radius:6px 0 6px 6px;border-radius:6px 0 6px 6px;}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: access_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matias Hick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-13 00:00:00.000000000 Z
11
+ date: 2014-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -50,8 +50,13 @@ files:
50
50
  - README.md
51
51
  - lib/access_manager.rb
52
52
  - lib/access_manager/control.rb
53
+ - lib/access_manager/engine.rb
54
+ - lib/access_manager/railtie.rb
53
55
  - lib/access_manager/rules.rb
54
56
  - lib/access_manager/version.rb
57
+ - lib/access_manager/view_helpers.rb
58
+ - vendor/assets/javascripts/access_manager.js
59
+ - vendor/assets/stylesheets/access_manager.css
55
60
  homepage: https://github.com/unformattmh/access_manager
56
61
  licenses:
57
62
  - MIT