Sha256: 18a176ab734b992cabe0caa4b062025583036d787babf278587ae724811fd7b9
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
# frozen_string_literal: true module Decidim module Admin # A form object used to create participatory processes steps from the admin # dashboard. # class ParticipatoryProcessStepForm < Form include TranslatableAttributes translatable_attribute :title, String translatable_attribute :description, String translatable_attribute :short_description, String mimic :participatory_process_step attribute :start_date, DateTime attribute :end_date, DateTime validates :title, :description, :short_description, translatable_presence: true validates :start_date, date: { before: :end_date, allow_blank: true, if: proc { |obj| obj.end_date.present? } } validates :end_date, date: { after: :start_date, allow_blank: true, if: proc { |obj| obj.start_date.present? } } def start_date return nil unless super.respond_to?(:at_midnight) super.at_midnight end def end_date return nil unless super.respond_to?(:at_midnight) super.at_midnight end end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
decidim-admin-0.0.1 | app/forms/decidim/admin/participatory_process_step_form.rb |
decidim-0.0.1 | decidim-admin/app/forms/decidim/admin/participatory_process_step_form.rb |