effective_pages 3.15.0 → 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: e0b5fff4b2c3aa603eaa0662c480e200c64c31fa0b71754b6fce98ee946b26b2
4
- data.tar.gz: 907df11e88aa7bd545146dcd60ba3f3b4bd5874d52d883b196ff5cb70cec0b09
3
+ metadata.gz: 9c15c21f3cd1941786d5bec4494310c3b1f033b705b361ae97e9d2e167e2a6bc
4
+ data.tar.gz: b182a6098137f87569c419422d7ab4d56cc87fdcab8b8ffd5a141ae1d328efc7
5
5
  SHA512:
6
- metadata.gz: 4806598309444219cff8af959ff90ff1ab1817a59caa7acd727f6f345f54f6578eabe4bf914baa3729073b528e1da7b4ad3f149ce1d22b59abee1484577716bb
7
- data.tar.gz: 16757879d021e4442c189740c3e586246169ebbf547cc51562db18fd795b86a44ccc9f924a6274ca53609e767fe4dba885ad3e6c7df4cf33cef648ec1fe13450
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
@@ -11,6 +11,9 @@ module EffectiveBannerAdsHelper
11
11
  raise("unknown banner ad location: #{location.presence || 'nil'}. Please add it to EffectivePages.banner_ads config option") if location.blank?
12
12
 
13
13
  banner_ads = effective_banner_ads.select { |ba| ba.location == location }
14
+ return if banner_ads.blank?
15
+
16
+ # Choose a random banner ad
14
17
  banner_ad = banner_ads.sample
15
18
 
16
19
  if block_given?
@@ -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.0'.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.0
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-29 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