effective_datatables 2.11.0 → 2.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -0
- data/app/models/effective/datatable.rb +2 -2
- data/app/models/effective/effective_datatable/dsl/datatable.rb +3 -2
- data/app/models/effective/effective_datatable/options.rb +1 -3
- data/app/models/effective/effective_datatable/rendering.rb +4 -1
- data/app/views/effective/datatables/_actions_column.html.haml +4 -0
- data/lib/effective_datatables/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: 0c6e56a24c68555820e8fd71b7db4717a01447c7
|
4
|
+
data.tar.gz: 47a3d46c4ceeab5eac8612d37a077ee0aba09082
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2b1e22237b8cdbff14edb359266f3079af6bfb52b072d590072ffa26382187b25d1f2306314d8e8e84826cb448190c31dde3d1837275f4b9f6a374795056987
|
7
|
+
data.tar.gz: 8a4624ec83c4752f1a29141af17a61f6392c7425eed955753fd028c4afe50271ea00192fb1ea1a3bc296eedecad58d1a334583d74d0e04460972cbb4ebe1757b
|
data/README.md
CHANGED
@@ -434,6 +434,16 @@ Override the default actions by passing your own partial:
|
|
434
434
|
actions_column partial: 'admin/posts/actions'
|
435
435
|
```
|
436
436
|
|
437
|
+
or just extend the default by
|
438
|
+
|
439
|
+
```ruby
|
440
|
+
actions_column do |post|
|
441
|
+
unless post.approved?
|
442
|
+
glyphicon_to('ok', approve_post_path(post), title: 'Approve')
|
443
|
+
end
|
444
|
+
end
|
445
|
+
```
|
446
|
+
|
437
447
|
### Showing action buttons
|
438
448
|
|
439
449
|
The show/edit/destroy action buttons can be configured to always show, always hide, or to consider the current_user's permission level.
|
@@ -125,11 +125,11 @@ module Effective
|
|
125
125
|
end
|
126
126
|
|
127
127
|
def present?
|
128
|
-
total_records > 0
|
128
|
+
total_records > 0 || current_scope.present?
|
129
129
|
end
|
130
130
|
|
131
131
|
def empty?
|
132
|
-
total_records == 0
|
132
|
+
total_records == 0 && current_scope.blank?
|
133
133
|
end
|
134
134
|
|
135
135
|
def total_records
|
@@ -40,13 +40,14 @@ module Effective
|
|
40
40
|
sortable: false,
|
41
41
|
filter: false,
|
42
42
|
responsivePriority: 0,
|
43
|
-
partial_locals: { show_action: show, edit_action: edit, destroy_action: destroy, unarchive_action: unarchive }
|
43
|
+
partial_locals: { show_action: show, edit_action: edit, destroy_action: destroy, unarchive_action: unarchive },
|
44
|
+
actions_block: block
|
44
45
|
}.merge(options)
|
45
46
|
|
46
47
|
opts[:partial_local] ||= :resource unless opts[:partial].present?
|
47
48
|
opts[:partial] ||= '/effective/datatables/actions_column' unless proc.present?
|
48
49
|
|
49
|
-
table_column(name, opts, proc
|
50
|
+
table_column(name, opts, proc)
|
50
51
|
end
|
51
52
|
|
52
53
|
def bulk_actions_column(options = {}, proc = nil, &block)
|
@@ -29,9 +29,7 @@ module Effective
|
|
29
29
|
|
30
30
|
def _initialize_attributes(args)
|
31
31
|
args.compact.each do |arg|
|
32
|
-
if arg.respond_to?(:permit) # ActionController::Parameters / Rails 5
|
33
|
-
arg = arg.permit(*permitted_params).to_h() # We permit only the scopes params
|
34
|
-
end
|
32
|
+
arg = arg.to_unsafe_h if arg.respond_to?(:permit) # ActionController::Parameters / Rails 5 hack. TODO.
|
35
33
|
|
36
34
|
raise "#{self.class.name}.new() can only be initialized with a Hash like arguments" unless arg.kind_of?(Hash)
|
37
35
|
|
@@ -71,7 +71,10 @@ module Effective
|
|
71
71
|
|
72
72
|
locals.merge!(opts[:partial_locals]) if opts[:partial_locals]
|
73
73
|
|
74
|
-
|
74
|
+
if opts[:type] == :actions
|
75
|
+
add_actions_column_locals(locals)
|
76
|
+
locals[:actions_block] = opts[:actions_block]
|
77
|
+
end
|
75
78
|
|
76
79
|
rendered[name] = (render(
|
77
80
|
:partial => opts[:partial],
|
@@ -38,3 +38,7 @@
|
|
38
38
|
- if unarchive_action && unarchive_path
|
39
39
|
- if resource.respond_to?(:archived?) && resource.archived?
|
40
40
|
= unarchive_icon_to unarchive_path.gsub(':to_param', resource.to_param)
|
41
|
+
|
42
|
+
- if actions_block
|
43
|
+
= capture do
|
44
|
+
- instance_exec(resource, &actions_block)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_datatables
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.11.
|
4
|
+
version: 2.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|