effective_datatables 4.5.0 → 4.5.1
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/app/assets/javascripts/effective_datatables/bulk_actions.js.coffee +3 -3
- data/app/helpers/effective_datatables_helper.rb +1 -1
- data/app/helpers/effective_datatables_private_helper.rb +4 -5
- data/app/models/effective/effective_datatable/dsl/bulk_actions.rb +6 -6
- data/app/models/effective/effective_datatable/dsl/filters.rb +1 -1
- 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: 31a344040059c64f97f81b5e6bab69a4e847ceb5
|
4
|
+
data.tar.gz: fc9adcb63f54ff31c7ed5f43f742f789bd7758f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c650bb8a060b85d5bc82fb03ba6da4bb9a11749f5065b5e990fc5480cbe27eed332f25ee6aa913caedfcd4167521d0009927d99f29a4b7dd6af1654b8eb2826
|
7
|
+
data.tar.gz: f5ef7aa35f0574428a6ddb7acf50c58e2b9ad471080c605e0ffb3d8895097cef601dc2216ada0dde25825c330dd06fd90ff620b4c6f6413ca152f6d8ff88d6ea
|
@@ -53,7 +53,7 @@ $(document).on 'click', '.dataTables_wrapper .buttons-bulk-actions a', (event) -
|
|
53
53
|
|
54
54
|
url = $bulkAction.attr('href')
|
55
55
|
title = $bulkAction.text()
|
56
|
-
|
56
|
+
download = $bulkAction.data('bulk-download')
|
57
57
|
token = $table.data('authenticity-token')
|
58
58
|
values = $.map($selected, (input) -> input.getAttribute('value'))
|
59
59
|
method = $bulkAction.data('ajax-method')
|
@@ -73,10 +73,10 @@ $(document).on 'click', '.dataTables_wrapper .buttons-bulk-actions a', (event) -
|
|
73
73
|
|
74
74
|
$table.dataTable().data('bulk-actions-restore-selected-values', values)
|
75
75
|
|
76
|
-
if
|
76
|
+
if download # This is a file download
|
77
77
|
$.fileDownload(url,
|
78
78
|
httpMethod: 'POST',
|
79
|
-
data: { ids: values, authenticity_token:
|
79
|
+
data: { ids: values, authenticity_token: token }
|
80
80
|
successCallback: ->
|
81
81
|
success = "Successfully completed #{title} bulk action"
|
82
82
|
$table.one 'draw.dt', (e) -> $(e.target).DataTable().flash(success, 'success')
|
@@ -57,7 +57,7 @@ module EffectiveDatatablesHelper
|
|
57
57
|
'simple' => simple.to_s,
|
58
58
|
'spinner' => icon('spinner'), # effective_bootstrap
|
59
59
|
'source' => effective_datatables.datatable_path(datatable, {format: 'json'}),
|
60
|
-
'total-records' => datatable.to_json[:recordsTotal]
|
60
|
+
'total-records' => datatable.to_json[:recordsTotal]
|
61
61
|
}
|
62
62
|
}
|
63
63
|
|
@@ -114,8 +114,7 @@ module EffectiveDatatablesPrivateHelper
|
|
114
114
|
end
|
115
115
|
|
116
116
|
def datatable_filter_tag(form, datatable, name, opts)
|
117
|
-
as = opts
|
118
|
-
collection = opts.delete(:collection)
|
117
|
+
as = opts[:as].to_s.chomp('_field').to_sym
|
119
118
|
value = datatable.state[:filter][name]
|
120
119
|
|
121
120
|
options = {
|
@@ -125,13 +124,13 @@ module EffectiveDatatablesPrivateHelper
|
|
125
124
|
placeholder: (opts[:label] || name.to_s.titleize),
|
126
125
|
value: value,
|
127
126
|
wrapper: { class: 'form-group col-auto'}
|
128
|
-
}.merge(opts.except(:parse))
|
127
|
+
}.merge(opts.except(:as, :collection, :parse))
|
129
128
|
|
130
129
|
options[:name] = '' unless datatable._filters_form_required?
|
131
130
|
|
132
|
-
if
|
131
|
+
if [:select, :radios, :checks].include?(as)
|
133
132
|
options.delete(:name) unless as == :select
|
134
|
-
form.public_send(as, name, collection, options) # select, radios, checks
|
133
|
+
form.public_send(as, name, opts[:collection], options) # select, radios, checks
|
135
134
|
elsif form.respond_to?(as)
|
136
135
|
form.public_send(as, name, options) # check_box, text_area
|
137
136
|
else
|
@@ -3,12 +3,12 @@ module Effective
|
|
3
3
|
module Dsl
|
4
4
|
module BulkActions
|
5
5
|
|
6
|
-
def bulk_action(
|
7
|
-
datatable._bulk_actions.push(link_to_bulk_action(
|
6
|
+
def bulk_action(title, url, opts = {})
|
7
|
+
datatable._bulk_actions.push(link_to_bulk_action(title, url, opts))
|
8
8
|
end
|
9
9
|
|
10
|
-
def bulk_download(
|
11
|
-
datatable._bulk_actions.push(link_to_bulk_action(
|
10
|
+
def bulk_download(title, url, opts = {})
|
11
|
+
datatable._bulk_actions.push(link_to_bulk_action(title, url, opts.merge('data-bulk-download': true)))
|
12
12
|
end
|
13
13
|
|
14
14
|
def bulk_action_divider
|
@@ -22,7 +22,7 @@ module Effective
|
|
22
22
|
private
|
23
23
|
|
24
24
|
# We can't let any data-method be applied to the link, or jquery_ujs does the wrong thing with it
|
25
|
-
def link_to_bulk_action(
|
25
|
+
def link_to_bulk_action(title, url, opts = {})
|
26
26
|
|
27
27
|
# Transform data: { ... } hash into 'data-' keys
|
28
28
|
if (data = opts.delete(:data))
|
@@ -34,7 +34,7 @@ module Effective
|
|
34
34
|
|
35
35
|
opts[:class] = [opts[:class], 'dropdown-item'].compact.join(' ')
|
36
36
|
|
37
|
-
link_to(
|
37
|
+
link_to(title, url, opts)
|
38
38
|
end
|
39
39
|
|
40
40
|
end
|
@@ -5,7 +5,7 @@ module Effective
|
|
5
5
|
def filter(name = nil, value = :_no_value, as: nil, label: nil, parse: nil, required: false, **input_html)
|
6
6
|
return datatable.filter if (name == nil && value == :_no_value) # This lets block methods call 'filter' and get the values
|
7
7
|
|
8
|
-
raise 'expected second argument to be a value' if value == :_no_value
|
8
|
+
raise 'expected second argument to be a value. the default value for this filter.' if value == :_no_value
|
9
9
|
raise 'parse must be a Proc' if parse.present? && !parse.kind_of?(Proc)
|
10
10
|
|
11
11
|
# Merge search
|
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.5.
|
4
|
+
version: 4.5.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: 2019-04-
|
11
|
+
date: 2019-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|