Sha256: 82a1fd251428f9b01360aec32075e7469c8b841a91a5a0fbece36dadd5c69b71
Contents?: true
Size: 823 Bytes
Versions: 1
Compression:
Stored size: 823 Bytes
Contents
# frozen_string_literal: true module Decidim module ReportingProposals class ProposalForm < Decidim::Proposals::ProposalForm attribute :address, String attribute :has_no_address, Boolean attribute :has_no_image, Boolean attachments_attribute :photos validates :add_photos, presence: true, if: ->(form) { form.has_camera? && form.photos.blank? } # Set the has no address def map_model(model) super(model) self.has_no_address = true if model.address.blank? self.has_no_image = true if model.photo.blank? end def has_address? return if has_no_address geocoding_enabled? end def has_camera? return if has_no_image current_component.settings.attachments_allowed? end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
decidim-reporting_proposals-0.6.0 | app/forms/decidim/reporting_proposals/proposal_form.rb |