effective_pages 3.4.1 → 3.4.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e671281634ffe553daa9e05de8737783dd3e75797e8f6cc8351c033195a3225
|
4
|
+
data.tar.gz: '03329baf24496ed2a2e1a6b2ec2a832ee6ca17b61be20f8ba22ce225d569262b'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7c5fd0aed362d4734239243c1858c55be641c4bef6793d92ca629e78f60fc7a3f2db81c22f7a13f3c3e064a103e8ea93dc50a878879a7b3705227f5fc9c055e
|
7
|
+
data.tar.gz: 80995b8e52e82f1d6fb13942e8395e74ea523b351d116ecde7ccf96e6be100df79d6e39c9bf458a4b8d5591392e4c77b605b598e394b394f7364fc8ccc485af0
|
@@ -5,11 +5,12 @@ module EffectivePageBannersHelper
|
|
5
5
|
def render_page_banner(page, opts = {}, &block)
|
6
6
|
raise('expected a page') unless page.kind_of?(Effective::Page)
|
7
7
|
|
8
|
-
|
9
|
-
return unless page.banner?
|
8
|
+
return unless page.banner? || EffectivePages.banners_force_randomize
|
10
9
|
|
11
|
-
|
12
|
-
page_banner
|
10
|
+
# Always return a random banner if config.banners_force_randomize
|
11
|
+
page_banner = Effective::PageBanner.random.first if EffectivePages.banners_force_randomize
|
12
|
+
page_banner ||= page.page_banner if page.banner? && page.page_banner.present?
|
13
|
+
page_banner ||= Effective::PageBanner.random.first if page.banner? && page.banner_random?
|
13
14
|
|
14
15
|
raise("unable to find page banner for page #{page}") unless page_banner.present?
|
15
16
|
|
@@ -97,7 +97,7 @@ module Effective
|
|
97
97
|
validates :menu_group, absence: true, if: -> { menu_root? && EffectivePages.menus.present? }
|
98
98
|
|
99
99
|
validate(if: -> { banner? && EffectivePages.banners? }) do
|
100
|
-
unless (page_banner.present? ^ banner_random?) # xor
|
100
|
+
unless (page_banner.present? ^ banner_random? ^ EffectivePages.banners_force_randomize) # xor
|
101
101
|
self.errors.add(:page_banner_id, "please select a page banner or random")
|
102
102
|
self.errors.add(:banner_random, "please select a page banner or random")
|
103
103
|
end
|
@@ -24,15 +24,24 @@
|
|
24
24
|
= f.text_field :slug, hint: "The slug controls this page's internet address. Be careful, changing the slug will break links that other websites may have to the old address.<br>#{('This page is currently reachable via ' + link_to(current_url.gsub(f.object.slug, '<strong>' + f.object.slug + '</strong>').html_safe, current_url)) if current_url }".html_safe
|
25
25
|
|
26
26
|
- if EffectivePages.banners?
|
27
|
-
|
27
|
+
- if EffectivePages.banners_force_randomize
|
28
|
+
= f.check_box :banner, label: 'Choose a page banner'
|
29
|
+
- else
|
30
|
+
= f.check_box :banner, label: 'Display a page banner on this page'
|
28
31
|
|
29
32
|
= f.show_if(:banner, true) do
|
30
|
-
= card
|
31
|
-
%p.text-muted
|
33
|
+
= card do
|
34
|
+
%p.text-muted
|
35
|
+
- if EffectivePages.banners_force_randomize
|
36
|
+
A random banner will always be displayed, or you may choose a specific banner below.
|
37
|
+
|
38
|
+
Please visit #{link_to('Page Banners', effective_pages.admin_page_banners_path)} to add or update the page banners.
|
39
|
+
|
40
|
+
- if !EffectivePages.banners_force_randomize
|
41
|
+
= f.check_box :banner_random, label: 'Display a random page banner. Ignored if you choose a page banner below.'
|
42
|
+
|
43
|
+
= f.select :page_banner_id, Effective::PageBanner.sorted.all, label: 'Choose a page banner'
|
32
44
|
|
33
|
-
= f.select :page_banner_id, Effective::PageBanner.sorted.all, label: 'Display this page banner'
|
34
|
-
%p - or -
|
35
|
-
= f.check_box :banner_random, label: 'Display a random page banner each time the page is refreshed'
|
36
45
|
|
37
46
|
= render partial: '/admin/pages/additional_fields', locals: { page: page, form: f, f: f }
|
38
47
|
|
data/config/effective_pages.rb
CHANGED
@@ -63,6 +63,7 @@ EffectivePages.setup do |config|
|
|
63
63
|
# Allow a page banner to be selected on the Admin::Pages#edit screen
|
64
64
|
# Banners can be CRUD by the admin
|
65
65
|
config.banners = false
|
66
|
+
config.banners_force_randomize = false # at least return a random banner with render_page_banner()
|
66
67
|
config.banners_hint_text = 'Hint text that includes required image dimensions'
|
67
68
|
|
68
69
|
# Page Carousels
|
data/lib/effective_pages.rb
CHANGED
@@ -12,7 +12,7 @@ module EffectivePages
|
|
12
12
|
:site_og_image, :site_og_image_width, :site_og_image_height,
|
13
13
|
:site_title, :site_title_suffix, :fallback_meta_description,
|
14
14
|
:silence_missing_page_title_warnings, :silence_missing_meta_description_warnings, :silence_missing_canonical_url_warnings,
|
15
|
-
:use_effective_roles, :layout, :max_menu_depth, :banners_hint_text, :carousels_hint_text,
|
15
|
+
:use_effective_roles, :layout, :max_menu_depth, :banners_hint_text, :carousels_hint_text, :banners_force_randomize,
|
16
16
|
|
17
17
|
# Booleans
|
18
18
|
:banners,
|
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.4.
|
4
|
+
version: 3.4.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: 2022-10-
|
11
|
+
date: 2022-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|