Class: Decidim::Meetings::MeetingForm

Inherits:
BaseMeetingForm show all
Defined in:
app/forms/decidim/meetings/meeting_form.rb

Overview

This class holds a Form to create/update meetings for Participants

Instance Method Summary collapse

Methods inherited from BaseMeetingForm

#geocoded?, #geocoding_enabled?, #has_address?, #hybrid_meeting?, #in_person_meeting?, #needs_address?, #online_meeting?, #participatory_space_manifest

Instance Method Details

#clean_type_of_meetingObject



52
53
54
# File 'app/forms/decidim/meetings/meeting_form.rb', line 52

def clean_type_of_meeting
  type_of_meeting.presence
end

#embeddable_meeting_urlObject



104
105
106
107
108
109
# File 'app/forms/decidim/meetings/meeting_form.rb', line 104

def embeddable_meeting_url
  if online_meeting_url.present? && %w(embed_in_meeting_page open_in_live_event_page).include?(iframe_embed_type)
    embedder_service = Decidim::Meetings::MeetingIframeEmbedder.new(online_meeting_url)
    errors.add(:iframe_embed_type, :not_embeddable) unless embedder_service.embeddable?
  end
end

#iframe_access_level_selectObject



65
66
67
68
69
70
71
72
# File 'app/forms/decidim/meetings/meeting_form.rb', line 65

def iframe_access_level_select
  Decidim::Meetings::Meeting.iframe_access_levels.map do |level, _value|
    [
      I18n.t("iframe_access_level.#{level}", scope: "decidim.meetings"),
      level
    ]
  end
end

#iframe_embed_type_selectObject



74
75
76
77
78
79
80
81
# File 'app/forms/decidim/meetings/meeting_form.rb', line 74

def iframe_embed_type_select
  Decidim::Meetings::Meeting.participants_iframe_embed_types.map do |type, _value|
    [
      I18n.t("iframe_embed_type.#{type}", scope: "decidim.meetings"),
      type
    ]
  end
end

#map_model(model) ⇒ Object



40
41
42
43
44
45
46
47
48
# File 'app/forms/decidim/meetings/meeting_form.rb', line 40

def map_model(model)
  presenter = MeetingEditionPresenter.new(model)
  self.title = presenter.title(all_locales: false)
  self.description = presenter.editor_description(all_locales: false)
  self.location = presenter.location(all_locales: false)
  self.location_hints = presenter.location_hints(all_locales: false)
  self.registration_terms = presenter.registration_terms(all_locales: false)
  self.type_of_meeting = model.type_of_meeting
end

#on_different_platform?Boolean

Returns:

  • (Boolean)


87
88
89
# File 'app/forms/decidim/meetings/meeting_form.rb', line 87

def on_different_platform?
  registration_type == "on_different_platform"
end

#on_this_platform?Boolean

Returns:

  • (Boolean)


83
84
85
# File 'app/forms/decidim/meetings/meeting_form.rb', line 83

def on_this_platform?
  registration_type == "on_this_platform"
end

#registration_type_selectObject



91
92
93
94
95
96
97
98
# File 'app/forms/decidim/meetings/meeting_form.rb', line 91

def registration_type_select
  Decidim::Meetings::Meeting::REGISTRATION_TYPES.keys.map do |type|
    [
      I18n.t("registration_type.#{type}", scope: "decidim.meetings"),
      type
    ]
  end
end

#registrations_enabledObject



100
101
102
# File 'app/forms/decidim/meetings/meeting_form.rb', line 100

def registrations_enabled
  on_this_platform?
end

#type_of_meeting_selectObject



56
57
58
59
60
61
62
63
# File 'app/forms/decidim/meetings/meeting_form.rb', line 56

def type_of_meeting_select
  Decidim::Meetings::Meeting::TYPE_OF_MEETING.keys.map do |type|
    [
      I18n.t("type_of_meeting.#{type}", scope: "decidim.meetings"),
      type
    ]
  end
end