effective_datatables 4.3.19 → 4.3.20

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: 28bb01dc39b0c9b83499ff5924ff7a49e758ed2d
4
- data.tar.gz: 9c7664964c79f7edb37ea2a04accff4f64a5c675
3
+ metadata.gz: bdd07e900a976b859296be599b528999fc3a405c
4
+ data.tar.gz: 30208e6488de5c84b9311409f98f04a0c718811b
5
5
  SHA512:
6
- metadata.gz: 8fa3df25b973993504a07e3554de2dda16d7bee33486b788d6113efff787809dfa218ffb38b78aef2df72913e264f59d31af99c563c7f971aaac514bb7514d22
7
- data.tar.gz: 37371ad091de71e71b10480b2efbf0a6dccdcea416e63d682568410b833f9bf2d77dd76b3372ffa9031781e29d09bd143578dfb27e04c80a69ebbca5b57b395d
6
+ metadata.gz: d2c242866ddec34922c6720f5794e6efe6e1e866c7d4874540f4fd7b05d67a5a6de87ab54a5203e7f05c889da5e81a13a717f46a012ab54d3a5bc7b5079dcd7e
7
+ data.tar.gz: d9996dfc30d2e7c0ac9f8d81da9fcb782224e88e7d0c4468be7c0d6256d24a1391fa4bef2a922190e1be5e4f6c69f2ee064d293094a8279d2ce8fbdbcf0b69b5
@@ -1,5 +1,5 @@
1
- initializeDataTables = ->
2
- $('table.effective-datatable:not(.initialized)').each ->
1
+ initializeDataTables = (target) ->
2
+ $(target || document).find('table.effective-datatable:not(.initialized)').each ->
3
3
  datatable = $(this)
4
4
  options = datatable.data('options') || {}
5
5
  buttons_export_columns = options['buttons_export_columns'] || ':not(.col-actions)'
@@ -181,6 +181,8 @@ destroyDataTables = ->
181
181
  $('table.effective-datatable').each -> try $(this).removeClass('initialized').DataTable().destroy()
182
182
 
183
183
  $ -> initializeDataTables()
184
+ $(document).on 'effective-datatables:initialize', (event) -> initializeDataTables(event.currentTarget)
185
+
184
186
  $(document).on 'page:change', -> initializeDataTables()
185
187
  $(document).on 'turbolinks:load', -> initializeDataTables()
186
188
  $(document).on 'turbolinks:render', -> initializeDataTables()
@@ -118,10 +118,10 @@ beforeEdit = ($action) ->
118
118
  afterEdit = ($action) ->
119
119
  $tr = $action.closest('tr')
120
120
  $table = $tr.closest('table')
121
- $tr.data('inline-form-original-html', $tr.html())
122
121
 
123
122
  html = buildRow($tr.children('td').length, EffectiveForm.remote_form_payload)
124
123
 
124
+ $tr.data('inline-form-original-html', $tr.children().detach())
125
125
  $tr.html(html)
126
126
  $tr.addClass('effective-datatables-inline-row')
127
127
 
@@ -189,7 +189,8 @@ $(document).on 'click', ".dataTables_wrapper a[data-role='inline-form-cancel']",
189
189
  $td = $tr.children('.col-actions').first()
190
190
  $td.children('svg').remove()
191
191
 
192
- $td.find('.dropdown-toggle').dropdown('toggle')
192
+ $toggle = $td.find('.dropdown-toggle')
193
+ $toggle.dropdown('toggle') if $toggle.parent().hasClass('show')
193
194
  $td.children('.btn-group').show()
194
195
  $td.children('a').show()
195
196
 
@@ -2,12 +2,13 @@ reorder = (event, diff, edit) ->
2
2
  change = diff.find (obj) -> obj.node == edit.triggerRow.node()
3
3
  return unless change?
4
4
 
5
+ $table = $(event.currentTarget)
5
6
  oldNode = $("<div>#{change.oldData}</div>").find('input[data-reorder-resource]')
6
7
  newNode = $("<div>#{change.newData}</div>").find('input[data-reorder-resource]')
7
8
  return unless oldNode? && newNode?
8
9
 
9
10
  url = @context[0].ajax.url.replace('.json', '/reorder.json')
10
- data = {'reorder[id]': oldNode.data('reorder-resource'), 'reorder[old]': oldNode.val(), 'reorder[new]': newNode.val()}
11
+ data = {'reorder[id]': oldNode.data('reorder-resource'), 'reorder[old]': oldNode.val(), 'reorder[new]': newNode.val(), _datatable_cookie: $table.data('cookie') }
11
12
 
12
13
  @context[0].rowreorder.c.enable = false
13
14
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '4.3.19'.freeze
2
+ VERSION = '4.3.20'.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.3.19
4
+ version: 4.3.20
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-01-10 00:00:00.000000000 Z
11
+ date: 2019-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails