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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f5055d945bd4b6b8226f2841e55b02485199622b
4
- data.tar.gz: 4c4f45643a7eb2918c5347c0961303fd6e53ec86
3
+ metadata.gz: 0c6e56a24c68555820e8fd71b7db4717a01447c7
4
+ data.tar.gz: 47a3d46c4ceeab5eac8612d37a077ee0aba09082
5
5
  SHA512:
6
- metadata.gz: bfbfcd41cce3993fde4ccf3898a2cfd48d5651b7a6322a4aa6f96443c4fe03555a94b58274653b9d8a5a31aa535b9ae7ba21bf8bdd32338f6e4e3d251320c948
7
- data.tar.gz: a7c027feb2545b7aed6363f7490eafc57291fa7804394e42ccdc589a0c1229f1788a3428a8ddf2102b9d519c257055ab425cbabeaaae6d12cb6648f78360d0a4
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, &block)
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
- add_actions_column_locals(locals) if opts[:type] == :actions
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)
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '2.11.0'.freeze
2
+ VERSION = '2.11.1'.freeze
3
3
  end
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.0
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-17 00:00:00.000000000 Z
11
+ date: 2017-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails