Dynamic pages, language switcher and fix schedule drag drop time mismatch bug

This commit is contained in:
2015-02-21 15:05:45 +01:00
parent e60955130a
commit c8109c8ad6
29 changed files with 163 additions and 40 deletions
+18
View File
@@ -1,6 +1,24 @@
class Page
include Cmtool::Includes::Page
include ActiveModel::SerializerSupport
def self.layouts
%w[theme1 theme1-home]
end
def self.suppliers_page(name, locale: :en)
find_by_name_and_locale("suppliers-#{name}", locale) || NullPage.new(name, locale: locale)
end
class NullPage < NullModel
attr_reader :name, :locale, :title, :body
def initialize(name, locale: 'en')
@name = name
@locale = locale
@body = ::I18n.t('page.not_found', locale: locale)
end
def title
@title ||= name.to_s.humanize.gsub(/\W/, ' ')
end
end
end