Module: Spina::Conferences::PrimerTheme::ApplicationHelper
- Includes:
- PagesHelper
- Defined in:
- app/helpers/spina/conferences/primer_theme/application_helper.rb
Overview
Base helper
Instance Method Summary collapse
- #ancestors ⇒ Object
- #calendar(name:) ⇒ Object
-
#current_conference ⇒ Object
Because the upper bound is exclusive a conference is current the day after it ends.
Instance Method Details
#ancestors ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'app/helpers/spina/conferences/primer_theme/application_helper.rb', line 15 def ancestors return [] if current_page.blank? render Primer::BreadcrumbComponent.new(mb: 4) do |component| current_page.ancestors.each do |ancestor| component.item(href: ancestor.materialized_path) { ancestor. } end component.item(selected: true) { current_page. } end end |
#calendar(name:) ⇒ Object
26 27 28 29 30 31 32 |
# File 'app/helpers/spina/conferences/primer_theme/application_helper.rb', line 26 def calendar(name:) Icalendar::Calendar.new .tap { |calendar| calendar.x_wr_calname = name } .tap { |calendar| yield(calendar) } .tap(&:publish) .then(&:to_ical) end |
#current_conference ⇒ Object
Because the upper bound is exclusive a conference is current the day after it ends
11 12 13 |
# File 'app/helpers/spina/conferences/primer_theme/application_helper.rb', line 11 def current_conference Spina::Admin::Conferences::Conference.order(dates: :asc).find_by('upper(dates) >= ?', Date.today) end |