Use ace to edit pages, and ass yml_files and preview setup
This commit is contained in:
@@ -26,6 +26,7 @@ module Cmtool
|
||||
group label: :site do
|
||||
title t('cmtool.menu.site.title')
|
||||
resource_link Page, scope: Cmtool
|
||||
resource_link Cmtool::YmlFile
|
||||
resource_link Cmtool::Keyword
|
||||
end
|
||||
group label: :publications do
|
||||
|
||||
@@ -13,12 +13,13 @@ module Cmtool
|
||||
klass.property :body
|
||||
klass.property :footer
|
||||
klass.property :sidebar
|
||||
klass.property :wysiwyg, type: :boolean, default: false
|
||||
klass.property :priority, type: Float, default: 0.5
|
||||
klass.property :active, type: :boolean, default: true
|
||||
klass.property :layout
|
||||
klass.property :in_menu, type: :boolean, default: true
|
||||
|
||||
klass.has_ancestry :by_property => :locale
|
||||
klass.has_ancestry by_property: :locale
|
||||
|
||||
klass.validates :name, presence: true
|
||||
klass.validates :locale, presence: true
|
||||
|
||||
@@ -4,7 +4,7 @@ module Cmtool
|
||||
extend ActiveSupport::Concern
|
||||
def home
|
||||
page_name = "home"
|
||||
@page = ::Page.find_by_name_and_locale(page_name, I18n.locale.to_s) || ::Page.new(:name => page_name, locale: I18n.locale.to_s)
|
||||
@page = find_page(page_name)
|
||||
@sub_pages = @page.children.select{|child| child.in_menu.present? }
|
||||
render :template => "pages/#{page_name}", :layout => @page.layout.presence || ::Page.layouts.first.to_s
|
||||
end
|
||||
@@ -45,6 +45,12 @@ module Cmtool
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_page(name)
|
||||
::Page.find_by_name_and_locale(page_name, I18n.locale.to_s) || ::Page.new(:name => page_name, locale: I18n.locale.to_s)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user