effective_pages 3.15.1 → 3.15.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: ed9ffe173d713a8999837028219fca1ce882f4f03580183dcd4ddf4135948dfe
4
- data.tar.gz: f5ca5181a12892ef012a7406a7ccb376c4cab15736d11fa8177e0ca5081602f3
3
+ metadata.gz: 9c15c21f3cd1941786d5bec4494310c3b1f033b705b361ae97e9d2e167e2a6bc
4
+ data.tar.gz: b182a6098137f87569c419422d7ab4d56cc87fdcab8b8ffd5a141ae1d328efc7
5
5
  SHA512:
6
- metadata.gz: 13682af4c80831be3220bd2d23916642af4ebd476a4d4d2e1451bb522e063e7530ae84d8553c8c859eff842878ceb383790ec8bfa20a8baff7fd42acef808759
7
- data.tar.gz: 388b9768973107d126abaecba4a521ef2cc9cdea3bec045d4e9a6d2e1930dbed6d2d01aabfbe9ff06e28057aa7bd9a750f9a90c1d309aba169d86dba5705572b
6
+ metadata.gz: 564455b16775f6c5fef7ac1a2ada3a572a17802331da02708fa6074b48a566d246e9f8a4b974e73a5e93d9fd5675227efff1c895d7aced7a41064018392bf70e
7
+ data.tar.gz: c8411cb3c5812fc74ec71a46f428b6f59757f895de8acf50b2d9acb856c524e53260f5c5dfa62a3dc588d338475af92151c432ecdc7ff4f7ce12dde04be6de4a
@@ -6,16 +6,15 @@ class EffectiveCarouselItemsDatatable < Effective::Datatable
6
6
  col :id, visible: false
7
7
  col :updated_at, visible: false
8
8
 
9
- col :carousel
10
- col :title
11
-
12
- col :title
13
- col :rich_text_body, label: 'Content'
9
+ col :carousel, visible: false
14
10
 
15
11
  col :file, label: 'Image' do |carousel_item|
16
12
  image_tag(carousel_item.file, style: 'max-height: 100px;')
17
13
  end
18
14
 
15
+ col :title
16
+ col :rich_text_body, label: 'Content'
17
+
19
18
  col :link_label, visible: false
20
19
  col :link_url, visible: false
21
20
  col :caption, visible: false
@@ -33,7 +33,12 @@ module Effective
33
33
  scope :sorted, -> { order(:position, :id) }
34
34
 
35
35
  before_validation(if: -> { carousel.present? }) do
36
- self.position ||= (self.class.where(carousel: carousel).pluck(:position).compact.max || -1) + 1
36
+ self.position ||= 0
37
+ end
38
+
39
+ # Insert at top of the list
40
+ before_save(if: -> { new_record? }) do
41
+ self.class.where(carousel: carousel).where.not(id: id).update_all("position = position + 1")
37
42
  end
38
43
 
39
44
  validates :carousel, presence: true
@@ -1,3 +1,3 @@
1
1
  module EffectivePages
2
- VERSION = '3.15.1'.freeze
2
+ VERSION = '3.15.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_pages
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.15.1
4
+ version: 3.15.2
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: 2025-07-31 00:00:00.000000000 Z
11
+ date: 2025-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails