effective_pages 3.3.0 → 3.3.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: 2620fbfec6b912fd31b7d9821fe5ef73eecbfb4c509063883f8c144a2aa66d30
4
- data.tar.gz: d75935c05702f1328e32058f45874999a3b3b3f7f7becab1202c4d18b9dee743
3
+ metadata.gz: e3ef36f0fae90cb4172cbc5541abbac53d632e611024fc1b3febd6fc8476cafd
4
+ data.tar.gz: ed784ec8c9575641c5803450d5664b5d11cf90aab89d73163c4d86e28448f66e
5
5
  SHA512:
6
- metadata.gz: 9dd4484e144bbbb2287dc399eb93bbae86b423c05fea8ca0bd0f7d5f716e384ebc1d935eef964166517b6358d1565f539c32894d6a2992e851a3e2d9104a6192
7
- data.tar.gz: f1fa33f1bd839164cb281f23a3439f4d624458120061d7aeb7a0c2e16703d7b46d7043ae4abaf4878cea8bbf65e5a8a0710a02c00fbe0c8185f9df28e1e3e46c
6
+ metadata.gz: 6afc63a6a120d7b67d872ab985f990d0db4117b12a7e0ae1bf79a2451c00fdcf89e18e8c2a3c58d22344f3a0190e0fc9cf11589b11c01e57f8fbf7798fee12cb
7
+ data.tar.gz: 38786d89a2341773f87bb122d9b64f26e7778d23c97dee10ee04d1b846b09331e9266acc7b156e6e8bd62dd249d58af64d465454d564d8cca958688ca8ca753c
@@ -18,10 +18,10 @@ class EffectivePagesMenuDatatable < Effective::Datatable
18
18
  col :menu_children, label: 'Children' do |page|
19
19
  page.menu_children.group_by(&:menu_group).values.flatten.map do |child|
20
20
  content_tag(:div, class: 'col-resource_item') do
21
- link = link_to(child.admin_menu_label, effective_pages.edit_admin_page_path(child))
21
+ link = link_to(child.menu_to_s, effective_pages.edit_admin_page_path(child))
22
22
 
23
23
  list = child.menu_children.group_by(&:menu_group).values.flatten.map do |child|
24
- content_tag(:li, link_to(child.admin_menu_label, effective_pages.edit_admin_page_path(child)))
24
+ content_tag(:li, link_to(child.menu_to_s, effective_pages.edit_admin_page_path(child)))
25
25
  end
26
26
 
27
27
  link + (content_tag(:ul, list.join.html_safe) if list.present?).to_s
@@ -28,8 +28,10 @@ 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
32
+
31
33
  url = (page.menu_url.presence || effective_pages.page_path(page))
32
- content_tag(:li, link_to(page, (page.menu_root_with_children? ? '#' : url), title: page.title), class: 'breadcrumb-item')
34
+ content_tag(:li, link_to(page, url, title: page.title), class: 'breadcrumb-item')
33
35
  end +
34
36
  [content_tag(:li, page, class: 'breadcrumb-item active', 'aria-current': 'page')]
35
37
  ).join.html_safe
@@ -6,7 +6,7 @@ module Effective
6
6
  belongs_to :owner, polymorphic: true, optional: true
7
7
 
8
8
  has_many_rich_texts
9
- has_many_attached :files
9
+ has_one_attached :file
10
10
 
11
11
  log_changes if respond_to?(:log_changes)
12
12
 
@@ -32,7 +32,7 @@ module Effective
32
32
  validates :link_url, presence: true, if: -> { link_label.present? }
33
33
  validates :link_url, absence: true, if: -> { link_label.blank? }
34
34
 
35
- scope :deep, -> { with_attached_files.includes(:rich_texts) }
35
+ scope :deep, -> { with_attached_file.includes(:rich_texts) }
36
36
  scope :sorted, -> { order(:name) }
37
37
 
38
38
  def to_s
@@ -18,7 +18,7 @@
18
18
  .col= f.text_field :link_label
19
19
  .col= f.url_field :link_url
20
20
 
21
- = f.file_field :files, label: 'Attachment'
21
+ = f.file_field :file, label: 'Attachment'
22
22
 
23
23
  = f.text_field :caption
24
24
 
@@ -1,17 +1,18 @@
1
1
  - raise('expected a page') unless page.present?
2
2
 
3
- - menu_children = page.menu_children
3
+ - children = page.menu_children
4
4
 
5
- - if menu_children.blank? && page.menu_parent&.menu_children.present?
6
- - menu_children = page.menu_parent&.menu_children
5
+ - if page.menu_children.present?
6
+ = nav_link_to(page.menu_to_s, (page.menu_url.presence || effective_pages.page_path(page)))
7
7
 
8
- - menu_children.group_by(&:menu_group).each do |menu_group, pages|
9
- - if menu_group.present?
10
- %h6= menu_group
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)))
11
12
 
12
- - pages.each do |page|
13
- - next unless EffectiveResources.authorized?(self, :show, page)
14
- - next if (page.authenticate_user || page.roles.present?) && current_user.blank?
15
- - next if page.roles.present? && (current_user.roles & page.roles).blank?
13
+ - children.each do |page|
14
+ - next unless EffectiveResources.authorized?(self, :show, page)
15
+ - next if (page.authenticate_user || page.roles.present?) && current_user.blank?
16
+ - next if page.roles.present? && (current_user.roles & page.roles).blank?
16
17
 
17
- = nav_link_to(page.menu_to_s, (page.menu_url.presence || effective_pages.page_path(page)))
18
+ = nav_link_to(page.menu_to_s, (page.menu_url.presence || effective_pages.page_path(page)))
@@ -1,3 +1,3 @@
1
1
  module EffectivePages
2
- VERSION = '3.3.0'.freeze
2
+ VERSION = '3.3.2'.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.3.0
4
+ version: 3.3.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-07 00:00:00.000000000 Z
11
+ date: 2022-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails