active_scaffold_sortable 3.7.0 → 3.7.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 33121e6e1386e4f3802c52e705127873fae644c4058fbf76de119494c281c8fa
4
- data.tar.gz: df471b954ff70f91201355d63deebae589be6410ccd2b518391f7b00dabbfad5
3
+ metadata.gz: 112f634278244f46658f99c8b345ab0cefba473847b6506a8153994fa6c36338
4
+ data.tar.gz: 919c3a557e9e848666b405ed98824d4a56afba1c75dd469789a384ac6c368d54
5
5
  SHA512:
6
- metadata.gz: 24b658744b23cdec8a02d8312810e9577a8a49aeb5a0456d40e8e6c2d791a032497cf33e82428437383aae37fd4c8ebcea21f8d76096828003169b3920ac22bd
7
- data.tar.gz: e3da06ae6819c09b945eaa66eb9d74df23802e06a952a96f4b7847156d8b064de66ff576a6ecbf73136a9cd688118b6295fd5e23f74bd1a18b81543f691d3911
6
+ metadata.gz: 5fce2b009a43a8a5a5497d0e6d7b7a3a9db9d001d54b5649b01b3bb51b9bc2d5fa1a9a2eb398978507e57b2458ba4e379e5af8dc01b03b72080ab09fb3f49bb7
7
+ data.tar.gz: 12b95543bf31ae6d94943b33fbf032b45efdc3ab9d2e06077941df94365ecfcf8b29edb571fe50110a92314c857820130bd8352075cc8621c89d671219937f9d
@@ -1,6 +1,6 @@
1
1
  <% config = active_scaffold_config_for(column.association.klass) %>
2
2
  <% if config.actions.include? :sortable %>
3
- <%= as_element :sortable_container, render(:super), class: 'sortable-container', data: sort_params(config).merge(tag: "##{sub_form_list_id(association: column.name, id: parent_record.try(:id) || generated_id(parent_record) || 99999999999)} > .sub-form-record") %>
3
+ <%= as_element :sortable_container, render(:super), class: 'sortable-container', data: sort_params(config).merge(tag: "##{sub_form_list_id(association: column.name, id: parent_record.try(:id) || generated_id(parent_record) || 99999999999, tab_id: local_assigns[:tab_id])} > .sub-form-record") %>
4
4
  <% else %>
5
5
  <%= render :super %>
6
6
  <% end %>
@@ -1,6 +1,6 @@
1
1
  module ActiveScaffoldSortable
2
2
  module AttributeParams
3
- def update_column_from_params(parent_record, column, attribute, avoid_changes = false)
3
+ def update_column_from_params(parent_record, column, ...)
4
4
  super.tap do |value|
5
5
  if column.association.try(:collection?)
6
6
  config = active_scaffold_config_for(column.association.klass)
@@ -2,7 +2,7 @@ module ActiveScaffoldSortable
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 7
5
- PATCH = 0
5
+ PATCH = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
@@ -4,5 +4,10 @@ class AncestryModelsController < ActionController::Base
4
4
  active_scaffold :ancestry_model do |config|
5
5
  config.actions << :sortable
6
6
  config.sortable.column = :position
7
+ config.subform.columns = [:name]
8
+ config.update.columns.add_subgroup "Children" do |group|
9
+ group.add :children
10
+ group.tabbed_by = :name
11
+ end
7
12
  end
8
13
  end
@@ -36,6 +36,20 @@ class TreeModelsControllerTest < ActionController::TestCase
36
36
  assert_equal [parent.id, 1], [second.reload.parent_id, second.position]
37
37
  end
38
38
 
39
+ test "targets the tabbed subform list from its sortable container" do
40
+ @controller = AncestryModelsController.new
41
+ parent = AncestryModel.create!(name: "parent", position: 1)
42
+ AncestryModel.create!(name: "first tab", position: 1, parent: parent)
43
+
44
+ get :edit, params: {id: parent.id}
45
+
46
+ assert_response :success
47
+ list_id = "as_ancestry_models-#{parent.id}-children-first-tab-subform-list"
48
+ assert_select ".sortable-container[data-tag='##{list_id} > .sub-form-record']" do
49
+ assert_select "##{list_id}"
50
+ end
51
+ end
52
+
39
53
  test "auto-enables and reorders nested-set API models" do
40
54
  @controller = NestedSetModelsController.new
41
55
  first = NestedSetModel.create!(name: "first", position: 1)
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.7.0
4
+ version: 3.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergio Cambra