effective_datatables 4.30.1 → 4.31.0

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: 101202eb8e7251895835506090dbee19f994e4db1bed1ba263f8bed9226c45de
4
- data.tar.gz: c10bbed1cddf86a46782924d42eb1a081eb4fef692a9eb1a4ab9e76520522c4a
3
+ metadata.gz: 44820c2466c8503adb80773c5bc282203a8c1a7be41d931bea08413b2c980644
4
+ data.tar.gz: e450c9c54b19fe4c5aa1619f8ee19a893796c1ffb6b88e66be3016feecb2a01f
5
5
  SHA512:
6
- metadata.gz: ac57919edf6575dc47ed971f8cec6d60afa6783095f2098cafa8d89ba43cad4283c87bafcef402880fdac90a5d91c2b00a887753da11cbbf77b82f8e9325be23
7
- data.tar.gz: 505c45e8a0034dda6a99120f65cabf601886627bac22c23148cc4cd7fc217c1c08235ba92d65522064eeaa014c7c18a179ca9d711585093309cbb1897d956bdb
6
+ metadata.gz: 79964cf5b2036ca752a16a2529bdc79f37189990c3296a285ae05792a5218a58af426d9f0165503303caacdbcda98c8b309b50c152debf7ac0ec203c5b20375c
7
+ data.tar.gz: 7783cf0f17017eeba8c143138a1d535ed06bfa85c7cb41c73dbf76523d74243f18842b8bb6042c45afbdd1d9aa6d9334bded97d7e2e2e06b4aa1ff4161c0bc12
@@ -6,7 +6,10 @@ getFilterParams = ->
6
6
  params = {}
7
7
 
8
8
  if $form.length > 0
9
- params['scope'] = $form.find("input[name='filters[scope]']:checked").val() || ''
9
+ params['scope'] = $form.find("input[name='filters[scope]']:checked").val()
10
+ params['scope'] ||= $form.find("input[name='filters[scope]']:not([type='hidden'])").first().val()
11
+ params['scope'] ||= 'effective_datatables_empty_scope'
12
+
10
13
  params['filter'] = {}
11
14
 
12
15
  $form.find("select,textarea,input:enabled:not([type=submit])").each ->
@@ -73,11 +73,13 @@ module Effective
73
73
  if new_index > old_index
74
74
  @datatable.collection.where("#{attribute} > ? AND #{attribute} <= ?", old_index, new_index).update_all("#{attribute} = #{attribute} - 1")
75
75
  @resource.update_column(attribute, new_index)
76
+ @resource.touch
76
77
  end
77
78
 
78
79
  if old_index > new_index
79
80
  @datatable.collection.where("#{attribute} >= ? AND #{attribute} < ?", new_index, old_index).update_all("#{attribute} = #{attribute} + 1")
80
81
  @resource.update_column(attribute, new_index)
82
+ @resource.touch
81
83
  end
82
84
  end
83
85
 
@@ -73,7 +73,11 @@ module Effective
73
73
 
74
74
  def load_filters!
75
75
  state[:filter] = _filters.inject({}) { |h, (name, opts)| h[name] = opts[:value]; h }
76
- state[:scope] = _scopes.find { |_, opts| opts[:default] }.try(:first) || _scopes.keys.first
76
+ state[:scope] = initial_scope()
77
+ end
78
+
79
+ def initial_scope
80
+ _scopes.find { |_, opts| opts[:default] }.try(:first) || _scopes.keys.first
77
81
  end
78
82
 
79
83
  def load_filter_params!
@@ -112,7 +116,7 @@ module Effective
112
116
  state[:order_index] = params[:order]['0'][:column].to_i
113
117
  end
114
118
 
115
- state[:scope] = _scopes.keys.find { |name| params[:scope] == name.to_s }
119
+ state[:scope] = _scopes.keys.find { |name| params[:scope] == name.to_s } || initial_scope()
116
120
  state[:start] = params[:start].to_i
117
121
 
118
122
  state[:search] = {}
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '4.30.1'.freeze
2
+ VERSION = '4.31.0'.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.30.1
4
+ version: 4.31.0
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: 2024-09-23 00:00:00.000000000 Z
11
+ date: 2025-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails