Module: Decidim::Conferences::ConferenceHelper

Includes:
PaginateHelper
Included in:
ConferenceDropdownMetadataCell
Defined in:
decidim-conferences/app/helpers/decidim/conferences/conference_helper.rb

Instance Method Summary collapse

Methods included from PaginateHelper

#decidim_paginate, #per_page

Instance Method Details

#conference_nav_items(participatory_space) ⇒ Object

Items to display in the navigation of a conference



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'decidim-conferences/app/helpers/decidim/conferences/conference_helper.rb', line 19

def conference_nav_items(participatory_space)
  [].tap do |items|
    if participatory_space.speakers.exists?
      items << {
        name: t("layouts.decidim.conferences_nav.conference_speaker_menu_item"),
        url: decidim_conferences.conference_conference_speakers_path(participatory_space)
      }
    end

    meeting_components = participatory_space.components.published.where(manifest_name: "meetings")
    other_components = participatory_space.components.published.where.not(manifest_name: "meetings")

    meeting_components.each do |component|
      next unless Decidim::Meetings::Meeting.where(component:).published.not_hidden.visible_for(current_user).exists?

      items << {
        name: translated_attribute(component.name),
        url: decidim_conferences.conference_conference_program_path(participatory_space, id: component.id)
      }
    end

    if participatory_space.partners.exists?
      items << {
        name: t("layouts.decidim.conferences_nav.conference_partners_menu_item"),
        url: decidim_conferences.conference_path(participatory_space, anchor: "conference-partners-main_promotor")
      }
    end

    if meeting_components.exists?
      items << {
        name: t("layouts.decidim.conferences_nav.venues"),
        url: decidim_conferences.conference_path(participatory_space, anchor: "venues")
      }
    end

    other_components.each do |component|
      items << {
        name: translated_attribute(component.name),
        url: main_component_path(component)
      }
    end

    if participatory_space.attachments.any? || participatory_space.media_links.any?
      items << {
        name: t("layouts.decidim.conferences_nav.media"),
        url: decidim_conferences.conference_media_path(participatory_space)
      }
    end
  end
end

#render_date(conference) ⇒ Object

Renders the dates of a conference



11
12
13
14
15
# File 'decidim-conferences/app/helpers/decidim/conferences/conference_helper.rb', line 11

def render_date(conference)
  return l(conference.start_date, format: :decidim_with_month_name_short) if conference.start_date == conference.end_date

  "#{l(conference.start_date, format: :decidim_with_month_name_short)} - #{l(conference.end_date, format: :decidim_with_month_name_short)}"
end