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 +4 -4
- data/lib/snaptable/engine.rb +5 -0
- data/lib/snaptable/helpers/buttons_helper.rb +31 -0
- data/lib/snaptable/version.rb +1 -1
- metadata +2 -2
- data/app/helpers/buttons_helper.rb +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e02605b9ce59a91f21fd98ec10e68b80eea5b97
|
4
|
+
data.tar.gz: f8b511dc7414dcdb216d5cbc195c84139442dfc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70a2465e53f664f0d9089466ca19520c92ced23c5ce41f1f9d009a99516c6f8241badcedebebebdbff02c0e977d3da55ac060f8a465ca3a25d6ae6d12378bd5f
|
7
|
+
data.tar.gz: 879af11aefce817857795da183486577bd71084819d883c99b60d0b9791f7edf4d8d916cc07719318d7d98892baef562b209f9f39afe1eed52d3cb18bcfcdd33
|
data/lib/snaptable/engine.rb
CHANGED
@@ -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
|
data/lib/snaptable/version.rb
CHANGED
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.
|
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
|