effective_pages 3.9.0 → 3.10.1
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: e25596768c6b274d44a143a0c4b2733c4608ff8c058282c2d22e65e05486ec09
|
4
|
+
data.tar.gz: 03d2c179fe08a3ec54ef864d2e274350dc209df18925a1b3d2878491673d7ede
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3f38c4d20be9133ee318eecf8336753f8494d3fdb7ed82f6f5060e2efea267c49d6025eb3cbe385c3ec4f67b88374ff0d42fa7d721cf9dda8af1ad7701db43c
|
7
|
+
data.tar.gz: 310a83a4fd981312cfcdf48cdf7c2fcad3caeba517e82047b4d497ee610927bf7b6c61ce934fe12cdbb783271a40d856e598a673cae86fc3d3e2819431bf2965
|
@@ -1,23 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module EffectiveCarouselsHelper
|
3
3
|
|
4
|
-
def render_carousel(name,
|
5
|
-
|
6
|
-
carousel = Array(EffectivePages.carousels).find { |carousel| carousel.to_s == name }
|
4
|
+
def render_carousel(name, carousel_options = {})
|
5
|
+
carousel = Array(EffectivePages.carousels).find { |carousel| carousel.to_s == name.to_s }
|
7
6
|
|
8
7
|
if carousel.blank?
|
9
8
|
raise("unable to find carousel #{name}. Please add it to config/initializers/effective_pages.rb")
|
10
9
|
end
|
11
10
|
|
12
|
-
|
13
|
-
return if carousel_items.blank?
|
14
|
-
|
15
|
-
if block_given?
|
16
|
-
yield(carousel_items); nil
|
17
|
-
else
|
18
|
-
render('effective/carousels/carousel', carousel: carousel, carousel_items: carousel_items, carousel_options: options)
|
19
|
-
end
|
20
|
-
|
11
|
+
render('effective/carousels/carousel', carousel: carousel, carousel_options: carousel_options)
|
21
12
|
end
|
22
13
|
|
23
14
|
end
|
@@ -1,27 +1,27 @@
|
|
1
|
-
|
2
|
-
-
|
1
|
+
= cache([carousel, Effective::CarouselItem.maximum(:updated_at)]) do
|
2
|
+
- carousel_items = Effective::CarouselItem.sorted.deep.where(carousel: carousel).to_a
|
3
|
+
- uid = "effective-carousel-#{carousel}-#{Time.zone.now.to_i}"
|
3
4
|
|
4
|
-
-
|
5
|
+
- if carousel_items.present?
|
6
|
+
.carousel.slide{id: uid, 'data-ride': 'carousel', **carousel_options}
|
7
|
+
%ol.carousel-indicators
|
8
|
+
- carousel_items.each_with_index do |item, index|
|
9
|
+
%li{'data-target': '#' + uid, 'data-slide-to': index, class: ('active' if index == 0)}
|
5
10
|
|
6
|
-
.carousel
|
7
|
-
|
8
|
-
|
9
|
-
|
11
|
+
.carousel-inner
|
12
|
+
- carousel_items.each_with_index do |item, index|
|
13
|
+
.carousel-item{class: ('active' if index == 0)}
|
14
|
+
- if item.caption.blank?
|
15
|
+
= image_tag(item.file, class: 'd-block w-100', alt: "Slide #{index+1}")
|
16
|
+
- else
|
17
|
+
= image_tag(item.file, alt: item.caption)
|
18
|
+
.carousel-caption.d-none.d-md-block
|
19
|
+
%p= item.caption
|
10
20
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
- if item.caption.blank?
|
15
|
-
= image_tag(item.file, class: 'd-block w-100', alt: "Slide #{index+1}")
|
16
|
-
- else
|
17
|
-
= image_tag(item.file, alt: item.caption)
|
18
|
-
.carousel-caption.d-none.d-md-block
|
19
|
-
%p= item.caption
|
21
|
+
%button.carousel-control-prev{'data-target': '#' + uid, type: 'button', 'data-slide': 'prev'}
|
22
|
+
%span.carousel-control-prev-icon{'aria-hidden': true}
|
23
|
+
%span.sr-only Previous
|
20
24
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
%button.carousel-control-next{'data-target': '#' + uid, type: 'button', 'data-slide': 'next'}
|
26
|
-
%span.carousel-control-next-icon{'aria-hidden': true}
|
27
|
-
%span.sr-only Next
|
25
|
+
%button.carousel-control-next{'data-target': '#' + uid, type: 'button', 'data-slide': 'next'}
|
26
|
+
%span.carousel-control-next-icon{'aria-hidden': true}
|
27
|
+
%span.sr-only Next
|
@@ -1,21 +1,22 @@
|
|
1
1
|
- raise('expected a menu') unless menu.present?
|
2
2
|
- menu = menu.to_s
|
3
3
|
|
4
|
-
|
5
|
-
-
|
6
|
-
-
|
7
|
-
|
8
|
-
|
4
|
+
= cache([menu, current_user, Effective::Page.maximum(:updated_at)]) do
|
5
|
+
- # Renders menu_root? level pages and their immediate children
|
6
|
+
- Effective::Page.for_menu_root(menu).each do |page|
|
7
|
+
- next unless EffectiveResources.authorized?(self, :show, page)
|
8
|
+
- next if (page.authenticate_user || page.roles.present?) && current_user.blank?
|
9
|
+
- next if page.roles.present? && (current_user.roles & page.roles).blank?
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
11
|
+
- if page.menu_children_blank?
|
12
|
+
= nav_link_to(page.menu_to_s, (page.menu_url.presence || effective_pages.page_path(page)))
|
13
|
+
- else
|
14
|
+
= nav_dropdown(page.menu_to_s, groups: true) do
|
15
|
+
- page.menu_children.group_by { |menu| menu.menu_group.presence }.each do |menu_group, pages|
|
16
|
+
= nav_dropdown_group(menu_group || '') do
|
17
|
+
- pages.each do |page|
|
18
|
+
- next unless EffectiveResources.authorized?(self, :show, page)
|
19
|
+
- next if (page.authenticate_user || page.roles.present?) && current_user.blank?
|
20
|
+
- next if page.roles.present? && (current_user.roles & page.roles).blank?
|
20
21
|
|
21
|
-
|
22
|
+
= nav_link_to(page.menu_to_s, (page.menu_url.presence || effective_pages.page_path(page)))
|
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
|
+
version: 3.10.1
|
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:
|
11
|
+
date: 2024-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|