Module: Decidim::Meetings::ApplicationHelper
- Includes:
- CheckBoxesTreeHelper, Comments::CommentsHelper, Decidim::MapHelper, MapHelper, RichTextEditorHelper, SanitizeHelper, PaginateHelper
- Included in:
- MeetingsHelper, PublicParticipantsListCell
- Defined in:
- app/helpers/decidim/meetings/application_helper.rb
Overview
Custom helpers, scoped to the meetings engine.
Instance Method Summary collapse
-
#activity_filter_values ⇒ Object
Options to filter meetings by activity.
- #filter_date_values ⇒ Object
- #filter_origin_values ⇒ Object
- #filter_type_values ⇒ Object
- #iframe_embed_or_live_event_page?(meeting) ⇒ Boolean
- #online_or_hybrid_meeting?(meeting) ⇒ Boolean
- #prevent_timeout_seconds ⇒ Object
-
#render_meeting_body(meeting) ⇒ Object
If the content is safe, HTML tags are sanitized, otherwise, they are stripped.
-
#safe_content? ⇒ Boolean
If the meeting is official or the rich text editor is enabled on the frontend, the meeting body is considered as safe content; that's unless the meeting comes from a collaborative_draft or a participatory_text.
Methods included from MapHelper
Instance Method Details
#activity_filter_values ⇒ Object
Options to filter meetings by activity.
52 53 54 55 56 57 |
# File 'app/helpers/decidim/meetings/application_helper.rb', line 52 def activity_filter_values [ ["all", t("decidim.meetings.meetings.filters.all")], ["my_meetings", t("decidim.meetings.meetings.filters.my_meetings")] ] end |
#filter_date_values ⇒ Object
43 44 45 46 47 48 49 |
# File 'app/helpers/decidim/meetings/application_helper.rb', line 43 def filter_date_values [ ["all", t("decidim.meetings.meetings.filters.date_values.all")], ["upcoming", t("decidim.meetings.meetings.filters.date_values.upcoming")], ["past", t("decidim.meetings.meetings.filters.date_values.past")] ] end |
#filter_origin_values ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/helpers/decidim/meetings/application_helper.rb', line 16 def filter_origin_values origin_values = [] origin_values << TreePoint.new("official", t("decidim.meetings.meetings.filters.origin_values.official")) origin_values << TreePoint.new("participants", t("decidim.meetings.meetings.filters.origin_values.participants")) # todo if current_organization.user_groups_enabled? origin_values << TreePoint.new("user_group", t("decidim.meetings.meetings.filters.origin_values.user_groups")) # todo end # if current_organization.user_groups_enabled? and component_settings enabled enabled TreeNode.new( TreePoint.new("", t("decidim.meetings.meetings.filters.origin_values.all")), origin_values ) end |
#filter_type_values ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/helpers/decidim/meetings/application_helper.rb', line 31 def filter_type_values type_values = [] Decidim::Meetings::Meeting::TYPE_OF_MEETING.each do |type| type_values << TreePoint.new(type, t("decidim.meetings.meetings.filters.type_values.#{type}")) end TreeNode.new( TreePoint.new("", t("decidim.meetings.meetings.filters.type_values.all")), type_values ) end |
#iframe_embed_or_live_event_page?(meeting) ⇒ Boolean
85 86 87 |
# File 'app/helpers/decidim/meetings/application_helper.rb', line 85 def (meeting) %w(embed_in_meeting_page open_in_live_event_page).include? meeting. end |
#online_or_hybrid_meeting?(meeting) ⇒ Boolean
81 82 83 |
# File 'app/helpers/decidim/meetings/application_helper.rb', line 81 def online_or_hybrid_meeting?(meeting) meeting.online_meeting? || meeting.hybrid_meeting? end |
#prevent_timeout_seconds ⇒ Object
71 72 73 74 75 76 77 78 79 |
# File 'app/helpers/decidim/meetings/application_helper.rb', line 71 def prevent_timeout_seconds return 0 unless respond_to?(:meeting) return 0 if !current_user || !meeting || !meeting.live? return 0 unless online_or_hybrid_meeting?(meeting) return 0 unless (meeting) return 0 unless meeting.iframe_access_level_allowed_for_user?(current_user) (meeting.end_time - Time.current).to_i end |
#render_meeting_body(meeting) ⇒ Object
If the content is safe, HTML tags are sanitized, otherwise, they are stripped.
67 68 69 |
# File 'app/helpers/decidim/meetings/application_helper.rb', line 67 def render_meeting_body(meeting) Decidim::ContentProcessor.render(render_sanitized_content(meeting, :description), "div") end |
#safe_content? ⇒ Boolean
If the meeting is official or the rich text editor is enabled on the frontend, the meeting body is considered as safe content; that's unless the meeting comes from a collaborative_draft or a participatory_text.
62 63 64 |
# File 'app/helpers/decidim/meetings/application_helper.rb', line 62 def safe_content? rich_text_editor_in_public_views? || @meeting.official? end |