Class: Decidim::Meetings::MeetingPresenter
- Inherits:
-
ResourcePresenter
- Object
- ResourcePresenter
- Decidim::Meetings::MeetingPresenter
- Includes:
- ActionView::Helpers::UrlHelper, ResourceHelper, SanitizeHelper
- Defined in:
- app/presenters/decidim/meetings/meeting_presenter.rb
Overview
Decorator for meetings
Direct Known Subclasses
Instance Method Summary collapse
- #avatar_url(_variant = nil) ⇒ Object
- #badge ⇒ Object
- #can_be_contacted? ⇒ Boolean
- #closing_report(links: false, all_locales: false) ⇒ Object
-
#dates_param ⇒ Object
start time and end time in rfc3339 format removing ‘-’ and ‘:’ symbols joined with ‘/’.
- #deleted? ⇒ Boolean
- #description(links: false, extras: true, strip_tags: false, all_locales: false) ⇒ Object
- #display_mention ⇒ Object
- #editor_description(all_locales: false, extras: true) ⇒ Object
- #formatted_proposals_titles ⇒ Object
- #has_tooltip? ⇒ Boolean
- #location(all_locales: false) ⇒ Object
- #location_hints(all_locales: false) ⇒ Object
- #meeting ⇒ Object
- #meeting_path ⇒ Object
-
#name ⇒ Object
Next methods are used for present a Meeting As Proposal Author.
- #nickname ⇒ Object
- #profile_path ⇒ Object
- #proposals ⇒ Object
- #registration_email_custom_content(links: false, all_locales: false) ⇒ Object
- #registration_terms(all_locales: false) ⇒ Object
- #sanitized(content) ⇒ Object
- #title(links: false, html_escape: false, all_locales: false) ⇒ Object
Instance Method Details
#avatar_url(_variant = nil) ⇒ Object
113 114 115 |
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 113 def avatar_url(_variant = nil) ActionController::Base.helpers.asset_pack_path("media/images/decidim_meetings.svg") end |
#badge ⇒ Object
105 106 107 |
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 105 def badge "" end |
#can_be_contacted? ⇒ Boolean
121 122 123 |
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 121 def can_be_contacted? false end |
#closing_report(links: false, all_locales: false) ⇒ Object
67 68 69 70 71 72 73 74 |
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 67 def closing_report(links: false, all_locales: false) return unless meeting handle_locales(meeting.closing_report, all_locales) do |content| renderer = Decidim::ContentRenderers::HashtagRenderer.new(sanitized(content)) renderer.render(links:).html_safe end end |
#dates_param ⇒ Object
start time and end time in rfc3339 format removing ‘-’ and ‘:’ symbols joined with ‘/’. This format is used to generate the dates query param in google calendars event link
88 89 90 91 92 93 94 |
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 88 def dates_param return unless meeting [meeting.start_time, meeting.end_time].map do |date| date.rfc3339.tr("-:", "") end.join("/") end |
#deleted? ⇒ Boolean
117 118 119 |
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 117 def deleted? false end |
#description(links: false, extras: true, strip_tags: false, all_locales: false) ⇒ Object
31 32 33 34 35 |
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 31 def description(links: false, extras: true, strip_tags: false, all_locales: false) return unless meeting content_handle_locale(meeting.description, all_locales, extras, links, ) end |
#display_mention ⇒ Object
21 22 23 |
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 21 def display_mention link_to title, meeting_path end |
#editor_description(all_locales: false, extras: true) ⇒ Object
37 38 39 40 41 |
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 37 def editor_description(all_locales: false, extras: true) return unless meeting editor_locales(meeting.description, all_locales, extras:) end |
#formatted_proposals_titles ⇒ Object
136 137 138 139 140 |
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 136 def formatted_proposals_titles return unless meeting proposals.map.with_index { |proposal, index| "#{index + 1}) #{proposal.title}\n" } end |
#has_tooltip? ⇒ Boolean
125 126 127 |
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 125 def has_tooltip? false end |
#location(all_locales: false) ⇒ Object
43 44 45 46 47 48 49 |
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 43 def location(all_locales: false) return unless meeting handle_locales(meeting.location, all_locales) do |content| content end end |
#location_hints(all_locales: false) ⇒ Object
51 52 53 54 55 56 57 |
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 51 def location_hints(all_locales: false) return unless meeting handle_locales(meeting.location_hints, all_locales) do |content| content end end |
#meeting ⇒ Object
13 14 15 |
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 13 def meeting __getobj__ end |
#meeting_path ⇒ Object
17 18 19 |
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 17 def meeting_path Decidim::ResourceLocatorPresenter.new(meeting).path end |
#name ⇒ Object
Next methods are used for present a Meeting As Proposal Author
97 98 99 |
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 97 def name title end |
#nickname ⇒ Object
101 102 103 |
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 101 def nickname "" end |
#profile_path ⇒ Object
109 110 111 |
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 109 def profile_path resource_locator(meeting).path end |
#proposals ⇒ Object
129 130 131 132 133 134 |
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 129 def proposals return unless Decidim::Meetings.enable_proposal_linking return unless meeting @proposals ||= meeting..load end |
#registration_email_custom_content(links: false, all_locales: false) ⇒ Object
76 77 78 79 80 81 82 83 |
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 76 def registration_email_custom_content(links: false, all_locales: false) return unless meeting handle_locales(meeting.registration_email_custom_content, all_locales) do |content| renderer = Decidim::ContentRenderers::HashtagRenderer.new(sanitized(content)) renderer.render(links:).html_safe end end |
#registration_terms(all_locales: false) ⇒ Object
59 60 61 62 63 64 65 |
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 59 def registration_terms(all_locales: false) return unless meeting handle_locales(meeting.registration_terms, all_locales) do |content| content end end |
#sanitized(content) ⇒ Object
142 143 144 |
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 142 def sanitized(content) decidim_sanitize_editor(content) end |
#title(links: false, html_escape: false, all_locales: false) ⇒ Object
25 26 27 28 29 |
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 25 def title(links: false, html_escape: false, all_locales: false) return unless meeting super meeting.title, links, html_escape, all_locales end |