Sha256: 6ad91c7c11852ffe8018eb5a21d2c0dbcbf830b288a9abdc7647ce13a2d40ce8
Contents?: true
Size: 788 Bytes
Versions: 2
Compression:
Stored size: 788 Bytes
Contents
# frozen_string_literal: true module Decidim module Admin # A form object to create or update pages. class StaticPageForm < Form include TranslatableAttributes attribute :slug, String attribute :organization, Decidim::Organization translatable_attribute :title, String translatable_attribute :content, String mimic :static_page validates :slug, :organization, presence: true validates :title, :content, translatable_presence: true validate :slug, :slug_uniqueness alias current_organization organization private def slug_uniqueness return unless organization && organization.static_pages.where(slug: slug).where.not(id: id).any? errors.add(:slug, :taken) end end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
decidim-admin-0.0.1 | app/forms/decidim/admin/static_page_form.rb |
decidim-0.0.1 | decidim-admin/app/forms/decidim/admin/static_page_form.rb |