activeadmin-selleo-cms 0.0.14 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. data/app/admin/active_admin/views_helper.rb +8 -8
  2. data/app/admin/activeadmin_selleo_cms/asset.rb +1 -8
  3. data/app/admin/activeadmin_selleo_cms/page.rb +8 -6
  4. data/app/admin/activeadmin_selleo_cms/section.rb +44 -0
  5. data/app/assets/javascripts/activeadmin-selleo-cms/custom.js +1 -1
  6. data/app/assets/javascripts/ckeditor/config.js +171 -0
  7. data/app/controllers/cms_controller.rb +12 -0
  8. data/app/controllers/locales_controller.rb +6 -0
  9. data/app/controllers/pages_controller.rb +36 -0
  10. data/app/controllers/searches_controller.rb +6 -0
  11. data/app/helpers/pages_helper.rb +40 -0
  12. data/app/models/activeadmin_selleo_cms/icon.rb +1 -1
  13. data/app/models/activeadmin_selleo_cms/layout.rb +43 -2
  14. data/app/models/activeadmin_selleo_cms/page.rb +63 -10
  15. data/app/models/activeadmin_selleo_cms/section.rb +16 -0
  16. data/app/views/admin/assets/destroy.js.erb +1 -0
  17. data/app/views/admin/pages/_form.html.haml +11 -15
  18. data/app/views/admin/pages/_translated_fields.html.haml +11 -1
  19. data/app/views/admin/sections/_form.html.haml +36 -0
  20. data/app/views/pages/show.html.haml +5 -0
  21. data/app/views/{activeadmin_selleo_cms/searches → searches}/show.html.haml +0 -0
  22. data/config/initializers/active_admin.rb +6 -0
  23. data/config/initializers/i18n.rb +2 -0
  24. data/config/locales/cms.en.yml +2 -1
  25. data/config/routes.rb +12 -3
  26. data/db/migrate/20121129142932_create_activeadmin_selleo_cms_pages.rb +1 -1
  27. data/db/migrate/20130108153415_add_redirect_to_first_sub_page.rb +10 -0
  28. data/db/migrate/20130109132745_add_fields_to_page.rb +9 -0
  29. data/lib/activeadmin-selleo-cms/engine.rb +4 -0
  30. data/lib/activeadmin-selleo-cms/version.rb +1 -1
  31. data/lib/tasks/rebuild.rake +20 -0
  32. data/spec/dummy/app/views/layouts/application.html.erb +1 -5
  33. data/spec/dummy/app/views/layouts/cms.html.erb +11 -3
  34. data/spec/dummy/app/views/layouts/haml.html.haml +1 -0
  35. data/spec/dummy/db/migrate/{20130103215140_create_activeadmin_selleo_cms_pages.activeadmin_selleo_cms.rb → 20130117150800_create_activeadmin_selleo_cms_pages.activeadmin_selleo_cms.rb} +1 -1
  36. data/spec/dummy/db/migrate/{20130103215141_create_activeadmin_selleo_cms_locales.activeadmin_selleo_cms.rb → 20130117150801_create_activeadmin_selleo_cms_locales.activeadmin_selleo_cms.rb} +0 -0
  37. data/spec/dummy/db/migrate/{20130103215142_create_ckeditor_assets.activeadmin_selleo_cms.rb → 20130117150802_create_ckeditor_assets.activeadmin_selleo_cms.rb} +0 -0
  38. data/spec/dummy/db/migrate/{20130103215143_create_activeadmin_selleo_cms_sections.activeadmin_selleo_cms.rb → 20130117150803_create_activeadmin_selleo_cms_sections.activeadmin_selleo_cms.rb} +0 -0
  39. data/spec/dummy/db/migrate/{20130103215144_create_activeadmin_selleo_cms_searches.activeadmin_selleo_cms.rb → 20130117150804_create_activeadmin_selleo_cms_searches.activeadmin_selleo_cms.rb} +0 -0
  40. data/spec/dummy/db/migrate/{20130103215145_create_translations.activeadmin_selleo_cms.rb → 20130117150805_create_translations.activeadmin_selleo_cms.rb} +0 -0
  41. data/spec/dummy/db/migrate/{20130103215146_create_activeadmin_selleo_cms_assets.activeadmin_selleo_cms.rb → 20130117150806_create_activeadmin_selleo_cms_assets.activeadmin_selleo_cms.rb} +0 -0
  42. data/spec/dummy/db/migrate/20130117150807_add_redirect_to_first_sub_page.activeadmin_selleo_cms.rb +11 -0
  43. data/spec/dummy/db/migrate/20130117150808_add_fields_to_page.activeadmin_selleo_cms.rb +10 -0
  44. data/spec/dummy/db/schema.rb +9 -7
  45. data/spec/dummy/db/snapshots/test_database.sql +2 -2
  46. data/spec/dummy/log/test.log +125756 -0
  47. data/spec/dummy/tmp/cache/assets/CB7/190/sprockets%2F136a9350fa75f3336af293952861ed6d +0 -0
  48. data/spec/dummy/tmp/cache/assets/CD3/3E0/sprockets%2F373fa62090ab111ae606b963e1b8c793 +0 -0
  49. data/spec/dummy/tmp/cache/assets/D2C/2E0/sprockets%2Fa031c32e27ced12f81d4326f8b52fb23 +0 -0
  50. data/spec/dummy/tmp/cache/assets/D63/6C0/sprockets%2F1ae1f1cf9d92d0e61b7006171a39fd4d +0 -0
  51. data/spec/dummy/tmp/cache/assets/DB2/EA0/sprockets%2Ffead656b8b83fbae9f69435c33b4649d +0 -0
  52. data/spec/dummy/tmp/cache/assets/E37/3E0/sprockets%2F9e6d2d17ed6da64a2f1876d4cdfefcd1 +0 -0
  53. data/spec/dummy/tmp/capybara/capybara-201301081556598147527968.html +13 -0
  54. data/spec/dummy/tmp/capybara/capybara-201301081558042145012026.html +23 -0
  55. data/spec/dummy/tmp/capybara/capybara-201301081559296090328502.html +24 -0
  56. data/spec/dummy/tmp/capybara/capybara-201301101624594727125473.html +13 -0
  57. data/spec/dummy/tmp/capybara/capybara-201301101625068619114008.html +13 -0
  58. data/spec/dummy/tmp/capybara/capybara-201301101625104331710400.html +13 -0
  59. data/spec/dummy/tmp/capybara/capybara-201301101625154735808799.html +13 -0
  60. data/spec/factories/pages.rb +4 -2
  61. data/spec/models/activeadmin_selleo_cms/layout_spec.rb +4 -0
  62. data/spec/models/activeadmin_selleo_cms/page_spec.rb +98 -3
  63. data/spec/requests/pages_spec.rb +8 -0
  64. data/spec/spec_helper.rb +3 -2
  65. data/spec/support/pages_helper.rb +5 -2
  66. metadata +90 -41
  67. data/app/controllers/activeadmin_selleo_cms/application_controller.rb +0 -13
  68. data/app/controllers/activeadmin_selleo_cms/locales_controller.rb +0 -8
  69. data/app/controllers/activeadmin_selleo_cms/pages_controller.rb +0 -15
  70. data/app/controllers/activeadmin_selleo_cms/searches_controller.rb +0 -8
  71. data/app/helpers/activeadmin_selleo_cms/application_helper.rb +0 -31
  72. data/app/views/activeadmin_selleo_cms/pages/show.html.haml +0 -3
@@ -1,5 +1,7 @@
1
1
  module ActiveadminSelleoCms
2
2
  class Page < ActiveRecord::Base
3
+ serialize :settings, Hash
4
+
3
5
  include ContentTranslation
4
6
 
5
7
  translates :title, :slug, :browser_title, :meta_keywords, :meta_description, fallbacks_for_empty_translations: true
@@ -13,21 +15,28 @@ module ActiveadminSelleoCms
13
15
  has_one :header_image, as: :assetable
14
16
  has_many :attachments, as: :assetable
15
17
  has_many :assets, as: :assetable
18
+ has_many :searches, as: :searchable
19
+ # ZUO
20
+ #has_many :translations, class_name: 'ActiveadminSelleoCms::Page::Translation', foreign_key: :activeadmin_selleo_cms_page_id, dependent: :destroy, before_add: :set_nest
16
21
 
17
22
  accepts_nested_attributes_for :translations, :sections, :children, :icon, :header_image, :attachments
18
23
 
19
24
  validates_format_of :link_url, with: /^http/i, allow_blank: false, if: ->(page) { page.is_link_url }
20
- validates_presence_of :layout
21
- validates_associated :translations, :sections
25
+ validates_presence_of :layout_name
26
+ # ZUO
27
+ #validates_associated :translations, :sections
22
28
 
23
29
  scope :show_in_menu, where(show_in_menu: true)
24
30
  scope :published, where(is_published: true)
25
31
  scope :not_published, where(is_published: false)
26
32
  scope :latest, ->(n) { published.reorder("published_at DESC").limit(n) }
27
33
  scope :most_read, ->(n) { published.reorder("views DESC").limit(n) }
34
+ scope :with_layout, ->(layout_name) { where(layout_name: layout_name) }
35
+ scope :with_setting_value, ->(key, value) { where("activeadmin_selleo_cms_pages.settings ~ '#{key}: #{value}'") }
28
36
 
29
37
  before_validation do
30
38
  self.slug = self.title.parameterize if title and slug.blank?
39
+ translations.each{ |translations| set_nest(translation)}
31
40
  end
32
41
 
33
42
  before_save do
@@ -37,7 +46,31 @@ module ActiveadminSelleoCms
37
46
  end
38
47
 
39
48
  after_initialize do
40
- self.layout = Layout.all.first if new_record? and layout.blank?
49
+ self.layout_name = Layout.all.first if new_record? and layout_name.blank?
50
+ end
51
+
52
+ def set_nest(translation)
53
+ translation.activeadmin_selleo_cms_page ||= self
54
+ end
55
+
56
+ def method_missing(method, *args, &block)
57
+ _method = (method.to_s[/(.*)\=$/,1] || method).to_sym
58
+ unless (self.settings || {})[_method].nil?
59
+ eval "
60
+ def #{_method}
61
+ (self.settings || {})[:#{_method}]
62
+ end
63
+ def #{_method}=(val)
64
+ self.settings ||= {}
65
+ val = true if val == '1'
66
+ val = false if val == '0'
67
+ self.settings[:#{_method}] = val
68
+ end
69
+ "
70
+ send(method, *args)
71
+ else
72
+ super
73
+ end
41
74
  end
42
75
 
43
76
  def initialize_missing_sections
@@ -51,15 +84,15 @@ module ActiveadminSelleoCms
51
84
  end
52
85
 
53
86
  def section_names
54
- begin
55
- File.open(Dir.glob(File.join(Rails.root, "app/views/layouts/#{layout}.html*")).first).read.scan(/yield\s*\:(\w+)/).flatten
56
- rescue
57
- []
58
- end
87
+ @section_names ||= layout.section_names
88
+ end
89
+
90
+ def layout
91
+ @layout ||= Layout.find(layout_name)
59
92
  end
60
93
 
61
94
  def to_param
62
- slug
95
+ parent ? "#{parent.to_param}/#{slug}" : slug
63
96
  end
64
97
 
65
98
  def icon_url
@@ -78,11 +111,31 @@ module ActiveadminSelleoCms
78
111
  self_and_ancestors.map(&:title).join(' &raquo; ').html_safe
79
112
  end
80
113
 
114
+ def url(options={locale: true})
115
+ _url = if is_link_url
116
+ link_url
117
+ elsif redirect_to_first_sub_page and children.published.any?
118
+ "/:locale/#{children.published.first.to_param}"
119
+ else
120
+ "/:locale/#{to_param}"
121
+ end
122
+ _url = _url.gsub(':locale', I18n.locale.to_s) if _url.match(/:locale/) and options[:locale]
123
+ _url
124
+ end
125
+
81
126
  class Translation
82
127
  attr_protected :id
83
128
 
129
+ belongs_to :activeadmin_selleo_cms_page, class_name: 'ActiveadminSelleoCms::Page'
130
+
84
131
  validates :title, presence: true, if: ->(translation){ translation.locale.eql? I18n.locale }
85
- validates :slug, presence: true, uniqueness: { scope: :locale}, format: { with: /^[a-z0-9\-_]+$/i }, if: ->(translation) { translation.locale.eql? I18n.locale }
132
+ validates :slug, presence: true, format: { with: /^[a-z0-9\-_]+$/i }, if: ->(translation) { translation.locale.eql? I18n.locale }
133
+ validate do |translation|
134
+ if slug.present? and translation.class.joins(:activeadmin_selleo_cms_page).
135
+ where(locale: locale, slug: slug, activeadmin_selleo_cms_pages: { parent_id: activeadmin_selleo_cms_page.parent_id }).all.reject{|p| p == self}.any?
136
+ errors.add(:slug, :taken)
137
+ end
138
+ end
86
139
  end
87
140
  end
88
141
  end
@@ -14,8 +14,24 @@ module ActiveadminSelleoCms
14
14
  validates_uniqueness_of :name, scope: [:sectionable_type, :sectionable_id]
15
15
  validates_associated :translations
16
16
 
17
+ scope :with_name, ->(section_name) { where(name: section_name) }
18
+ scope :blurbs, where("name ILIKE 'blurb.%'")
19
+ scope :help, where("name ILIKE 'help.%'")
20
+
21
+ def toolbar
22
+ case name
23
+ when /blurb\./ then "Easy"
24
+ when /help\./ then "Lite"
25
+ else "Easy"
26
+ end
27
+ end
28
+
17
29
  class Translation
18
30
  attr_protected :id
31
+
32
+ has_many :attachments, as: :assetable
33
+
34
+ accepts_nested_attributes_for :attachments
19
35
  end
20
36
  end
21
37
  end
@@ -0,0 +1 @@
1
+ $('li[data-asset-id="<%= @asset.id %>"]').remove();
@@ -7,11 +7,15 @@
7
7
  - @section_forms = []
8
8
 
9
9
  = form.inputs "General options" do
10
- = form.input :layout, collection: ActiveadminSelleoCms::Layout.all, include_blank: false, hint: "The form will reload on change"
10
+ = form.input :layout_name, collection: ActiveadminSelleoCms::Layout.all.sort, include_blank: false, hint: "The form will reload on change"
11
11
  = form.input :parent_id, as: :select, collection: nested_set_options(ActiveadminSelleoCms::Page, @page) {|i| "#{'-' * i.level} #{i.title}" }
12
12
  = form.input :is_published, as: :boolean, input_html: { checked: @page.published_at.present? }
13
+ = form.input :redirect_to_first_sub_page, as: :boolean
13
14
  = form.input :is_link_url, as: :boolean, input_html: { checked: @page.link_url.present? }
14
15
  = form.input :link_url, hint: "Enter remote URL including the http part at the beginning"
16
+ - form.object.settings.keys.each do |key|
17
+ = form.input key.to_sym, as: determine_field_type(form.object.send(key))
18
+
15
19
 
16
20
  = form.semantic_fields_for :sections do |section_form|
17
21
  - if @page.section_names.include? section_form.object.name
@@ -37,20 +41,12 @@
37
41
  - else
38
42
  = ""
39
43
 
40
- = form.inputs "Page icon", for: [:icon, form.object.icon || ActiveadminSelleoCms::Icon.new] do |icon_form|
41
- = icon_form.input :data, label: "Icon", hint: (form.object.icon ? icon_form.template.image_tag(form.object.icon_url) : "No icon uploaded yet" )
42
-
43
- = form.inputs "Header image", for: [:header_image, form.object.header_image || ActiveadminSelleoCms::HeaderImage.new] do |header_image_form|
44
- = header_image_form.input :data, label: "Header image", hint: (form.object.header_image ? header_image_form.template.image_tag(form.object.header_image_url) : "No header image uploaded yet" )
45
-
46
- = form.inputs "Attachments", for: [:attachments, ActiveadminSelleoCms::Attachment.new] do |attachment_form|
47
- = attachment_form.input :data, label: "Attachment", input_html: { multiple: true, name: "page[attachments_attributes][][data]" }
48
- - form.object.attachments.each do |attachment|
49
- %li{"data-attachment-id" => attachment.id}
50
- %label File
51
- = attachment.data_file_name
52
- = link_to_function "Delete", "delete_asset(#{@page.id}, #{attachment.id})"
44
+ - unless @page.new_record?
45
+ = form.inputs "Page icon", for: [:icon, form.object.icon || ActiveadminSelleoCms::Icon.new] do |icon_form|
46
+ = icon_form.input :data, label: "Icon", hint: (form.object.icon ? icon_form.template.image_tag(form.object.icon_url) : "No icon uploaded yet" )
53
47
 
48
+ = form.inputs "Header image", for: [:header_image, form.object.header_image || ActiveadminSelleoCms::HeaderImage.new] do |header_image_form|
49
+ = header_image_form.input :data, label: "Header image", hint: (form.object.header_image ? header_image_form.template.image_tag(form.object.header_image_url) : "No header image uploaded yet" )
54
50
 
55
51
  = form.actions do
56
52
  = form.action :submit
@@ -89,7 +85,7 @@
89
85
  is_link_url();
90
86
  });
91
87
 
92
- $('select#page_layout').change(function(){
88
+ $('select#page_layout_name').change(function(){
93
89
  $(this).closest('form').find('input[name="_change_layout"]').attr('value','1');
94
90
  $(this).closest('form').submit();
95
91
  });
@@ -11,7 +11,17 @@
11
11
  - @section_forms.each do |section_form|
12
12
  = section_form.semantic_fields_for :translations do |section_form_translated|
13
13
  - if section_form_translated.object.locale.to_sym == locale.code
14
- = section_form_translated.input :body, as: :ckeditor, label: "#{section_form.object.name.titleize} part", input_html: { toolbar: "Easy" }
14
+ - section = @page.layout.find_section(section_form.object.name)
15
+ = section_form_translated.input :body, as: section.type, label: "#{section_form.object.name.titleize} part", input_html: { toolbar: section.toolbar }
15
16
  = section_form_translated.input :locale, :as => :hidden, :label => false
17
+ - if !@page.new_record? and section.attachments
18
+ = section_form_translated.inputs "Attachments", for: [:attachments, ActiveadminSelleoCms::Attachment.new] do |attachment_form|
19
+ = attachment_form.input :data, label: "Attachment", input_html: { multiple: false }
20
+ - section_form_translated.object.attachments.each do |attachment|
21
+ %li{"data-asset-id" => attachment.id}
22
+ %label File
23
+ = attachment.data_file_name
24
+ = link_to_function "Delete", "delete_asset(#{@page.id}, #{attachment.id})"
16
25
  - else
17
26
  = ""
27
+
@@ -0,0 +1,36 @@
1
+ = semantic_form_for [:admin, @section], url: (@section.new_record? ? admin_sections_path : admin_section_path(@section.id)), html: { multipart: true } do |form|
2
+
3
+ = form.input :name, as: :hidden, label: false
4
+ - @section.initialize_missing_translations
5
+ - current_locale = ActiveadminSelleoCms::Locale.find_by_code(I18n.locale)
6
+
7
+ .language-tabs
8
+ %ul.language-selection
9
+ %li= link_to current_locale.name, "#lang-#{current_locale.code}"
10
+ - @section.translations.each do |translation|
11
+ - unless translation.locale == current_locale.code
12
+ - if additional_locale = ActiveadminSelleoCms::Locale.enabled.find_by_code(translation.locale)
13
+ %li= link_to additional_locale.name, "#lang-#{additional_locale.code}"
14
+ - else
15
+ = ""
16
+
17
+ = form.semantic_fields_for :translations do |translated_form|
18
+ - if additional_locale = ActiveadminSelleoCms::Locale.enabled.find_by_code(translated_form.object.locale)
19
+ %div{id: "lang-#{additional_locale.code}", style: "#{'display:none;' if additional_locale.code == current_locale.code}"}
20
+ = translated_form.inputs "#{additional_locale.name} translation" do
21
+ %ol
22
+ = translated_form.input :body, as: :ckeditor, input_html: { toolbar: @section.toolbar }
23
+ = translated_form.input :locale, as: :hidden, label: false
24
+ - else
25
+ = ""
26
+
27
+ = form.actions do
28
+ = form.action :submit
29
+ %li.cancel
30
+ = link_to I18n.t('active_admin.cancel'), admin_pages_path
31
+
32
+
33
+ :javascript
34
+ $(function() {
35
+ $(".language-tabs").tabs();
36
+ });
@@ -0,0 +1,5 @@
1
+ - @page.sections.each do |section|
2
+ - content_for section.name.to_sym do
3
+ = section.body.html_safe if section.body
4
+ - if current_user and current_user.respond_to? :admin? and current_user.admin?
5
+ %p= link_to t("active_admin.cms.edit"), edit_admin_page_path(@page.id)
@@ -10,3 +10,9 @@ ActiveAdmin.setup do |config|
10
10
 
11
11
  config.before_filter :set_admin_locale
12
12
  end
13
+
14
+ module ActiveAdmin
15
+ class BaseController
16
+ with_role :admin
17
+ end
18
+ end
@@ -1,3 +1,5 @@
1
+ I18n.default_locale = :en
2
+
1
3
  require "i18n/backend/fallbacks"
2
4
  I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
3
5
 
@@ -2,4 +2,5 @@ en:
2
2
  active_admin:
3
3
  cms:
4
4
  view_on_site: "View on site"
5
- sub_pages: "Sub pages"
5
+ sub_pages: "Sub pages"
6
+ edit: "Edit"
data/config/routes.rb CHANGED
@@ -1,14 +1,23 @@
1
- ActiveadminSelleoCms::Engine.routes.draw do
1
+ Rails.application.routes.draw do
2
2
  mount Ckeditor::Engine => '/ckeditor'
3
3
 
4
4
  scope ":locale", :locale => /\w{2}/ do
5
5
  scope "search" do
6
6
  resources :searches, path: '', only: [:show]
7
7
  end
8
- resources :pages, path: '', only: [:show]
8
+ # TODO refactor
9
+ resources :pages, path: '', only: [:show, :index] do
10
+ resources :pages, path: '', only: [:show] do
11
+ resources :pages, path: '', only: [:show] do
12
+ resources :pages, path: '', only: [:show]
13
+ end
14
+ end
15
+ end
9
16
  end
10
17
 
11
18
  match ':locale' => 'pages#show'
12
19
 
13
20
  root to: 'pages#show'
14
- end
21
+
22
+ resources :locales, only: :show
23
+ end
@@ -5,7 +5,7 @@ class CreateActiveadminSelleoCmsPages < ActiveRecord::Migration
5
5
  t.integer :lft
6
6
  t.integer :rgt
7
7
  t.integer :depth
8
- t.string :layout
8
+ t.string :layout_name
9
9
  t.boolean :show_in_menu, default: true
10
10
  t.boolean :is_published
11
11
  t.datetime :published_at
@@ -0,0 +1,10 @@
1
+ class AddRedirectToFirstSubPage < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :activeadmin_selleo_cms_pages, :redirect_to_first_sub_page, :boolean, default: false
4
+ execute "UPDATE activeadmin_selleo_cms_pages SET redirect_to_first_sub_page = false"
5
+ end
6
+
7
+ def self.down
8
+ remove_column :activeadmin_selleo_cms_pages, :redirect_to_first_sub_page
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ class AddFieldsToPage < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :activeadmin_selleo_cms_pages, :settings, :text
4
+ end
5
+
6
+ def self.down
7
+ remove_column :activeadmin_selleo_cms_pages, :settings
8
+ end
9
+ end
@@ -1,5 +1,9 @@
1
1
  module ActiveadminSelleoCms
2
2
  class Engine < ::Rails::Engine
3
3
  isolate_namespace ActiveadminSelleoCms
4
+ config.to_prepare do
5
+ ApplicationController.helper(PagesHelper)
6
+ DeviseController.helper(PagesHelper)
7
+ end
4
8
  end
5
9
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveadminSelleoCms
2
- VERSION = "0.0.14"
2
+ VERSION = "0.0.16"
3
3
  end
@@ -0,0 +1,20 @@
1
+ namespace :db do
2
+ desc "Drops, creates and migrates db"
3
+
4
+ task(:rebuild => :environment) do
5
+ puts "Dropping db"
6
+ Rake::Task['db:drop'].invoke
7
+ puts "Creating db"
8
+ Rake::Task['db:create'].invoke
9
+ puts "Migrating db"
10
+ Rake::Task['db:migrate'].invoke
11
+ puts "Loading seeds"
12
+ Rake::Task['db:seed'].invoke
13
+ if Rails.env.test?
14
+ puts "Creating db snapshot"
15
+ excluded_tables = ["schema_migrations"].collect { |t| "-T #{t}" }.join(" ")
16
+ db_config = ActiveRecord::Base.configurations[ENV["RAILS_ENV"]]
17
+ `pg_dump -i -a -x #{excluded_tables} -O #{db_config["database"]} -p #{db_config["port"]} -f db/snapshots/test_database.sql`
18
+ end
19
+ end
20
+ end
@@ -8,11 +8,7 @@
8
8
  </head>
9
9
  <body>
10
10
 
11
- <%= yield :header %>
12
-
13
- <%= yield :content %>
14
-
15
- <%= yield :footer %>
11
+ <%= yield %>
16
12
 
17
13
  </body>
18
14
  </html>
@@ -14,13 +14,21 @@
14
14
  <% end %>
15
15
  </ul>
16
16
 
17
- <h1><%= yield :header %></h1>
17
+ <h1>
18
+ <section name='header'>
19
+ <%= yield :header %>
20
+ </section>
21
+ </h1>
18
22
 
19
- <%= yield :content %>
23
+ <section name='content' data-type='ckeditor'>
24
+ <%= yield :content %>
25
+ </section>
20
26
 
21
27
  <hr/>
22
28
 
23
- <%= yield :footer %>
29
+ <section name='footer'>
30
+ <%= yield :footer %>
31
+ </section>
24
32
 
25
33
  </body>
26
34
  </html>
@@ -0,0 +1 @@
1
+ !!!
@@ -6,7 +6,7 @@ class CreateActiveadminSelleoCmsPages < ActiveRecord::Migration
6
6
  t.integer :lft
7
7
  t.integer :rgt
8
8
  t.integer :depth
9
- t.string :layout
9
+ t.string :layout_name
10
10
  t.boolean :show_in_menu, default: true
11
11
  t.boolean :is_published
12
12
  t.datetime :published_at