effective_pages 3.8.2 → 3.8.4

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: 9f632bda6ecd6354cdc0b847273d858677aac6c00b4f65640d32a7c865394475
4
- data.tar.gz: d6b2974416a2b89cbe8452b22993d09f6b72757d786d0e33efd0730e1a4b54ab
3
+ metadata.gz: ab2014d3e00b7e610f9e4bbb783dc853d5eeb5a5c51215266d37c42d6435d453
4
+ data.tar.gz: 59c5957db1af495169511e34bd2b77b9da60574d16d8fabcde374738429c55eb
5
5
  SHA512:
6
- metadata.gz: 7379d77cdaeb8708ae2f6ddacef70d8aba038b2dcca2f040e63cfe721cd4a4933f785a92e2f846286704aad9134be78617dfd8ecfe63df6c41896c309b072d8d
7
- data.tar.gz: e6077d8018fb1505aafd84c98f5e727fe3d3275ca317f4eab5847246a65b3eb3ce6155cab046ae2bb403f56cd129b0e9dc30d82e2830a1aefd0a3a2688372296
6
+ metadata.gz: 71d6ef9905b0426c44b791e6422b6784e395bd776d3a346fee1609931769b5e9e2f2b5f63b5240e643d763394d6624ebf8089f5d59bb45d7f25f85071a1c74a7
7
+ data.tar.gz: 8d07252b5ba59072c8f078f394260da1ab6bd5b874f1ec9543f247c66528760b729a22c7cab542b66dbee7a402f64db929fc08ebf5baebfbe15deb1caa8f2eaa
@@ -3,7 +3,7 @@ module Effective
3
3
  include Effective::CrudController
4
4
 
5
5
  def show
6
- @pages = Effective::Page.all
6
+ @pages = Effective::Page.deep.all
7
7
  @pages = @pages.published unless EffectiveResources.authorized?(self, :admin, :effective_pages)
8
8
 
9
9
  @page = @pages.find(params[:id])
@@ -9,7 +9,7 @@ module EffectiveCarouselsHelper
9
9
  raise("unable to find carousel #{name}. Please add it to config/initializers/effective_pages.rb")
10
10
  end
11
11
 
12
- carousel_items = Effective::CarouselItem.sorted.where(carousel: carousel)
12
+ carousel_items = Effective::CarouselItem.sorted.deep.where(carousel: carousel)
13
13
  return if carousel_items.blank?
14
14
 
15
15
  if block_given?
@@ -28,7 +28,9 @@ module EffectiveMenusHelper
28
28
  (
29
29
  [content_tag(:li, link_to(root, root_path, title: root), class: 'breadcrumb-item')] +
30
30
  parents.map do |page|
31
- next if page.menu_root_with_children? # Don't show root pages becaues they have no content
31
+ page.try(:strict_loading!, false)
32
+
33
+ next if page.menu_root_with_children? # Don't show root pages because they have no content
32
34
 
33
35
  url = (page.menu_url.presence || effective_pages.page_path(page))
34
36
  content_tag(:li, link_to(page, url, title: page.title), class: 'breadcrumb-item')
@@ -60,7 +62,7 @@ module EffectiveMenusHelper
60
62
  def admin_menu_parent_collection(page = nil)
61
63
  raise('expected a page') if page.present? && !page.kind_of?(Effective::Page)
62
64
 
63
- pages = Effective::Page.menuable.root_level.where.not(id: page)
65
+ pages = Effective::Page.deep.menuable.root_level.where.not(id: page)
64
66
 
65
67
  if EffectivePages.max_menu_depth == 2
66
68
  # You can only select root level pages
@@ -8,9 +8,9 @@ module EffectivePageBannersHelper
8
8
  return unless page.banner? || EffectivePages.banners_force_randomize
9
9
 
10
10
  # Always return a random banner if config.banners_force_randomize
11
- page_banner = Effective::PageBanner.random.first if EffectivePages.banners_force_randomize
11
+ page_banner = Effective::PageBanner.deep.random.first if EffectivePages.banners_force_randomize
12
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
+ page_banner ||= Effective::PageBanner.deep.random.first if page.banner? && page.banner_random?
14
14
 
15
15
  return if page_banner.blank?
16
16
 
@@ -3,7 +3,7 @@
3
3
  module EffectivePageSectionsHelper
4
4
 
5
5
  def effective_page_sections
6
- @_effective_page_sections ||= Effective::PageSection.all
6
+ @_effective_page_sections ||= Effective::PageSection.deep.all
7
7
  end
8
8
 
9
9
  def render_page_section(name, &block)
@@ -58,7 +58,11 @@ module Effective
58
58
  timestamps
59
59
  end
60
60
 
61
- scope :deep, -> { includes(:page_banner, :menu_parent, menu_children: :menu_parent) }
61
+ scope :deep, -> {
62
+ base = includes(:page_banner, :tags, :rich_texts, :menu_parent, menu_children: [:menu_parent, :menu_children])
63
+ base = base.includes(:pg_search_document) if defined?(PgSearch)
64
+ base
65
+ }
62
66
 
63
67
  scope :draft, -> { where(draft: true) }
64
68
  scope :published, -> { where(draft: false) }
@@ -16,7 +16,11 @@ module Effective
16
16
 
17
17
  log_changes if respond_to?(:log_changes)
18
18
 
19
- scope :deep, -> { with_attached_attachment }
19
+ scope :deep, -> {
20
+ base = with_attached_attachment
21
+ base = base.includes(:pg_search_document) if defined?(PgSearch)
22
+ base
23
+ }
20
24
 
21
25
  effective_resource do
22
26
  title :string
@@ -6,9 +6,12 @@
6
6
  = nav_link_to(page.menu_to_s, (page.menu_url.presence || effective_pages.page_path(page)))
7
7
 
8
8
  - # if this is a third depth page, show the parent and siblings
9
- - if !page.menu_children.present? && page.menu_parent.present? && page.menu_parent&.menu_children&.present? && page.menu_parent&.menu_parent.present?
10
- - children = page.menu_parent.menu_children
11
- = nav_link_to(page.menu_parent.menu_to_s, (page.menu_parent.menu_url.presence || effective_pages.page_path(page.menu_parent)))
9
+ - if page.menu_children.blank? && page.menu_parent.try(:menu_parent_id).present?
10
+ - page.menu_parent.try(:strict_loading!, false)
11
+
12
+ - if page.menu_parent.menu_children.present?
13
+ - children = page.menu_parent.menu_children
14
+ = nav_link_to(page.menu_parent.menu_to_s, (page.menu_parent.menu_url.presence || effective_pages.page_path(page.menu_parent)))
12
15
 
13
16
  - children.each do |page|
14
17
  - next unless EffectiveResources.authorized?(self, :show, page)
@@ -1,3 +1,3 @@
1
1
  module EffectivePages
2
- VERSION = '3.8.2'.freeze
2
+ VERSION = '3.8.4'.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.8.2
4
+ version: 3.8.4
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: 2023-09-29 00:00:00.000000000 Z
11
+ date: 2023-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails