active_scaffold_sortable 3.2.10 → 3.2.11

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: c2271e57325561689f2ce07b97d177a81dd4b4d3
4
- data.tar.gz: a742daf66403523b39e34312230ab92f963d514a
3
+ metadata.gz: 5e762e42e9f36d8a36ce8cd524f763fcea2ce1c5
4
+ data.tar.gz: 05a77343639d90656ad2ae4d6bb9affe913abd32
5
5
  SHA512:
6
- metadata.gz: 212f542521885bd1f5f7995e64643ce945bc7508b14e5289ce07dc4cef225d396480e256fee8c372f49b8522273ef0c0672cb56880f54ffe860c57f74f3d87bf
7
- data.tar.gz: c3dcd22c986d98af3823ca2a09a8e08a978658ef5de701ae993237fbe71e5d9eaa447268d593546b0e173d8d4702815633a5731e7180d33bef63d7e9ecdcb3a9
6
+ metadata.gz: 34cba7a88ef66b0b1fb677f76f4c0766001d43466906437533f56a6f08783526eee48b1b22b7fd189de4947db8fdcc4651caeed9e878e0feac8c1b88235fe2c0
7
+ data.tar.gz: d9145cc4b3fa7dbabb37d6d0a113e1c3e6147f9f92fda06a2fe0e68c27e37f6a46ae98805f8528f35cefef3ffbd6eebc27d6a651b3197b4f752a647139350166
@@ -0,0 +1,18 @@
1
+ module ActiveScaffoldSortable
2
+ module AttributeParams
3
+ def self.included(base)
4
+ base.alias_method_chain :update_column_from_params, :sortable
5
+ end
6
+
7
+ def update_column_from_params_with_sortable(parent_record, column, attribute, avoid_changes = false)
8
+ update_column_from_params_without_sortable(parent_record, column, attribute, avoid_changes).tap do |value|
9
+ if column.plural_association?
10
+ config = active_scaffold_config_for(column.association.klass)
11
+ if config.actions.include?(:sortable)
12
+ parent_record.association(column.association.name).target = value.sort_by(&config.sortable.column.name)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -2,7 +2,7 @@ module ActiveScaffoldSortable
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 2
5
- PATCH = 10
5
+ PATCH = 11
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
@@ -1,5 +1,6 @@
1
1
  require "active_scaffold_sortable/config/core.rb"
2
2
  require "active_scaffold_sortable/core.rb"
3
+ require "active_scaffold_sortable/attribute_params.rb"
3
4
  require "active_scaffold_sortable/engine.rb" unless defined? ACTIVE_SCAFFOLD_SORTABLE_PLUGIN
4
5
 
5
6
  module ActiveScaffoldSortable
@@ -24,5 +25,6 @@ module ActiveScaffold
24
25
  end
25
26
  ActionView::Base.send :include, ActiveScaffoldSortable::ViewHelpers
26
27
  ActiveScaffold::Config::Core.send :include, ActiveScaffoldSortable::Core
28
+ ActiveScaffold::AttributeParams.send :include, ActiveScaffoldSortable::AttributeParams
27
29
  ActiveScaffold.stylesheets << 'active_scaffold_sortable'
28
30
  ActiveScaffold.javascripts << 'active_scaffold_sortable'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_scaffold_sortable
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.10
4
+ version: 3.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergio Cambra
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-09-15 00:00:00.000000000 Z
12
+ date: 2015-09-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: active_scaffold
@@ -57,6 +57,7 @@ files:
57
57
  - lib/active_scaffold/config/sortable.rb
58
58
  - lib/active_scaffold/helpers/sortable_helpers.rb
59
59
  - lib/active_scaffold_sortable.rb
60
+ - lib/active_scaffold_sortable/attribute_params.rb
60
61
  - lib/active_scaffold_sortable/config/core.rb
61
62
  - lib/active_scaffold_sortable/core.rb
62
63
  - lib/active_scaffold_sortable/engine.rb