effective_pages 3.8.3 → 3.8.4

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: 93461d891693d48f4a9610dc33406c38620c9b8470ef64cd0953e7c31f45ef7c
4
- data.tar.gz: 9f0ae01994f41320788d6b183be99860d23a4103cdff78a8314fcf610e65b28a
3
+ metadata.gz: ab2014d3e00b7e610f9e4bbb783dc853d5eeb5a5c51215266d37c42d6435d453
4
+ data.tar.gz: 59c5957db1af495169511e34bd2b77b9da60574d16d8fabcde374738429c55eb
5
5
  SHA512:
6
- metadata.gz: c10f7ec96802a69effc73b984362c5147aeb1cc2f96e5a871b059542938b91de525f5cb42f06c0e58828b5eac966362f21ca8f0da0ff9dcc37b224cb05f44805
7
- data.tar.gz: 47527c78afcf1dc278acf6ddd87db09bf319f6e7d36128fbe586e2c67d822316813b13d37377806d3cf8a78bf856b49ef7aa5016fd004d7dc6c2004f640ff2d2
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])
@@ -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
 
@@ -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.3'.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.3
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-11-28 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