Sha256: dbbfdc8fb1fe35e9dbc8ffd413f9d2a53d4d1c4b203974f2bf0e3a51ac8a2eb4

Contents?: true

Size: 829 Bytes

Versions: 4

Compression:

Stored size: 829 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module ParticipatoryProcesses
    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

        mimic :participatory_process_step

        attribute :start_date, Date
        attribute :end_date, Date

        validates :title, 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? } }
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-participatory_processes-0.14.4 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.14.3 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.14.2 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.14.1 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb