snaptable 0.9.0 → 0.9.1

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: 11ed98f7d34d0a9958c2b3e8ecebb97f6d96ae41
4
- data.tar.gz: fadc6c8bb2d6968709836de1849a1fce7a6a68a9
3
+ metadata.gz: 5e02605b9ce59a91f21fd98ec10e68b80eea5b97
4
+ data.tar.gz: f8b511dc7414dcdb216d5cbc195c84139442dfc1
5
5
  SHA512:
6
- metadata.gz: 8c7cd73a2c802bb2942e98ef8ac162267d47957c65c0b35acafdffe5b8aa4473f6dd4a53c3f03ebdfaa1327d39b58a448428498296151260ff55a847ef916725
7
- data.tar.gz: 6d1927814485082fe9d1d45a2aff6aecb7fe9ed148a9df07efa87406e4812f2182f26e79fff3fee382d8e11cbd37ced29090be503e3d9bb3a88064ad72f16d29
6
+ metadata.gz: 70a2465e53f664f0d9089466ca19520c92ced23c5ce41f1f9d009a99516c6f8241badcedebebebdbff02c0e977d3da55ac060f8a465ca3a25d6ae6d12378bd5f
7
+ data.tar.gz: 879af11aefce817857795da183486577bd71084819d883c99b60d0b9791f7edf4d8d916cc07719318d7d98892baef562b209f9f39afe1eed52d3cb18bcfcdd33
@@ -1,4 +1,5 @@
1
1
  require 'snaptable/helpers/table'
2
+ require 'snaptable/helpers/buttons_helper'
2
3
 
3
4
  module Snaptable
4
5
  class Engine < ::Rails::Engine
@@ -8,5 +9,9 @@ module Snaptable
8
9
  initializer 'Snaptable.tables' do
9
10
  ActionController::Base.send :include, Helpers
10
11
  end
12
+
13
+ initializer 'Snaptable.buttons_helper' do
14
+ ActionView::Base.send :include, Helpers::ButtonsHelper
15
+ end
11
16
  end
12
17
  end
@@ -0,0 +1,31 @@
1
+ module Snaptable
2
+ module Helpers
3
+ module ButtonsHelper
4
+
5
+ def add_button?
6
+ Snaptable.add_button &&
7
+ (!Snaptable.use_permission ||
8
+ current_permission.allow_create?(params[:controller]))
9
+ end
10
+
11
+ def edit_button?
12
+ Snaptable.edit_button &&
13
+ (!Snaptable.use_permission ||
14
+ current_permission.allow_modify?(params[:controller], "update"))
15
+ end
16
+
17
+ def show_button?
18
+ Snaptable.show_button &&
19
+ (!Snaptable.use_permission ||
20
+ current_permission.allow_modify?(params[:controller], "read"))
21
+ end
22
+
23
+ def delete_button?
24
+ Snaptable.delete_button &&
25
+ (!Snaptable.use_permission ||
26
+ current_permission.allow_modify?(params[:controller], "destroy"))
27
+ end
28
+
29
+ end
30
+ end
31
+ end
@@ -1,3 +1,3 @@
1
1
  module Snaptable
2
- VERSION = "0.9.0"
2
+ VERSION = "0.9.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snaptable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - khcr
@@ -94,7 +94,6 @@ files:
94
94
  - app/assets/javascripts/snaptable/table.js
95
95
  - app/assets/stylesheets/snaptable.css
96
96
  - app/assets/stylesheets/snaptable/table.css.scss
97
- - app/helpers/buttons_helper.rb
98
97
  - app/views/snaptable/_buttons.html.erb
99
98
  - app/views/snaptable/_search_field.html.erb
100
99
  - app/views/snaptable/base.html.erb
@@ -107,6 +106,7 @@ files:
107
106
  - lib/snaptable/constructor/renderer.rb
108
107
  - lib/snaptable/constructor/sortable.rb
109
108
  - lib/snaptable/engine.rb
109
+ - lib/snaptable/helpers/buttons_helper.rb
110
110
  - lib/snaptable/helpers/table.rb
111
111
  - lib/snaptable/version.rb
112
112
  - test/dummy/Rakefile
@@ -1,27 +0,0 @@
1
- module ButtonsHelper
2
-
3
- def add_button?
4
- Snaptable.add_button &&
5
- (!Snaptable.use_permission ||
6
- current_permission.allow_create?(params[:controller]))
7
- end
8
-
9
- def edit_button?
10
- Snaptable.edit_button &&
11
- (!Snaptable.use_permission ||
12
- current_permission.allow_modify?(params[:controller], "update"))
13
- end
14
-
15
- def show_button?
16
- Snaptable.show_button &&
17
- (!Snaptable.use_permission ||
18
- current_permission.allow_modify?(params[:controller], "read"))
19
- end
20
-
21
- def delete_button?
22
- Snaptable.delete_button &&
23
- (!Snaptable.use_permission ||
24
- current_permission.allow_modify?(params[:controller], "destroy"))
25
- end
26
-
27
- end