effective_datatables 4.3.9 → 4.3.10

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: a9b89f0b4d171f32ab9d0cec5bdbf9aed4dfc6d8
4
- data.tar.gz: 072ae799d4ec109020421d1f90051801aec70225
3
+ metadata.gz: a2e79c3aee191317391bd99e89b942fcdbeab3d8
4
+ data.tar.gz: da4378c6d6ea2abe3b8599e6f7c265ecd3ff9740
5
5
  SHA512:
6
- metadata.gz: 85b7cc85ed6373577c2d85b466986722588c9e9dc8515b612a077f111117f4169b385c8273fee057901db5510dfc92ad03a12cab882f3a88b02de8f51ff0e1ea
7
- data.tar.gz: bbe868121e147e40912b5830988879f1a2291be4c687e4bbb07e59b412998a89f0c2d162be4dafb2292f07df79338ecbe2180b29736e028ec8f47bd61b063ebb
6
+ metadata.gz: 5578434dbcfaabd0afb207b0bc6ba1e45622da78dbe5848659367f039ddb9bb387505abbe0eeabfdc49c00d2565362d3afe532b81bf63ba856287c9f0bd206df
7
+ data.tar.gz: addf9df90187cbd2572568acbb34b0d4038075f3e894049ae2824074047a77f6da76130fe29f84e8639ee8b318da10a3b64191547566d2f5e7c62e15c21eeb5b
@@ -35,6 +35,16 @@ $(document).on 'ajax:success', '.dataTables_wrapper .col-actions', (event) ->
35
35
  EffectiveForm.remote_form_flash = ''
36
36
  true
37
37
 
38
+ # There was an error completing something
39
+ $(document).on 'ajax:error', '.dataTables_wrapper', (event) ->
40
+ $action = $(event.target)
41
+ $table = $action.closest('table')
42
+ $table.DataTable().flash('Error: unable to ' + ($action.attr('title') || 'complete action')).draw()
43
+
44
+ EffectiveForm.remote_form_payload = ''
45
+ EffectiveForm.remote_form_flash = ''
46
+ true
47
+
38
48
  # The inline form has been submitted successfully
39
49
  $(document).on 'effective-form:success', '.dataTables_wrapper .col-inline-form', (event, flash) ->
40
50
  $action = $(event.target)
@@ -53,11 +63,7 @@ $(document).on 'effective-form:success', '.dataTables_wrapper .col-inline-form',
53
63
  $table.DataTable().flash(flash || 'Item updated').draw()
54
64
  $tr.fadeOut('slow')
55
65
 
56
- # There was an error completing something
57
- $(document).on 'ajax:error', '.dataTables_wrapper .col-inline-form', (event) ->
58
- $action = $(event.target)
59
- $table = $action.closest('table')
60
- $table.DataTable().flash('Error: unable to ' + ($action.attr('title') || 'complete action')).draw()
66
+
61
67
 
62
68
  beforeNew = ($action) ->
63
69
  $table = $action.closest('table')
@@ -33,5 +33,10 @@ $(document).on 'click', '.dataTables_wrapper a.buttons-reorder', (event) ->
33
33
  column = $table.DataTable().column('.col-_reorder')
34
34
  return unless column.length > 0
35
35
 
36
+ if column.visible()
37
+ $table.removeClass('reordering')
38
+ else
39
+ $table.addClass('reordering')
40
+
36
41
  column.visible(!column.visible())
37
42
 
@@ -14,8 +14,8 @@ table.dataTable.dtr-inline.collapsed > tbody > tr[role="row"] > th:first-child {
14
14
  padding-left: 30px;
15
15
  cursor: pointer;
16
16
  }
17
- table.dataTable.dtr-inline.collapsed > tbody > tr[role="row"] > td:first-child:before,
18
- table.dataTable.dtr-inline.collapsed > tbody > tr[role="row"] > th:first-child:before {
17
+ table.dataTable.dtr-inline.collapsed:not(.reordering) > tbody > tr[role="row"] > td:first-child:before,
18
+ table.dataTable.dtr-inline.collapsed:not(.reordering) > tbody > tr[role="row"] > th:first-child:before {
19
19
  top: 12px;
20
20
  left: 4px;
21
21
  height: 14px;
@@ -34,15 +34,15 @@ module EffectiveDatatablesPrivateHelper
34
34
  end
35
35
 
36
36
  def datatable_reorder(datatable)
37
- return false unless datatable.reorder? && EffectiveDatatables.authorized?(self, :update, datatable.collection_class)
37
+ return unless datatable.reorder? && EffectiveDatatables.authorized?(self, :update, datatable.collection_class)
38
38
  link_to(content_tag(:span, 'Reorder'), '#', class: 'btn btn-link btn-sm buttons-reorder', disabled: true)
39
39
  end
40
40
 
41
41
  def datatable_new_resource_button(datatable, name, column)
42
- if column[:inline] && column[:actions][:new] != false
43
- actions = {'New' => { action: :new, class: ['btn', column[:btn_class].presence].compact.join(' '), 'data-remote': true } }
44
- render_resource_actions(datatable.resource.klass, actions: actions, effective_resource: datatable.resource) # Will only work if permitted
45
- end
42
+ return unless column[:inline] && (column[:actions][:new] != false) && (datatable.resource.actions.include?(:new) rescue false)
43
+
44
+ actions = {'New' => { action: :new, class: ['btn', column[:btn_class].presence].compact.join(' '), 'data-remote': true } }
45
+ render_resource_actions(datatable.resource.klass, actions: actions, effective_resource: datatable.resource) # Will only work if permitted
46
46
  end
47
47
 
48
48
  def datatable_label_tag(datatable, name, opts)
@@ -71,7 +71,7 @@ module Effective
71
71
  )
72
72
 
73
73
  # Just store the values
74
- [attributes.delete_if { |k, v| v.nil? }] + payload.values
74
+ [attributes] + payload.values
75
75
  end
76
76
 
77
77
  end
@@ -8,7 +8,7 @@ module Effective
8
8
  end
9
9
 
10
10
  def controller_namespace
11
- @attributes[:_n]
11
+ @attributes.key?(:namespace) ? @attributes[:namespace] : @attributes[:_n]
12
12
  end
13
13
 
14
14
  private
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '4.3.9'.freeze
2
+ VERSION = '4.3.10'.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.9
4
+ version: 4.3.10
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: 2018-11-15 00:00:00.000000000 Z
11
+ date: 2018-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails