positioning 0.2.6 → 0.3.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: a0ee169113edb44c11902cb1bd27fdb5f156d1c4ca4ff2a8e75b250d71bc3d52
4
- data.tar.gz: 8d7ff6671fd40a3f08c33dd0c8070c427132919123925ed1d9fa28a43ca32e28
3
+ metadata.gz: 2b3dd60b08d2b1488b5fd6c88681f83cd37b46dd2eb0f27557ca4fb131928c9b
4
+ data.tar.gz: 442d3030455cadbcaa2e4fe0f97bc4631d9081194aff31c67242ec5675bc5f8e
5
5
  SHA512:
6
- metadata.gz: 8d2faaf09b6173c3d4c8d2a052f3377bdecfc3594a9fad426043296f8e2bc880519d528774e5481a5361414a32ee06082a6f5de55f6e15f0cf82718a6f87bda9
7
- data.tar.gz: f2230cf14ee341c776f617eb1eb592013d907efbf18db02ea570f6d210363b46dd5b40be7b901a82ceef3b609f1e3a6e5fcd4a443f7350aca1150734a7ee1984
6
+ metadata.gz: 2c199c7f7d79ca57833593e3bfbe2e47161875943aabef8247c9cabb7b35e5c22297b6b69f298fc2c3df8ee0e9c5f1d99dc6c41e8e90b979cddd205c2d4b91b6
7
+ data.tar.gz: f6e070723c2178c5b7e4907e43ae8fcf2a9f50611b37179fc618ffa220205382f01f8aaa907a0a0cea1bd2aa0e14baf623401678bebc5e7b5ccbc80f2f3f31eb
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.3.0] - 2024-08-21
4
+
5
+ - POSSIBLY BREAKING: Clear all position columns on a duplicate created with `dup`.
6
+
3
7
  ## [0.2.6] - 2024-08-21
4
8
 
5
9
  - Implement list healing so that existing lists can be fixed up when implementing `positioned` or if the list somehow gets corrupted.
data/README.md CHANGED
@@ -185,6 +185,10 @@ other_item.id # => 11
185
185
  item.update position: {after: 11}
186
186
  ```
187
187
 
188
+ ##### Duplicating (`dup`)
189
+
190
+ When you call `dup` on an instance in the list, all position columns on the duplicate will be set to `nil` so that when this duplicate is saved it will be added either to the end of the current scopes (if unchanged) or to the end of any new scopes. Of course you can then override the position of the duplicate before you save it if necessary.
191
+
188
192
  ##### Relative Positioning in Forms
189
193
 
190
194
  It can be tricky to provide the hash forms of relative positioning using Rails form helpers, but it is possible. We've declared a special `Struct` for you to use for this purpose.
@@ -1,3 +1,3 @@
1
1
  module Positioning
2
- VERSION = "0.2.6"
2
+ VERSION = "0.3.0"
3
3
  end
data/lib/positioning.rb CHANGED
@@ -65,6 +65,14 @@ module Positioning
65
65
  end
66
66
  end
67
67
  end
68
+
69
+ def initialize_dup(other)
70
+ super
71
+
72
+ self.class.positioning_columns.keys.each do |positioning_column|
73
+ send :"#{positioning_column}=", nil
74
+ end
75
+ end
68
76
  end
69
77
  end
70
78
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: positioning
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brendon Muir
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-21 00:00:00.000000000 Z
11
+ date: 2024-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport