Sha256: 5f7a481bfd1fa9783e52b44c2a89eb74735aefd718dbcf590faee09438bbd52b
Contents?: true
Size: 886 Bytes
Versions: 1
Compression:
Stored size: 886 Bytes
Contents
# frozen_string_literal: true module Decidim module ParticipatoryDocuments module Admin class DocumentForm < Decidim::Form include Decidim::HasUploadValidations include Decidim::TranslatableAttributes mimic :document translatable_attribute :title, String translatable_attribute :description, String attribute :box_color, String, default: "#1e98d7" attribute :box_opacity, Integer, default: 12 attribute :file, Decidim::Attributes::Blob attribute :remove_file, Boolean, default: false validates :file, file_content_type: { allow: ["application/pdf"] } # ensure color and opacity are present def map_model(doc) self.box_color = doc.box_color.presence || "#1e98d7" self.box_opacity = doc.box_opacity.presence || 12 end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
decidim-participatory_documents-0.2.1 | app/forms/decidim/participatory_documents/admin/document_form.rb |