Class: Decidim::Meetings::MeetingPresenter

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



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

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

#badgeObject



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

def badge
  ""
end

#can_be_contacted?Boolean

Returns:

  • (Boolean)


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

def can_be_contacted?
  false
end

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



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

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



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

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)


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

def deleted?
  false
end

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



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

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



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

def display_mention
  link_to title, meeting_path
end

#editor_description(all_locales: false) ⇒ Object



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

def editor_description(all_locales: false)
  return unless meeting

  editor_locales(meeting.description, all_locales)
end

#formatted_proposals_titlesObject



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

def formatted_proposals_titles
  return unless meeting

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

#location(all_locales: false) ⇒ Object



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

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



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

def location_hints(all_locales: false)
  return unless meeting

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

#meetingObject



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

def meeting
  __getobj__
end

#meeting_pathObject



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

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

#nameObject

Next methods are used for present a Meeting As Proposal Author



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

def name
  title
end

#nicknameObject



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

def nickname
  ""
end

#profile_pathObject



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

def profile_path
  resource_locator(meeting).path
end

#proposalsObject



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

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



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

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



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

def registration_terms(all_locales: false)
  return unless meeting

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

#space_titleObject



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

def space_title
  translated_attribute component.participatory_space.title
end

#super_titleObject



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

alias super_title title

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



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

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



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

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

  super(meeting.title, html_escape, all_locales)
end