active_scaffold_sortable 3.3.4 → 3.3.5

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: c0a5c9b42e05a1d29a5fa7dd07cd344b0284c1b4
4
- data.tar.gz: 370270a2c3a0b1624a499ea6b0e370fe7bf859f7
3
+ metadata.gz: 12b3b4375b8bb35bcc851b5219b358178c9b4054
4
+ data.tar.gz: adae7a6bf7560acd094fe1338586fb7df28616ca
5
5
  SHA512:
6
- metadata.gz: c9003cc73e265375204b884de5392abc795d4ffe4854974acab2db5c6860c82f77cb1685e643071ee403e8262f2b13ad4a230355c42fa7cd80398459a196a4fd
7
- data.tar.gz: 5a23e8ead750614e248bb41e9739c5bb9c75907409efd728e91dd94676361c74df42379feb5251d213794049bf07a3dfd868dbf41679dc68c25c518d277f5f16
6
+ metadata.gz: 1bd583874658fea4563d85c82a5352cafa482543c081c75d8cb9448203b5bb253f5b864184279c508e952da840695f8a1793db7aaa9712718130b1cbc536aa31
7
+ data.tar.gz: df9a188389ee2ffb54fc270d750a0930eeea09eb59955147dd1c6bb5be51840222252fbd2d5e2cc93295455bf409d929bf42dc2eb43436976af1722fac830888
@@ -8,11 +8,18 @@ ActiveScaffold.update_positions = function(content) {
8
8
  ActiveScaffold.sortable = function(element) {
9
9
  var fixHelper = function(e, ui) {
10
10
  ui.find('*').each(function() {
11
- jQuery(this).data('sortable-prev-style', jQuery(this).attr('style'));
12
- jQuery(this).width(jQuery(this).width());
11
+ var $this = jQuery(this);
12
+ $this.data('sortable-prev-style', $this.attr('style'));
13
+ $this.width($this.width());
13
14
  });
14
15
  return ui;
15
16
  };
17
+ var copyHelperToPlaceholder = function(e, ui) {
18
+ var items = ui.placeholder.find('td');
19
+ ui.helper.find('td').each(function(i) {
20
+ jQuery(items[i]).width(jQuery(this).width());
21
+ });
22
+ };
16
23
  var restoreHelper = function(e, ui) {
17
24
  ui.helper.find('*').each(function() {
18
25
  var style = jQuery(this).data('sortable-prev-style');
@@ -21,7 +28,7 @@ ActiveScaffold.sortable = function(element) {
21
28
  jQuery(this).removeData('sortable-prev-style');
22
29
  });
23
30
  };
24
- var form, content, sortable_options = {containment: 'parent', tolerance: 'pointer', forcePlaceholderSize: true, placeholder: 'sortable-highlight', helper: fixHelper, beforeStop: restoreHelper};
31
+ var form, content, sortable_options = {containment: 'parent', tolerance: 'pointer', forcePlaceholderSize: true, placeholder: 'sortable-highlight', helper: fixHelper, beforeStop: restoreHelper, start: copyHelperToPlaceholder};
25
32
  if (typeof(element) == 'string') {
26
33
  content = jQuery('#' + element);
27
34
  element = content.closest('.sortable-container');
@@ -50,7 +57,7 @@ ActiveScaffold.sortable = function(element) {
50
57
  }
51
58
  }
52
59
  sortable_options.handle = element.data('handle');
53
- sortable_options.items = '> ' + element.data('tag');
60
+ sortable_options.items = element.data('tag');
54
61
  content.sortable(sortable_options);
55
62
  };
56
63
 
@@ -1,6 +1,5 @@
1
1
  .sortable-handle { cursor: move; }
2
2
  .active-scaffold .sub-form table td.sortable-handle { display: table-cell; visibility: visible; }
3
- .active-scaffold .sub-form tbody.sortable-highlight { display: table-row; }
4
3
  td.sortable-handle, .active-scaffold .sub-form table td.sortable-handle {
5
4
  background: image-url('active_scaffold/sortable.png') no-repeat center center;
6
5
  width: 16px;
@@ -1,6 +1,6 @@
1
1
  <% config = active_scaffold_config_for(column.association.klass) %>
2
2
  <% if config.actions.include? :sortable %>
3
- <%= content_tag :div, render(:super), :class => 'sortable-container', :data => sort_params(config).merge(:tag => '.sub-form-record') %>
3
+ <%= content_tag :div, 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") %>
4
4
  <% else %>
5
5
  <%= render :super %>
6
6
  <% end %>
@@ -2,7 +2,7 @@ module ActiveScaffoldSortable
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 3
5
- PATCH = 4
5
+ PATCH = 5
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
@@ -2,7 +2,7 @@ module ActiveScaffoldSortable
2
2
  module ViewHelpers
3
3
  def sort_params(config = active_scaffold_config)
4
4
  options = {
5
- :tag => 'tr',
5
+ :tag => '> tr',
6
6
  :format => '^[^_-](?:[A-Za-z0-9_-]*)-(.*)-row$',
7
7
  :column => config.sortable.column.name
8
8
  }
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.3.4
4
+ version: 3.3.5
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: 2017-08-24 00:00:00.000000000 Z
12
+ date: 2017-11-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: active_scaffold