tabulatr2 0.9.29 → 0.9.30
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 +4 -4
- data/README.md +18 -0
- data/lib/tabulatr/renderer/association.rb +8 -1
- data/lib/tabulatr/renderer/column.rb +12 -1
- data/lib/tabulatr/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: af8e5204add46d949b53ab203ff3eb544217d60f
|
|
4
|
+
data.tar.gz: 79455bf0881803cf94f77fb50f553c5ac0a4ea60
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5db3fe6c8d03c691e552128fc04300fc95aec3438e3718d298d1794e49661d4bb6dfb5463d8d4d874555ea99951e9b235175af513e841fe991f3b806faf054c8
|
|
7
|
+
data.tar.gz: 60d58e2003677d4f4949432c3a2b5c4283ca4ce306fac7fcfd4a2a61490e3c74364558f07e8c62ea84c031a632fab9604f4192e3b165342b4eece68cefa152b1
|
data/README.md
CHANGED
|
@@ -168,6 +168,24 @@ class UserTabulatrData < Tabulatr::Data
|
|
|
168
168
|
end
|
|
169
169
|
```
|
|
170
170
|
|
|
171
|
+
### Accessing controller
|
|
172
|
+
|
|
173
|
+
You may want to show actions and/or buttons depending on a condition,
|
|
174
|
+
e.g., user's role. You can access controller helpers with
|
|
175
|
+
`@controller`. Here is how to check, if you are
|
|
176
|
+
using [Pundit](https://github.com/elabs/pundit) (or any other
|
|
177
|
+
authorization gem):
|
|
178
|
+
|
|
179
|
+
```ruby
|
|
180
|
+
class UserTabulatrData < Tabulatr::Data
|
|
181
|
+
buttons do |b,r|
|
|
182
|
+
if @controller.policy(r).show?
|
|
183
|
+
b.button :eye, product_path(r), class: 'btn-success'
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
```
|
|
188
|
+
|
|
171
189
|
### Search
|
|
172
190
|
|
|
173
191
|
The DSL provides you with a `search` method to define a custom fuzzy search method which is not bound
|
|
@@ -23,7 +23,14 @@
|
|
|
23
23
|
|
|
24
24
|
class Tabulatr::Renderer::Association < Tabulatr::Renderer::Column
|
|
25
25
|
def human_name
|
|
26
|
-
col_options.header
|
|
26
|
+
h = col_options.header
|
|
27
|
+
if h && h.respond_to?(:call)
|
|
28
|
+
h.()
|
|
29
|
+
elsif h
|
|
30
|
+
h
|
|
31
|
+
else
|
|
32
|
+
klass.model_name.human + ' ' + klass.human_attribute_name(name)
|
|
33
|
+
end
|
|
27
34
|
end
|
|
28
35
|
|
|
29
36
|
def coltype() 'association' end
|
|
@@ -46,7 +46,18 @@ class Tabulatr::Renderer::Column
|
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
def klassname() @_klassname ||= @klass.name.underscore end
|
|
49
|
-
|
|
49
|
+
|
|
50
|
+
def human_name()
|
|
51
|
+
h = col_options.header
|
|
52
|
+
if h && h.respond_to?(:call)
|
|
53
|
+
h.()
|
|
54
|
+
elsif h
|
|
55
|
+
h
|
|
56
|
+
else
|
|
57
|
+
klass.human_attribute_name(name)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
50
61
|
def sort_param() "#{klassname}_sort" end
|
|
51
62
|
def full_name() [table_name, name].compact.join(":") end
|
|
52
63
|
def coltype() 'column' end
|
data/lib/tabulatr/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tabulatr2
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.
|
|
4
|
+
version: 0.9.30
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Peter Horn
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date:
|
|
13
|
+
date: 2017-02-06 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: rails
|