Module: Decidim::Meetings::ApplicationHelper
- Includes:
- CheckBoxesTreeHelper, Comments::CommentsHelper, Decidim::MapHelper, MapHelper, PaginateHelper, RichTextEditorHelper, SanitizeHelper
- Included in:
- MeetingsHelper, PublicParticipantsListCell
- Defined in:
- decidim-meetings/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 RichTextEditorHelper
Methods included from CheckBoxesTreeHelper
#check_boxes_tree_options, #filter_categories_values, #filter_scopes_values, #filter_scopes_values_from, #filter_scopes_values_from_parent, #filter_tree_from, #resource_filter_scope_values, #scope_children_to_tree
Methods included from SanitizeHelper
#decidim_html_escape, #decidim_sanitize, #decidim_sanitize_editor, #decidim_sanitize_newsletter, #decidim_url_escape, included
Methods included from Comments::CommentsHelper
#comments_for, #inline_comments_for
Methods included from MapHelper
Methods included from Decidim::MapHelper
#dynamic_map_for, #static_map_link
Methods included from PaginateHelper
Instance Method Details
#activity_filter_values ⇒ Object
Options to filter meetings by activity.
54 55 56 57 58 59 |
# File 'decidim-meetings/app/helpers/decidim/meetings/application_helper.rb', line 54 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 50 51 |
# File 'decidim-meetings/app/helpers/decidim/meetings/application_helper.rb', line 43 def filter_date_values TreeNode.new( TreePoint.new("", t("decidim.meetings.meetings.filters.date_values.all")), [ TreePoint.new("upcoming", t("decidim.meetings.meetings.filters.date_values.upcoming")), TreePoint.new("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 'decidim-meetings/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 'decidim-meetings/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
87 88 89 |
# File 'decidim-meetings/app/helpers/decidim/meetings/application_helper.rb', line 87 def (meeting) %w(embed_in_meeting_page open_in_live_event_page).include? meeting. end |
#online_or_hybrid_meeting?(meeting) ⇒ Boolean
83 84 85 |
# File 'decidim-meetings/app/helpers/decidim/meetings/application_helper.rb', line 83 def online_or_hybrid_meeting?(meeting) meeting.online_meeting? || meeting.hybrid_meeting? end |
#prevent_timeout_seconds ⇒ Object
73 74 75 76 77 78 79 80 81 |
# File 'decidim-meetings/app/helpers/decidim/meetings/application_helper.rb', line 73 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.
69 70 71 |
# File 'decidim-meetings/app/helpers/decidim/meetings/application_helper.rb', line 69 def render_meeting_body(meeting) render_sanitized_content(meeting, :description) 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.
64 65 66 |
# File 'decidim-meetings/app/helpers/decidim/meetings/application_helper.rb', line 64 def safe_content? rich_text_editor_in_public_views? || @meeting.official? end |