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.26.1 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.26.0 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.26.0.rc2 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.26.0.rc1 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.25.2 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.25.1 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.25.0 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.25.0.rc4 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.25.0.rc3 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.25.0.rc2 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.25.0.rc1 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.24.3 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.24.2 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.24.1 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.24.0 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.24.0.rc2 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb
decidim-participatory_processes-0.24.0.rc1 app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb