effective_pages 3.4.0 → 3.4.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 +4 -4
- data/app/controllers/admin/carousel_items_controller.rb +2 -0
- data/app/controllers/admin/menus_controller.rb +3 -0
- data/app/datatables/effective_page_sections_datatable.rb +1 -1
- data/app/helpers/effective_page_banners_helper.rb +5 -4
- data/app/models/effective/page.rb +1 -1
- data/app/views/admin/carousel_items/_form_carousel_item.html.haml +4 -4
- data/app/views/admin/carousel_items/index.html.haml +4 -10
- data/app/views/admin/menus/index.html.haml +4 -10
- data/app/views/admin/page_banners/_form_page_banner.html.haml +3 -4
- data/app/views/admin/page_sections/_form_page_section.html.haml +2 -1
- data/app/views/admin/pages/_form_page.html.haml +15 -6
- data/config/effective_pages.rb +3 -0
- data/lib/effective_pages/version.rb +1 -1
- data/lib/effective_pages.rb +1 -1
- metadata +2 -2
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
|
@@ -3,8 +3,11 @@ module Admin
|
|
3
3
|
before_action(:authenticate_user!) if defined?(Devise)
|
4
4
|
before_action { EffectiveResources.authorize!(self, :admin, :effective_pages) }
|
5
5
|
|
6
|
+
|
6
7
|
include Effective::CrudController
|
7
8
|
|
9
|
+
page_title 'Menus'
|
10
|
+
|
8
11
|
resource_scope -> { Effective::Page.all }
|
9
12
|
|
10
13
|
if (config = EffectivePages.layout)
|
@@ -8,13 +8,13 @@ class EffectivePageSectionsDatatable < Effective::Datatable
|
|
8
8
|
col :updated_at, visible: false
|
9
9
|
|
10
10
|
col :name
|
11
|
-
col :hint
|
12
11
|
|
13
12
|
col :title
|
14
13
|
col :rich_text_body
|
15
14
|
|
16
15
|
col :file
|
17
16
|
|
17
|
+
col :hint, visible: false
|
18
18
|
col :link_label, visible: false
|
19
19
|
col :link_url, visible: false
|
20
20
|
col :caption, visible: false
|
@@ -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
|
@@ -7,15 +7,15 @@
|
|
7
7
|
= f.text_field :title
|
8
8
|
|
9
9
|
- if defined?(EffectiveArticleEditor)
|
10
|
-
= f.article_editor :rich_text_body, label: 'Body'
|
10
|
+
= f.article_editor :rich_text_body, label: 'Body'
|
11
11
|
- else
|
12
|
-
= f.rich_text_area :rich_text_body, label: 'Body'
|
12
|
+
= f.rich_text_area :rich_text_body, label: 'Body'
|
13
13
|
|
14
14
|
.row
|
15
15
|
.col= f.text_field :link_label
|
16
16
|
.col= f.url_field :link_url
|
17
17
|
|
18
|
-
= f.file_field :file, label: 'Image
|
19
|
-
= f.text_field :caption, hint: '
|
18
|
+
= f.file_field :file, label: 'Image attachment', hint: EffectivePages.carousels_hint_text
|
19
|
+
= f.text_field :caption, hint: 'Optional'
|
20
20
|
|
21
21
|
= effective_submit(f)
|
@@ -1,11 +1,5 @@
|
|
1
|
-
%h1= @page_title
|
2
|
-
|
3
|
-
%p
|
4
|
-
Click Reorder to drag & drop reorder carousel items.
|
5
|
-
Edit an item to change its content.
|
6
|
-
|
7
1
|
- EffectivePages.carousels.each do |carousel|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
2
|
+
.bg-white.my-5.p-3.rounded
|
3
|
+
%h3.mb-0 #{carousel.to_s.titleize} Carousel
|
4
|
+
- datatable = EffectiveCarouselItemsDatatable.new(carousel: carousel)
|
5
|
+
= render_datatable(datatable, simple: true, inline: true)
|
@@ -1,11 +1,5 @@
|
|
1
|
-
%h1= @page_title
|
2
|
-
|
3
|
-
%p
|
4
|
-
Click Reorder to drag & drop reorder menu items.
|
5
|
-
Edit an item to reorder its children items.
|
6
|
-
|
7
1
|
- EffectivePages.menus.each do |menu|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
2
|
+
.bg-white.my-5.p-3.rounded
|
3
|
+
%h3.mb-0 #{menu.to_s.titleize} Menu
|
4
|
+
- datatable = EffectivePagesMenuDatatable.new(menu: menu)
|
5
|
+
= render_datatable(datatable, simple: true, inline: true)
|
@@ -1,8 +1,7 @@
|
|
1
1
|
= effective_form_with(model: [:admin, page_banner], engine: true) do |f|
|
2
|
-
= f.text_field :name, hint: 'The name of this banner
|
3
|
-
|
4
|
-
= f.
|
5
|
-
= f.text_field :caption, hint: 'Displayed alongside the image'
|
2
|
+
= f.text_field :name, hint: 'The name of this banner, used only for reference'
|
3
|
+
= f.file_field :file, label: 'Image attachment', hint: EffectivePages.banners_hint_text
|
4
|
+
= f.text_field :caption, hint: 'Optional. Displayed alongside the image'
|
6
5
|
|
7
6
|
-# - if defined?(EffectiveArticleEditor)
|
8
7
|
-# = f.article_editor :rich_text_body, label: 'Body', hint: 'The main content'
|
@@ -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,10 +63,13 @@ 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()
|
67
|
+
config.banners_hint_text = 'Hint text that includes required image dimensions'
|
66
68
|
|
67
69
|
# Page Carousels
|
68
70
|
# The menu names a page can belong to
|
69
71
|
config.carousels = false
|
70
72
|
# config.carousels = [:home, :secondary]
|
73
|
+
config.carousels_hint_text = 'Hint text that includes required image dimensions'
|
71
74
|
|
72
75
|
end
|
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,
|
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
|