Sha256: 5c92c9235ae549ef0c9aff39b28e523626418d6dff5d3a365d167e94e6c883f1

Contents?: true

Size: 508 Bytes

Versions: 3

Compression:

Stored size: 508 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module ParticipatoryDocuments
    module Admin
      class AnnotationForm < Decidim::Form
        mimic :annotation

        attribute :id, Integer
        attribute :rect, Hash
        attribute :page_number, Integer
        attribute :section, Integer

        validate :rect_valid_hash

        private

        def rect_valid_hash
          return if rect[:left] && rect[:top]

          errors.add(:rect, :invalid)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
decidim-participatory_documents-0.2.2 app/forms/decidim/participatory_documents/admin/annotation_form.rb
decidim-participatory_documents-0.2.1 app/forms/decidim/participatory_documents/admin/annotation_form.rb
decidim-participatory_documents-0.2.0 app/forms/decidim/participatory_documents/admin/annotation_form.rb