Sha256: 30ee19a619eb5b019a3e081aa5725acc1a7213dda91cc24e4504de46e24521ae

Contents?: true

Size: 727 Bytes

Versions: 3

Compression:

Stored size: 727 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Proposals
    module Admin
      # A form object to be used when admin users want to import a collection of proposals
      # from a participatory text.
      class ImportParticipatoryTextForm < Decidim::Form
        include TranslatableAttributes

        translatable_attribute :title, String
        translatable_attribute :description, String
        attribute :document

        validates :document, presence: true
        validates :title, translatable_presence: true

        def default_locale
          current_participatory_space.organization.default_locale
        end

        def document_text
          document&.read
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
decidim-proposals-0.15.2 app/forms/decidim/proposals/admin/import_participatory_text_form.rb
decidim-proposals-0.15.1 app/forms/decidim/proposals/admin/import_participatory_text_form.rb
decidim-proposals-0.15.0 app/forms/decidim/proposals/admin/import_participatory_text_form.rb