Class: Decidim::Meetings::MeetingPresenter

Inherits:
SimpleDelegator
  • Object
show all
Includes:
ResourceHelper, SanitizeHelper, TranslationsHelper
Defined in:
decidim-meetings/app/presenters/decidim/meetings/meeting_presenter.rb

Overview

Decorator for meetings

Direct Known Subclasses

ConferenceMeetingPresenter

Instance Method Summary collapse

Methods included from SanitizeHelper

#decidim_html_escape, #decidim_sanitize, #decidim_sanitize_newsletter, #decidim_url_escape, included

Methods included from ResourceHelper

#linked_classes_filter_values_for, #linked_classes_for, #linked_resources_for, #resource_locator, #resource_title

Methods included from TranslationsHelper

empty_translatable, ensure_translatable, multi_translation, translated_in_current_locale?

Methods included from TranslatableAttributes

#default_locale?

Instance Method Details

#avatar_urlObject


105
106
107
# File 'decidim-meetings/app/presenters/decidim/meetings/meeting_presenter.rb', line 105

def avatar_url
  ActionController::Base.helpers.asset_pack_path("media/images/decidim_meetings.svg")
end

#badgeObject


97
98
99
# File 'decidim-meetings/app/presenters/decidim/meetings/meeting_presenter.rb', line 97

def badge
  ""
end

#can_be_contacted?Boolean

Returns:

  • (Boolean)

113
114
115
# File 'decidim-meetings/app/presenters/decidim/meetings/meeting_presenter.rb', line 113

def can_be_contacted?
  false
end

#closing_report(links: false, all_locales: false) ⇒ Object


59
60
61
62
63
64
65
66
# File 'decidim-meetings/app/presenters/decidim/meetings/meeting_presenter.rb', line 59

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(decidim_sanitize(content))
    renderer.render(links: links).html_safe
  end
end

#dates_paramObject

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


80
81
82
83
84
85
86
# File 'decidim-meetings/app/presenters/decidim/meetings/meeting_presenter.rb', line 80

def dates_param
  return unless meeting

  [meeting.start_time, meeting.end_time].map do |date|
    date.rfc3339.tr("-:", "")
  end.join("/")
end

#deleted?Boolean

Returns:

  • (Boolean)

109
110
111
# File 'decidim-meetings/app/presenters/decidim/meetings/meeting_presenter.rb', line 109

def deleted?
  false
end

#description(links: false, all_locales: false) ⇒ Object


26
27
28
29
30
31
32
33
# File 'decidim-meetings/app/presenters/decidim/meetings/meeting_presenter.rb', line 26

def description(links: false, all_locales: false)
  return unless meeting

  handle_locales(meeting.description, all_locales) do |content|
    renderer = Decidim::ContentRenderers::HashtagRenderer.new(decidim_sanitize(content))
    renderer.render(links: links).html_safe
  end
end

#formatted_proposals_titlesObject


128
129
130
131
132
# File 'decidim-meetings/app/presenters/decidim/meetings/meeting_presenter.rb', line 128

def formatted_proposals_titles
  return unless meeting

  proposals.map.with_index { |proposal, index| "#{index + 1}) #{proposal.title}\n" }
end

#has_tooltip?Boolean

Returns:

  • (Boolean)

117
118
119
# File 'decidim-meetings/app/presenters/decidim/meetings/meeting_presenter.rb', line 117

def has_tooltip?
  false
end

#location(all_locales: false) ⇒ Object


35
36
37
38
39
40
41
# File 'decidim-meetings/app/presenters/decidim/meetings/meeting_presenter.rb', line 35

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


43
44
45
46
47
48
49
# File 'decidim-meetings/app/presenters/decidim/meetings/meeting_presenter.rb', line 43

def location_hints(all_locales: false)
  return unless meeting

  handle_locales(meeting.location_hints, all_locales) do |content|
    content
  end
end

#meetingObject


13
14
15
# File 'decidim-meetings/app/presenters/decidim/meetings/meeting_presenter.rb', line 13

def meeting
  __getobj__
end

#nameObject

Next methods are used for present a Meeting As Proposal Author


89
90
91
# File 'decidim-meetings/app/presenters/decidim/meetings/meeting_presenter.rb', line 89

def name
  title
end

#nicknameObject


93
94
95
# File 'decidim-meetings/app/presenters/decidim/meetings/meeting_presenter.rb', line 93

def nickname
  ""
end

#profile_pathObject


101
102
103
# File 'decidim-meetings/app/presenters/decidim/meetings/meeting_presenter.rb', line 101

def profile_path
  resource_locator(meeting).path
end

#proposalsObject


121
122
123
124
125
126
# File 'decidim-meetings/app/presenters/decidim/meetings/meeting_presenter.rb', line 121

def proposals
  return unless Decidim::Meetings.enable_proposal_linking
  return unless meeting

  @proposals ||= meeting.authored_proposals.load
end

#registration_email_custom_content(links: false, all_locales: false) ⇒ Object


68
69
70
71
72
73
74
75
# File 'decidim-meetings/app/presenters/decidim/meetings/meeting_presenter.rb', line 68

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(decidim_sanitize(content))
    renderer.render(links: links).html_safe
  end
end

#registration_terms(all_locales: false) ⇒ Object


51
52
53
54
55
56
57
# File 'decidim-meetings/app/presenters/decidim/meetings/meeting_presenter.rb', line 51

def registration_terms(all_locales: false)
  return unless meeting

  handle_locales(meeting.registration_terms, all_locales) do |content|
    content
  end
end

#title(links: false, all_locales: false) ⇒ Object


17
18
19
20
21
22
23
24
# File 'decidim-meetings/app/presenters/decidim/meetings/meeting_presenter.rb', line 17

def title(links: false, all_locales: false)
  return unless meeting

  handle_locales(meeting.title, all_locales) do |content|
    renderer = Decidim::ContentRenderers::HashtagRenderer.new(decidim_html_escape(content))
    renderer.render(links: links).html_safe
  end
end