Use ace to edit pages, and ass yml_files and preview setup

This commit is contained in:
2015-03-07 16:56:07 +01:00
parent 8ba2fa731e
commit 3d98bcc89b
26 changed files with 470 additions and 13 deletions
+1
View File
@@ -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
+2 -1
View File
@@ -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
+7 -1
View File
@@ -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