Class: Decidim::Meetings::MeetingPresenter

Inherits:
ResourcePresenter
  • Object
show all
Includes:
ActionView::Helpers::UrlHelper, 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



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

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

#badgeObject



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

def badge
  ""
end

#can_be_contacted?Boolean

Returns:

  • (Boolean)


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

def can_be_contacted?
  false
end

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



75
76
77
78
79
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 75

def closing_report(links: false, strip_tags: false, all_locales: false)
  return unless meeting

  content_handle_locale(meeting.closing_report, all_locales, links, strip_tags)
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



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

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)


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

def deleted?
  false
end

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



39
40
41
42
43
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 39

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

  content_handle_locale(meeting.description, all_locales, links, strip_tags)
end

#display_mentionObject



29
30
31
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 29

def display_mention
  link_to title, meeting_path
end

#editor_description(all_locales: false) ⇒ Object



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

def editor_description(all_locales: false)
  return unless meeting

  editor_locales(meeting.description, all_locales)
end

#formatted_proposals_titlesObject



141
142
143
144
145
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 141

def formatted_proposals_titles
  return unless meeting

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

#location(all_locales: false) ⇒ Object



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

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



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

def location_hints(all_locales: false)
  return unless meeting

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

#meetingObject



15
16
17
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 15

def meeting
  __getobj__
end

#meeting_pathObject



19
20
21
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 19

def meeting_path
  Decidim::ResourceLocatorPresenter.new(meeting).path
end

#nameObject

Next methods are used for present a Meeting As Proposal Author



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

def name
  title
end

#nicknameObject



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

def nickname
  ""
end

#profile_pathObject



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

def profile_path
  resource_locator(meeting).path
end

#proposalsObject



134
135
136
137
138
139
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 134

def proposals
  return unless Decidim.module_installed?(:proposals)
  return unless meeting

  @proposals ||= meeting.authored_proposals.load
end

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



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

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

#registration_terms(all_locales: false) ⇒ Object



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

def registration_terms(all_locales: false)
  return unless meeting

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

#space_titleObject



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

def space_title
  translated_attribute component.participatory_space.title
end

#super_titleObject



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

alias super_title title

#taxonomy_names(html_escape: false, all_locales: false) ⇒ Object



23
24
25
26
27
# File 'app/presenters/decidim/meetings/meeting_presenter.rb', line 23

def taxonomy_names(html_escape: false, all_locales: false)
  meeting.taxonomies.map do |taxonomy|
    super_title(taxonomy.name, html_escape, all_locales)
  end
end

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



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

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

  super(meeting.title, html_escape, all_locales)
end