Sha256: e275b01d4fa3bcbe1a4c515c1df2189a43bd9a246fa82fd3d52810a973de92d1

Contents?: true

Size: 624 Bytes

Versions: 7

Compression:

Stored size: 624 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Initiatives
    # A form object used to collect the title and description for an initiative.
    class PreviousForm < Form
      include TranslatableAttributes

      mimic :initiative

      attribute :title, String
      attribute :description, String
      attribute :type_id, Integer

      validates :title, :description, presence: true
      validates :title, length: { maximum: 150 }
      validates :type_id, presence: true

      def type
        @type ||= type_id ? Decidim::InitiativesType.find(type_id) : context.initiative.type
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
decidim-initiatives-0.28.4 app/forms/decidim/initiatives/previous_form.rb
decidim-initiatives-0.28.3 app/forms/decidim/initiatives/previous_form.rb
decidim-initiatives-0.28.2 app/forms/decidim/initiatives/previous_form.rb
decidim-initiatives-0.28.1 app/forms/decidim/initiatives/previous_form.rb
decidim-initiatives-0.28.0 app/forms/decidim/initiatives/previous_form.rb
decidim-initiatives-0.28.0.rc5 app/forms/decidim/initiatives/previous_form.rb
decidim-initiatives-0.28.0.rc4 app/forms/decidim/initiatives/previous_form.rb