Sha256: 5a80e0cfddbbbe6616b0324f1169b88907546de6c3147a4680303ad946c8ae02

Contents?: true

Size: 798 Bytes

Versions: 1

Compression:

Stored size: 798 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

        def document_type
          document.content_type
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
decidim-proposals-0.16.0 app/forms/decidim/proposals/admin/import_participatory_text_form.rb