Class: Decidim::Meetings::MeetingForm
  
  
  
Overview
  
    
This class holds a Form to create/update meetings for Participants and UserGroups.
   
 
  
  
    
      Instance Method Summary
      collapse
    
    
  
  
  
  
  
  
  
  
  
  
  #geocoded?, #geocoding_enabled?, #has_address?, #hybrid_meeting?, #in_person_meeting?, #needs_address?, #online_meeting?
  
  
    Instance Method Details
    
      
  
  
    #category  ⇒ Object 
  
  
  
  
    
      
73
74
75
76
77 
     | 
    
      # File 'app/forms/decidim/meetings/meeting_form.rb', line 73
def category
  return unless current_component
  @category ||= categories.find_by(id: decidim_category_id)
end 
     | 
  
 
    
      
  
  
    #clean_type_of_meeting  ⇒ Object 
  
  
  
  
    
      
79
80
81 
     | 
    
      # File 'app/forms/decidim/meetings/meeting_form.rb', line 79
def clean_type_of_meeting
  type_of_meeting.presence
end 
     | 
  
 
    
      
  
  
    #decidim_scope_id  ⇒ Object 
  
  
  
  
    
Scope identifier
Returns the scope identifier related to the meeting
   
 
  
  
    
      
69
70
71 
     | 
    
      # File 'app/forms/decidim/meetings/meeting_form.rb', line 69
def decidim_scope_id
  super || scope&.id
end 
     | 
  
 
    
      
  
  
    #embeddable_meeting_url  ⇒ Object 
  
  
  
  
    
      
131
132
133
134
135
136 
     | 
    
      # File 'app/forms/decidim/meetings/meeting_form.rb', line 131
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_select  ⇒ Object 
  
  
  
  
    
      
92
93
94
95
96
97
98
99 
     | 
    
      # File 'app/forms/decidim/meetings/meeting_form.rb', line 92
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_select  ⇒ Object 
  
  
  
  
    
      
101
102
103
104
105
106
107
108 
     | 
    
      # File 'app/forms/decidim/meetings/meeting_form.rb', line 101
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 
  
  
  
  
    
      
46
47
48
49
50
51
52
53
54
55 
     | 
    
      # File 'app/forms/decidim/meetings/meeting_form.rb', line 46
def map_model(model)
  self.decidim_category_id = model.categorization.decidim_category_id if model.categorization
  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 
     | 
  
 
    
      
  
  
    
      
114
115
116 
     | 
    
      # File 'app/forms/decidim/meetings/meeting_form.rb', line 114
def on_different_platform?
  registration_type == "on_different_platform"
end 
     | 
  
 
    
      
  
  
    
      
110
111
112 
     | 
    
      # File 'app/forms/decidim/meetings/meeting_form.rb', line 110
def on_this_platform?
  registration_type == "on_this_platform"
end 
     | 
  
 
    
      
  
  
    #registration_type_select  ⇒ Object 
  
  
  
  
    
      
118
119
120
121
122
123
124
125 
     | 
    
      # File 'app/forms/decidim/meetings/meeting_form.rb', line 118
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_enabled  ⇒ Object 
  
  
  
  
    
      
127
128
129 
     | 
    
      # File 'app/forms/decidim/meetings/meeting_form.rb', line 127
def registrations_enabled
  on_this_platform?
end 
     | 
  
 
    
      
  
  
    #scope  ⇒ Object 
  
  
  
  
    
Finds the Scope from the given decidim_scope_id, uses the component scope if missing.
Returns a Decidim::Scope
   
 
  
  
    
      
62
63
64 
     | 
    
      # File 'app/forms/decidim/meetings/meeting_form.rb', line 62
def scope
  @scope ||= @attributes["decidim_scope_id"].value ? current_component.scopes.find_by(id: @attributes["decidim_scope_id"].value) : current_component.scope
end 
     | 
  
 
    
      
  
  
    #type_of_meeting_select  ⇒ Object 
  
  
  
  
    
      
83
84
85
86
87
88
89
90 
     | 
    
      # File 'app/forms/decidim/meetings/meeting_form.rb', line 83
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
     |