Added template select to the pages admin form (#5952) [deploy]
This commit is contained in:
parent
faad0b83e6
commit
1c94ffb38e
2 changed files with 8 additions and 1 deletions
|
|
@ -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?
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,11 @@
|
|||
<%= form.label :description %>
|
||||
<%= form.text_field :description, class: "form-control" %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= form.label :template %>
|
||||
<%= form.select :template, Page::TEMPLATE_OPTIONS, class: "form-control" %>
|
||||
<p>(Determines the way page's body will be embedded in the layout)</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= form.label :is_top_level_path %>
|
||||
<%= form.check_box :is_top_level_path %>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue