Sha256: cb8dd9b1656fdd50ed7a6abef0d8e36b30c3938c36718075b2b36cfd043cc340

Contents?: true

Size: 1.05 KB

Versions: 37

Compression:

Stored size: 1.05 KB

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
        translatable_attribute :cta_text, String

        mimic :participatory_process_step

        attribute :start_date, Decidim::Attributes::LocalizedDate
        attribute :end_date, Decidim::Attributes::LocalizedDate
        attribute :cta_path, String

        validates :title, translatable_presence: true
        validates :cta_path, format: { with: %r{\A[a-zA-Z]+[a-zA-Z0-9\-_/]+\z} }, allow_blank: 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

37 entries across 37 versions & 1 rubygems

Version Path
decidim-participatory_processes-0.27.9 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.27.8 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.27.7 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.27.6 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.26.10 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.26.9 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.27.5 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.26.8 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.27.4 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.27.3 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.26.7 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.26.5 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.27.2 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.27.1 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.26.4 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.27.0 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.26.3 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.27.0.rc2 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.27.0.rc1 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.26.2 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb