effective_pages 3.14.4 → 3.14.6

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: 1f4ca8ad0bb1bb831be0f03301313fa887bc919fccec2b11165a3a9afcc51996
4
- data.tar.gz: 8b2c1fae2b168203653bbf329bc782564cd550a128d04c6263038d96a34b266b
3
+ metadata.gz: eaa8fa16930701d59907b95e1711b018273713f83a0fde69db62a7ef3016db2b
4
+ data.tar.gz: 2957e3144f68a3787fac56ab20e5b125592862ad56773421cf5d2208a28eadef
5
5
  SHA512:
6
- metadata.gz: cbe18e31381ce52238a75dd3161ad255260f6da6b5a9323a19f93d78e8f7ac37c2160f36b71732bc477c5fd9e48d044841484d3f97a85402cd8e9f72a1d5916e
7
- data.tar.gz: ef30e6d96b2567ecae882c171896f47f775dda75ff2cc6650556dcaef448488f382082073c2adbd37c444a7d8692b17560a3f078a4b53a1f7186c642bbcbcbf3
6
+ metadata.gz: 5ee8094a1694cc7faeb8f8a21aeb17c95e9985168ec80473bba8c9ba3ab4f80a11c42de665a30549e7ba7920ddd18982f1b8e1dd1412194f731de17a0a7cc214
7
+ data.tar.gz: a24ba93db402e1f28bfeaaef1ef57239cee11e56bd25a5d53d0c56e1ccc549949548b37b37857eaec653a49faaf6ba0363490520031530ee6afabbd59bbb7711
@@ -8,7 +8,7 @@ class EffectivePagesMenuDatatable < Effective::Datatable
8
8
  end
9
9
 
10
10
  col :title do |page|
11
- link_to(page, effective_pages.edit_admin_page_path(page))
11
+ link_to(page.menu_to_s, effective_pages.edit_admin_page_path(page))
12
12
  end
13
13
 
14
14
  col :menu_url, label: 'Redirect Url'
@@ -47,12 +47,12 @@ module Effective
47
47
 
48
48
  validate(if: -> { carousel.present? && EffectivePages.carousels? }) do
49
49
  unless (carousels = EffectivePages.carousels).find { |c| c.to_s == carousel.to_s }.present?
50
- self.errors.add(:carousel, "must be one of #{carousels.to_sentence}")
50
+ errors.add(:carousel, "must be one of #{carousels.to_sentence}")
51
51
  end
52
52
  end
53
53
 
54
54
  validate(if: -> { file.attached? }) do
55
- self.errors.add(:file, 'must be an image') unless file.image?
55
+ errors.add(:file, 'must be an image') unless file.image?
56
56
  end
57
57
 
58
58
  def to_s
@@ -115,7 +115,7 @@ module Effective
115
115
 
116
116
  validate(if: -> { menu_url.present? }) do
117
117
  unless menu_url.start_with?('http://') || menu_url.start_with?('https://') || menu_url.start_with?('/')
118
- self.errors.add(:menu_url, "must start with http(s):// or /")
118
+ errors.add(:menu_url, "must start with http(s):// or /")
119
119
  end
120
120
  end
121
121
 
@@ -132,8 +132,8 @@ module Effective
132
132
 
133
133
  validate(if: -> { banner? && EffectivePages.banners? }) do
134
134
  unless (page_banner.present? ^ banner_random? ^ EffectivePages.banners_force_randomize) # xor
135
- self.errors.add(:page_banner_id, "please select a page banner or random")
136
- self.errors.add(:banner_random, "please select a page banner or random")
135
+ errors.add(:page_banner_id, "please select a page banner or random")
136
+ errors.add(:banner_random, "please select a page banner or random")
137
137
  end
138
138
  end
139
139
 
@@ -32,7 +32,7 @@ module Effective
32
32
  validates :file, presence: true, content_type: :image, size: { less_than: 1.megabyte }
33
33
 
34
34
  validate(if: -> { file.attached? }) do
35
- self.errors.add(:file, 'must be an image') unless file.image?
35
+ errors.add(:file, 'must be an image') unless file.image?
36
36
  end
37
37
 
38
38
  def to_s
@@ -50,6 +50,10 @@ module Effective
50
50
  "/link/#{slug}"
51
51
  end
52
52
 
53
+ def published?
54
+ true
55
+ end
56
+
53
57
  def target
54
58
  url.present? ? :url : :attachment
55
59
  end
@@ -58,7 +62,7 @@ module Effective
58
62
 
59
63
  def attachment_and_url_cannot_both_be_present
60
64
  if url.present? && (attachment.attached? && !attachment.marked_for_destruction?)
61
- self.errors.add(:base, 'Attachment and URL cannot both be present')
65
+ errors.add(:base, 'Attachment and URL cannot both be present')
62
66
  end
63
67
  end
64
68
  end
@@ -27,7 +27,10 @@
27
27
  = f.text_field :menu_url, label: "Redirect to path or url instead of displaying page",
28
28
  hint: "Must start with http(s):// or /"
29
29
 
30
- = effective_submit(f)
30
+ - if inline_datatable?
31
+ = f.submit 'Save'
32
+ - else
33
+ = effective_submit(f)
31
34
 
32
35
  - if page.menu_parent.present?
33
36
  .mb-4
@@ -39,6 +39,10 @@ class CreateEffectivePages < ActiveRecord::Migration[6.0]
39
39
  end
40
40
 
41
41
  add_index :pages, :slug, :unique => true
42
+ add_index :pages, [:published_start_at, :published_end_at], if_not_exists: true
43
+ add_index :pages, :menu, if_not_exists: true
44
+ add_index :pages, :menu_parent_id, if_not_exists: true
45
+ add_index :pages, :menu_position, if_not_exists: true
42
46
 
43
47
  create_table :page_banners do |t|
44
48
  t.string :name
@@ -89,6 +93,9 @@ class CreateEffectivePages < ActiveRecord::Migration[6.0]
89
93
  t.timestamps
90
94
  end
91
95
 
96
+ add_index :carousel_items, :carousel, if_not_exists: true
97
+ add_index :carousel_items, :position, if_not_exists: true
98
+
92
99
  create_table :alerts, if_not_exists: true do |t|
93
100
  t.boolean :enabled
94
101
 
@@ -118,6 +125,9 @@ class CreateEffectivePages < ActiveRecord::Migration[6.0]
118
125
 
119
126
  t.timestamps
120
127
  end
128
+
129
+ add_index :taggings, [:taggable_type, :taggable_id], if_not_exists: true
130
+ add_index :taggings, :tag_id, if_not_exists: true
121
131
  end
122
132
 
123
133
  end
@@ -1,3 +1,3 @@
1
1
  module EffectivePages
2
- VERSION = '3.14.4'.freeze
2
+ VERSION = '3.14.6'.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.14.4
4
+ version: 3.14.6
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-04-24 00:00:00.000000000 Z
11
+ date: 2025-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails