diff --git a/app/models/page.rb b/app/models/page.rb index 26e1ce24b..8d1cdb8c7 100644 --- a/app/models/page.rb +++ b/app/models/page.rb @@ -1,8 +1,10 @@ class Page < ApplicationRecord + TEMPLATE_OPTIONS = %w[contained full_within_layout full_page].freeze + validates :title, presence: true validates :description, presence: true validates :slug, presence: true, format: /\A[0-9a-z\-_]*\z/ - validates :template, inclusion: { in: %w[contained full_within_layout full_page] } + validates :template, inclusion: { in: TEMPLATE_OPTIONS } validate :body_present validate :unique_slug_including_users_and_orgs, if: :slug_changed? diff --git a/app/views/internal/pages/_form.html.erb b/app/views/internal/pages/_form.html.erb index 785bc1433..bcae9c98a 100644 --- a/app/views/internal/pages/_form.html.erb +++ b/app/views/internal/pages/_form.html.erb @@ -21,6 +21,11 @@ <%= form.label :description %> <%= form.text_field :description, class: "form-control" %> +
(Determines the way page's body will be embedded in the layout)
+