effective_datatables 4.7.2 → 4.7.3
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 +1 -1
- data/app/models/effective/effective_datatable/dsl/datatable.rb +2 -2
- data/app/models/effective/effective_datatable/format.rb +5 -1
- data/app/models/effective/effective_datatable/resource.rb +4 -0
- data/app/views/effective/datatables/_resource_column.html.haml +6 -4
- data/lib/effective_datatables/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4680722774df8a353220ea8430222cda0502291a23ac39c5ffb70b3f36c524bb
|
4
|
+
data.tar.gz: a68b88bb5b0d0bf60c175be105dc4483c3962fb40e0796eadf6c02d598789b60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a9e0d639eb8d8407d6b7113714d90e408f9b41b32fb8841695cc61532559a5ddff0ccbaaa0032bba21bf70fe59bc774ca34e3917a1165b042bddf3f1aab7a76
|
7
|
+
data.tar.gz: e30c2c0bd9a14faef5569aa2c996d6159c89ff973868351b7e1182efdcf04eb1fee0f9537c4531a5894410e11b9ad8d3c4ca579bfd30161afffdb0716d198de6
|
data/README.md
CHANGED
@@ -466,7 +466,7 @@ It accepts one optional block used to format the value after any search or sorti
|
|
466
466
|
The following options are available:
|
467
467
|
|
468
468
|
```ruby
|
469
|
-
action: :show|:edit|false #
|
469
|
+
action: :show|:edit|false # Render as a link to this action. edit -> show by default
|
470
470
|
as: :string|:integer|etc # Sets the type of column initializing defaults for search, sort and format
|
471
471
|
col_class: 'col-green' # Sets the html class to use on this column's td and th
|
472
472
|
label: 'My label' # The label for this column
|
@@ -34,7 +34,7 @@ module Effective
|
|
34
34
|
name = name.to_sym unless name.to_s.include?('.')
|
35
35
|
|
36
36
|
datatable._columns[name] = Effective::DatatableColumn.new(
|
37
|
-
action: action,
|
37
|
+
action: action,
|
38
38
|
as: as,
|
39
39
|
compute: nil,
|
40
40
|
col_class: col_class,
|
@@ -62,7 +62,7 @@ module Effective
|
|
62
62
|
name = name.to_sym unless name.to_s.include?('.')
|
63
63
|
|
64
64
|
datatable._columns[name] = Effective::DatatableColumn.new(
|
65
|
-
action: action,
|
65
|
+
action: action,
|
66
66
|
as: as,
|
67
67
|
compute: (compute if block_given?),
|
68
68
|
col_class: col_class,
|
@@ -143,8 +143,12 @@ module Effective
|
|
143
143
|
return {} unless (resource = opts[:resource]).present?
|
144
144
|
|
145
145
|
polymorphic = (opts[:as] == :belongs_to_polymorphic)
|
146
|
+
associated = resource.macros.include?(opts[:as])
|
146
147
|
|
147
|
-
|
148
|
+
resource_name = opts[:name] if associated
|
149
|
+
resource_to_s = opts[:name] unless associated || array_collection?
|
150
|
+
|
151
|
+
locals = { resource_name: resource_name, resource_to_s: resource_to_s, effective_resource: resource, show_action: false, edit_action: false }
|
148
152
|
|
149
153
|
case opts[:action]
|
150
154
|
when :edit
|
@@ -102,6 +102,10 @@ module Effective
|
|
102
102
|
opts[:as] ||= :string
|
103
103
|
opts[:as] = :email if (opts[:as] == :string && name.to_s.end_with?('email'))
|
104
104
|
|
105
|
+
if opts[:action]
|
106
|
+
opts[:resource] ||= resource
|
107
|
+
end
|
108
|
+
|
105
109
|
if opts[:resource] && !opts[:resource_field] && opts[:as] != :effective_addresses
|
106
110
|
opts[:partial] ||= '/effective/datatables/resource_column'
|
107
111
|
end
|
@@ -1,8 +1,10 @@
|
|
1
|
-
- Array(
|
1
|
+
- Array(local_assigns[:resource_name] ? resource.public_send(resource_name) : resource).each do |resource|
|
2
|
+
- resource_to_s = (local_assigns[:resource_to_s] ? resource.public_send(resource_to_s) : resource.to_s)
|
3
|
+
|
2
4
|
.col-resource_item
|
3
5
|
- if edit_action && EffectiveDatatables.authorized?(controller, :edit, resource) && (path = effective_resource.action_path(:edit, resource)).present?
|
4
|
-
= link_to
|
6
|
+
= link_to resource_to_s, path, title: resource_to_s
|
5
7
|
- elsif show_action && EffectiveDatatables.authorized?(controller, :show, resource) && (path = effective_resource.action_path(:show, resource)).present?
|
6
|
-
= link_to
|
8
|
+
= link_to resource_to_s, path, title: resource_to_s
|
7
9
|
- else
|
8
|
-
=
|
10
|
+
= resource_to_s.html_safe
|
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.7.
|
4
|
+
version: 4.7.3
|
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: 2019-06-
|
11
|
+
date: 2019-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|