Sha256: c09b634da32a33810f8b9f727112a74d6ff7a451b981b02520217bc7e85e7f26
Contents?: true
Size: 1.6 KB
Versions: 3
Compression:
Stored size: 1.6 KB
Contents
# frozen_string_literal: true module Decidim module Meetings module Admin # A form object used to copy a meeting from the admin # dashboard. # class MeetingCopyForm < Form include TranslatableAttributes translatable_attribute :title, String translatable_attribute :description, String translatable_attribute :location, String translatable_attribute :location_hints, String attribute :address, String attribute :latitude, Float attribute :longitude, Float attribute :start_time, Decidim::Attributes::TimeWithZone attribute :end_time, Decidim::Attributes::TimeWithZone attribute :services, Array[MeetingServiceForm] mimic :meeting validates :current_component, presence: true validates :title, translatable_presence: true validates :description, translatable_presence: true validates :location, translatable_presence: true validates :address, presence: true validates :address, geocoding: true, if: -> { Decidim.geocoder.present? } validates :start_time, presence: true, date: { before: :end_time } validates :end_time, presence: true, date: { after: :start_time } def map_model(model) self.services = model.services.map do |service| MeetingServiceForm.new(service) end end def services_to_persist services.reject(&:deleted) end def number_of_services services.size end alias component current_component end end end end
Version data entries
3 entries across 3 versions & 1 rubygems