Sha256: 2f5a08639246de1f0b6fb737a90172ab08040a2be12f075cd2a70aaef2529a99

Contents?: true

Size: 773 Bytes

Versions: 1

Compression:

Stored size: 773 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 :title, translatable_presence: true

        def default_locale
          current_participatory_space.organization.default_locale
        end

        def document_text
          @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.1 app/forms/decidim/proposals/admin/import_participatory_text_form.rb