Class: Decidim::Meetings::MeetingPresenter

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

Overview

Decorator for meetings

Direct Known Subclasses

MeetingEditionPresenter

Instance Method Summary collapse

Instance Method Details

#avatar_url(_variant = nil) ⇒ Object



103
104
105
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 103

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

#badgeObject



95
96
97
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 95

def badge
  ""
end

#can_be_contacted?Boolean

Returns:

  • (Boolean)


111
112
113
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 111

def can_be_contacted?
  false
end

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



57
58
59
60
61
62
63
64
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 57

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: 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



78
79
80
81
82
83
84
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 78

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)


107
108
109
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 107

def deleted?
  false
end

#description(links: false, extras: true, strip_tags: false, all_locales: false) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 22

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

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

  content_handle_locale(new_description, all_locales, extras, links, strip_tags)
end

#formatted_proposals_titlesObject



126
127
128
129
130
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 126

def formatted_proposals_titles
  return unless meeting

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

#has_tooltip?Boolean

Returns:

  • (Boolean)


115
116
117
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 115

def has_tooltip?
  false
end

#location(all_locales: false) ⇒ Object



33
34
35
36
37
38
39
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 33

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



41
42
43
44
45
46
47
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 41

def location_hints(all_locales: false)
  return unless meeting

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

#meetingObject



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

def meeting
  __getobj__
end

#nameObject

Next methods are used for present a Meeting As Proposal Author



87
88
89
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 87

def name
  title
end

#nicknameObject



91
92
93
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 91

def nickname
  ""
end

#profile_pathObject



99
100
101
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 99

def profile_path
  resource_locator(meeting).path
end

#proposalsObject



119
120
121
122
123
124
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 119

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



66
67
68
69
70
71
72
73
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 66

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: links).html_safe
  end
end

#registration_terms(all_locales: false) ⇒ Object



49
50
51
52
53
54
55
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 49

def registration_terms(all_locales: false)
  return unless meeting

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

#sanitized(content) ⇒ Object



132
133
134
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 132

def sanitized(content)
  decidim_sanitize_editor(content)
end

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



16
17
18
19
20
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 16

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

  super meeting.title, links, html_escape, all_locales
end