effective_datatables 4.10.1 → 4.10.2

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
  SHA256:
3
- metadata.gz: 23fc1a12eb490a341d424c18f5f773081ff37c4b7de69143b0d76d016830f454
4
- data.tar.gz: 6d3fff829f467d8dac9abbac7a9023b939d34a0a6eb978270fdcb5ce5edf3d2e
3
+ metadata.gz: b43481421038a1511a8c6ccca052678aa5f70d8c70465e1e267d43fe4f05aa0f
4
+ data.tar.gz: d598bcb2c9633ab6dabaf7d2fe1cc7078dae9065613022437b200e43d06b1d1a
5
5
  SHA512:
6
- metadata.gz: 2177238d3bfac03c9020a25b4998bc31d325ad589be8fc8c2c28467a42715cf0d61af9698540db04fad665bb13bc6dc7e8c04c912666f3c4aa85debe98bdfaea
7
- data.tar.gz: f48c993d05144a299f366dace3287d4a83d047219bcf30974a23bd3254a81f96a2e6854bafc8dbc2428d34025dff60661057781a89486169f9b25098850bae62
6
+ metadata.gz: 5447d312f17607bb74eb955083085df297beeee2b92bb60ded0271f025a7095b5bae36a473ab79b456efc54cff8787bda574ca1b0c35276228155941023d7fe0
7
+ data.tar.gz: bd9c7bd9543d56529dc444b1f753087195a8ee6bc7631e07490a6b2d6115624b3c5f8fc2b7fe3dd832e627a7dd9e454be3a9471a0ebaf2cdd289f79abd149521
data/README.md CHANGED
@@ -605,6 +605,12 @@ Any `data-remote` actions will be hijacked and performed as inline ajax by datat
605
605
 
606
606
  If you'd like to opt-out of this behavior, use `actions_col(inline: false)` or add `data-inline: false` to your action link.
607
607
 
608
+ If the automatic actions_col aren't being displayed, try setting the namespace directly when calling the table
609
+
610
+ ```
611
+ MyApp::UsersTable.new(namespace: :my_app)
612
+ ```
613
+
608
614
  ## length
609
615
 
610
616
  Sets the default number of rows per page. Valid lengths are `5`, `10`, `25`, `50`, `100`, `250`, `500`, `:all`
@@ -42,7 +42,7 @@ module Effective
42
42
  def initialize(view = nil, attributes = nil)
43
43
  (attributes = view; view = nil) if view.kind_of?(Hash)
44
44
 
45
- @attributes = (attributes || {})
45
+ @attributes = initial_attributes(attributes)
46
46
  @state = initial_state
47
47
 
48
48
  @_aggregates = {}
@@ -17,6 +17,24 @@ module Effective
17
17
  @attributes[:namespace] ||= view.controller_path.split('/')[0...-1].join('/')
18
18
  end
19
19
 
20
+ # Polymorphic shorthand attributes.
21
+ # If you pass resource: User(1), it sets resource_id: 1, resource_type: 'User'
22
+ def initial_attributes(attributes)
23
+ return {} if attributes.blank?
24
+
25
+ resources = attributes.select { |k, v| v.kind_of?(ActiveRecord::Base) }
26
+ return attributes if resources.blank?
27
+
28
+ retval = attributes.except(*resources.keys)
29
+
30
+ resources.each do |k, resource|
31
+ retval["#{k}_id".to_sym] = resource.id
32
+ retval["#{k}_type".to_sym] = resource.class.name
33
+ end
34
+
35
+ retval
36
+ end
37
+
20
38
  end
21
39
  end
22
40
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '4.10.1'.freeze
2
+ VERSION = '4.10.2'.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: 4.10.1
4
+ version: 4.10.2
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: 2021-12-10 00:00:00.000000000 Z
11
+ date: 2021-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails