Class: Decidim::Meetings::Admin::MeetingCopyForm

Inherits:
BaseMeetingForm show all
Includes:
TranslatableAttributes
Defined in:
decidim-meetings/app/forms/decidim/meetings/admin/meeting_copy_form.rb

Overview

A form object used to copy a meeting from the admin dashboard.

Constant Summary

Constants included from AttributeObject::TypeMap

AttributeObject::TypeMap::Boolean, AttributeObject::TypeMap::Decimal

Instance Attribute Summary

Attributes inherited from AttributeObject::Form

#context

Instance Method Summary collapse

Methods included from TranslatableAttributes

#default_locale?

Methods inherited from BaseMeetingForm

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

Methods inherited from AttributeObject::Form

ensure_hash, from_model, from_params, hash_from, infer_model_name, mimic, mimicked_model_name, model_name, #persisted?, #to_key, #to_model, #to_param, #valid?, #with_context

Methods included from AttributeObject::Model

#[], #[]=, #attributes, #attributes_with_values, #initialize, #to_h

Instance Method Details

#map_model(model) ⇒ Object


29
30
31
32
33
# File 'decidim-meetings/app/forms/decidim/meetings/admin/meeting_copy_form.rb', line 29

def map_model(model)
  self.services = model.services.map do |service|
    MeetingServiceForm.new(service.attributes)
  end
end

#number_of_servicesObject


39
40
41
# File 'decidim-meetings/app/forms/decidim/meetings/admin/meeting_copy_form.rb', line 39

def number_of_services
  services.size
end

#questionnaireObject


45
46
47
# File 'decidim-meetings/app/forms/decidim/meetings/admin/meeting_copy_form.rb', line 45

def questionnaire
  Decidim::Forms::Questionnaire.new
end

#services_to_persistObject


35
36
37
# File 'decidim-meetings/app/forms/decidim/meetings/admin/meeting_copy_form.rb', line 35

def services_to_persist
  services.reject(&:deleted)
end