tb_cms 1.3.0 → 1.3.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -9
  3. data/app/assets/javascripts/admin/cms/application.js +1 -1
  4. data/app/assets/javascripts/admin/cms/menu_items.js +14 -8
  5. data/app/assets/javascripts/admin/cms/pages.js +9 -7
  6. data/app/controllers/admin/pages_controller.rb +1 -1
  7. data/app/controllers/cms/sitemaps_controller.rb +1 -1
  8. data/app/controllers/pages_controller.rb +4 -4
  9. data/app/helpers/cms/application_helper.rb +4 -4
  10. data/app/models/spud_menu_item.rb +3 -3
  11. data/app/models/spud_page.rb +22 -10
  12. data/app/models/spud_page_partial.rb +3 -20
  13. data/app/models/spud_snippet.rb +1 -4
  14. data/app/views/admin/menu_items/index.html.erb +2 -2
  15. data/app/views/admin/pages/_form.html.erb +2 -2
  16. data/app/views/admin/pages/_page_partials_form.html.erb +1 -1
  17. data/app/views/admin/pages/_page_row.html.erb +1 -1
  18. data/app/views/admin/pages/show.html.erb +12 -15
  19. data/app/views/pages/show.html.erb +2 -2
  20. data/db/migrate/20120101192412_create_spud_pages.rb +1 -1
  21. data/db/migrate/20120101193138_create_spud_menus.rb +1 -1
  22. data/db/migrate/20120101193255_create_spud_menu_items.rb +1 -1
  23. data/db/migrate/20120101194124_create_spud_templates.rb +1 -1
  24. data/db/migrate/20120103034659_create_spud_page_partials.rb +1 -1
  25. data/db/migrate/20120104194032_add_visibility_to_spud_pages.rb +1 -1
  26. data/db/migrate/20120107181337_add_menu_name_to_spud_menu_items.rb +1 -1
  27. data/db/migrate/20120111134754_add_use_custom_url_name_to_spud_pages.rb +1 -1
  28. data/db/migrate/20120118141852_add_notes_to_spud_pages.rb +1 -1
  29. data/db/migrate/20120126232428_add_menu_id_to_spud_menu_items.rb +1 -1
  30. data/db/migrate/20120128163601_add_classes_to_spud_menu_items.rb +1 -1
  31. data/db/migrate/20120329132314_add_site_id_to_spud_pages.rb +1 -1
  32. data/db/migrate/20120329132322_add_site_id_to_spud_templates.rb +1 -1
  33. data/db/migrate/20120329132330_add_site_id_to_spud_menus.rb +1 -1
  34. data/db/migrate/20120510195151_create_spud_page_partial_revisions.rb +1 -1
  35. data/db/migrate/20120911190030_add_symbol_name_to_spud_page_partials.rb +1 -1
  36. data/db/migrate/20120912121313_modify_site_id_for_spud_pages.rb +1 -1
  37. data/db/migrate/20121016233715_add_content_processed_to_spud_page_partials.rb +1 -1
  38. data/db/migrate/20121112151110_add_layout_to_spud_pages.rb +1 -1
  39. data/db/migrate/20121119025608_create_spud_snippets.rb +1 -1
  40. data/db/migrate/20150108162839_remove_site_id_from_cms_tables.rb +1 -1
  41. data/db/migrate/20150622161403_add_title_tag_to_spud_page.rb +1 -1
  42. data/lib/spud_cms/engine.rb +4 -15
  43. data/lib/spud_cms/template_parser.rb +2 -2
  44. data/lib/spud_cms/version.rb +1 -1
  45. data/lib/tb_cms.rb +0 -1
  46. data/spec/controllers/admin/menu_items_controller_spec.rb +18 -18
  47. data/spec/controllers/admin/menus_controller_spec.rb +9 -9
  48. data/spec/controllers/admin/pages_controller_spec.rb +9 -9
  49. data/spec/controllers/pages_controller_spec.rb +5 -5
  50. data/spec/dummy/app/controllers/application_controller.rb +1 -1
  51. data/spec/dummy/config/application.rb +1 -1
  52. data/spec/dummy/config/database.yml +3 -6
  53. data/spec/dummy/config/environments/development.rb +2 -2
  54. data/spec/dummy/db/migrate/20141231214446_create_spud_admin_permissions.tb_core.rb +1 -1
  55. data/spec/dummy/db/migrate/20141231214447_create_spud_users.tb_core.rb +1 -1
  56. data/spec/dummy/db/migrate/20141231214448_add_time_zone_to_spud_user.tb_core.rb +1 -1
  57. data/spec/dummy/db/migrate/20141231214449_add_scope_to_spud_admin_permissions.tb_core.rb +1 -1
  58. data/spec/dummy/db/migrate/20141231214450_create_spud_user_settings.tb_core.rb +1 -1
  59. data/spec/dummy/db/migrate/20141231214451_create_spud_roles.tb_core.rb +1 -1
  60. data/spec/dummy/db/migrate/20141231214452_create_spud_permissions.tb_core.rb +1 -1
  61. data/spec/dummy/db/migrate/20141231214453_create_spud_role_permissions.tb_core.rb +1 -1
  62. data/spec/dummy/db/migrate/20141231214454_drop_spud_admin_permissions.tb_core.rb +1 -1
  63. data/spec/dummy/db/migrate/20141231214455_create_spud_permalinks.tb_permalinks.rb +1 -1
  64. data/spec/dummy/db/migrate/20141231214456_add_site_id_to_spud_permalinks.tb_permalinks.rb +1 -1
  65. data/spec/dummy/db/migrate/20141231214457_modify_site_id_for_spud_permalinks.tb_permalinks.rb +1 -1
  66. data/spec/dummy/db/migrate/20141231214459_create_spud_pages.tb_cms.rb +1 -1
  67. data/spec/dummy/db/migrate/20141231214460_create_spud_menus.tb_cms.rb +1 -1
  68. data/spec/dummy/db/migrate/20141231214461_create_spud_menu_items.tb_cms.rb +1 -1
  69. data/spec/dummy/db/migrate/20141231214462_create_spud_templates.tb_cms.rb +1 -1
  70. data/spec/dummy/db/migrate/20141231214463_create_spud_page_partials.tb_cms.rb +1 -1
  71. data/spec/dummy/db/migrate/20141231214464_add_visibility_to_spud_pages.tb_cms.rb +1 -1
  72. data/spec/dummy/db/migrate/20141231214465_add_menu_name_to_spud_menu_items.tb_cms.rb +1 -1
  73. data/spec/dummy/db/migrate/20141231214466_add_use_custom_url_name_to_spud_pages.tb_cms.rb +1 -1
  74. data/spec/dummy/db/migrate/20141231214467_add_notes_to_spud_pages.tb_cms.rb +1 -1
  75. data/spec/dummy/db/migrate/20141231214468_add_menu_id_to_spud_menu_items.tb_cms.rb +1 -1
  76. data/spec/dummy/db/migrate/20141231214469_add_classes_to_spud_menu_items.tb_cms.rb +1 -1
  77. data/spec/dummy/db/migrate/20141231214470_add_site_id_to_spud_pages.tb_cms.rb +1 -1
  78. data/spec/dummy/db/migrate/20141231214471_add_site_id_to_spud_templates.tb_cms.rb +1 -1
  79. data/spec/dummy/db/migrate/20141231214472_add_site_id_to_spud_menus.tb_cms.rb +1 -1
  80. data/spec/dummy/db/migrate/20141231214473_create_spud_page_partial_revisions.tb_cms.rb +1 -1
  81. data/spec/dummy/db/migrate/20141231214474_add_symbol_name_to_spud_page_partials.tb_cms.rb +1 -1
  82. data/spec/dummy/db/migrate/20141231214475_modify_site_id_for_spud_pages.tb_cms.rb +1 -1
  83. data/spec/dummy/db/migrate/20141231214476_add_content_processed_to_spud_page_partials.tb_cms.rb +1 -1
  84. data/spec/dummy/db/migrate/20141231214477_add_layout_to_spud_pages.tb_cms.rb +1 -1
  85. data/spec/dummy/db/migrate/20141231214479_create_spud_snippets.tb_cms.rb +1 -1
  86. data/spec/dummy/db/migrate/20150108164814_remove_site_id_from_cms_tables.tb_cms.rb +1 -1
  87. data/spec/dummy/db/migrate/20150911185843_add_requires_password_change_to_spud_users.tb_core.rb +1 -1
  88. data/spec/dummy/db/migrate/20150911185844_add_title_tag_to_spud_page.tb_cms.rb +1 -1
  89. data/spec/dummy/db/migrate/20160215180157_create_tb_redirects.tb_redirects.rb +1 -1
  90. data/spec/dummy/db/schema.rb +108 -115
  91. data/spec/helpers/cms/application_helper_spec.rb +37 -37
  92. data/spec/models/spud_menu_item_spec.rb +4 -4
  93. data/spec/models/spud_page_partial_spec.rb +5 -5
  94. data/spec/models/spud_page_spec.rb +20 -12
  95. data/spec/rails_helper.rb +1 -1
  96. metadata +70 -96
  97. data/db/migrate/20121112212113_create_spud_page_liquid_tags.rb +0 -11
  98. data/db/migrate/20121119030136_change_liquid_tags_to_polymorphic.rb +0 -17
  99. data/db/migrate/20140110142037_drop_spud_page_liquid_tags.rb +0 -31
  100. data/lib/spud_cms/liquid_snippet.rb +0 -27
  101. data/spec/dummy/db/migrate/20141231214458_create_tb_liquid_spud_liquid_tags.tb_liquid.rb +0 -13
  102. data/spec/dummy/db/migrate/20141231214478_create_spud_page_liquid_tags.tb_cms.rb +0 -12
  103. data/spec/dummy/db/migrate/20141231214480_change_liquid_tags_to_polymorphic.tb_cms.rb +0 -18
  104. data/spec/dummy/db/migrate/20141231214481_drop_spud_page_liquid_tags.tb_cms.rb +0 -30
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ec75c53b2b39e4b6fe5a0e7968c1f54a695403b4
4
- data.tar.gz: 79126403fdfc7cdc63e65ac01e14a883570eeb06
3
+ metadata.gz: 13270a188b116b592cf0ca1dfcc2693f89e10a72
4
+ data.tar.gz: ce7dfc3f907926f416f053b15276801570230840
5
5
  SHA512:
6
- metadata.gz: e79dba5b06e5998468ea5d1d4ec15a0bde3173563770a9a2b1eb1759eac376f0fac84489ddf7840f0e19c3e54d38725a80bd0ff9ec80d419ae4565479a42a1d3
7
- data.tar.gz: 934771b2dd67cffad7f93b80d6a6edd3a93cd56754a78a05178618683b5eb0239971ada653436f82c196d100e2edac7498948f80c6f604f697c3d1f38d5354c6
6
+ metadata.gz: '09f2d4d365bd67a2e929d66c446cb34cffdcb60c9c07ced83c979261b2bc7be43507d8ba0e47f9f4965800cc74d852d13a1a1505667e9d103623f1fecaf30fd8'
7
+ data.tar.gz: b2c889ecec952493d8ea28fe54812f682cd8b0939455e718c6415d53fca081ab3dad0fec60c215edd7a09fcd919bd5a280a2decf004e30d09a738e15ae4ad0a7
data/README.md CHANGED
@@ -72,12 +72,6 @@ Create a controller concern at `app/controllers/concerns/spud_cms_layout_actions
72
72
 
73
73
  If you ran the `spud:cms:layout` generator described earlier, the concern and empty action would have been created for you automatically.
74
74
 
75
- ## Using Liquid Templates
76
-
77
- Pages use the [liquid](https://github.com/Shopify/liquid) template syntax engine created by Shopify. This allows you to easily inject variables into your pages in the page editor. Example:
78
-
79
- <h2>{{page.name}}</h2>
80
-
81
75
  ## Using Menus
82
76
 
83
77
  A lot of cms engines allow you to render your navigation links in a ul block by using your page tree structure. In a lot of cases this is insufficient as some sites have urls that redirect to pages outside of your cms. This is where menus come in. They can be built in the admin control panel.
@@ -105,6 +99,3 @@ TB CMS uses RSpec for testing. Get the tests running with a few short commands:
105
99
  rspec spec
106
100
 
107
101
  After the tests have completed the current code coverage stats is available by opening ```/coverage/index.html``` in a browser.
108
-
109
-
110
-
@@ -2,4 +2,4 @@
2
2
  //= require admin/cms/pages
3
3
  //= require admin/cms/menu_items
4
4
 
5
- spud.admin.cms = {};
5
+ tb.cms = {};
@@ -1,9 +1,9 @@
1
- spud.admin.cms.menu_items = {};
1
+ tb.cms.menu_items = {};
2
2
 
3
3
  (function() {
4
- var menu_items = spud.admin.cms.menu_items;
4
+ var menu_items = tb.cms.menu_items;
5
5
  var val;
6
-
6
+
7
7
  var setUrl = function(){
8
8
  return '/admin/menus/'+ val +'/menu_items/update_sort';
9
9
  };
@@ -35,25 +35,31 @@ spud.admin.cms.menu_items = {};
35
35
  });
36
36
  val = $("#menu-id").val();
37
37
  //Update order of menuItems
38
- $.ajax(setUrl(), {
39
- method: 'PUT',
38
+ $.ajax(setUrl(), {
39
+ method: 'PUT',
40
40
  data: {
41
41
  order: sortArr
42
- },
42
+ },
43
43
  dataType: "json",
44
44
  success: function(data, status, jqXHR) {
45
45
  menu_items.updateStatus(200, '0px 0px 26px 2px rgba(4, 252, -49, 0.59)');
46
46
  },
47
47
  error: function(XMLHttpRequest, textStatus, errorThrown) {
48
48
  menu_items.updateStatus(100, '0px 0px 26px 2px rgba(255, 0, 40, 0.59)');
49
- alert("Status: " + textStatus); alert("Error: " + errorThrown);
50
- }
49
+ alert("Status: " + textStatus); alert("Error: " + errorThrown);
50
+ }
51
51
  });
52
52
  }
53
53
  });
54
54
  };
55
55
 
56
56
  menu_items.init = function() {
57
+ return
58
+
59
+ // Sortable relies on jQuery UI, which has been removed
60
+ // This code needs to migrate to sortable.js
61
+ // See: https://bitbucket.org/moser-inc/tb_core/commits/e6252b6aa508e103b54df7e563ecfa2d2ec26c24
62
+ //
57
63
  $("#sort tbody").sortable({
58
64
  helper: fixHelper,
59
65
  cursor: "move",
@@ -1,11 +1,10 @@
1
- spud.admin.cms.pages = {};
1
+ tb.cms.pages = {};
2
2
 
3
3
  (function(){
4
4
 
5
- spud.admin.cms.pages = {
5
+ tb.cms.pages = {
6
6
  edit: function(){
7
- spud.admin.editor.init({selector: '.page-partial-content-editor', width: $("#page_partials_form").width()});
8
- spud.admin.cms.pages.initFormTabs();
7
+ tb.cms.pages.initFormTabs();
9
8
  $(".btn-preview").on('click', clickedPreviewButton);
10
9
  $("#spud_page_layout").on('change', changedLayoutSelection);
11
10
  }
@@ -24,6 +23,9 @@ var clickedPreviewButton = function(e){
24
23
  form.target = '';
25
24
  form.onSubmit = null;
26
25
  previewInput.val(0);
26
+ form.querySelectorAll('.btn').forEach(function(btn) {
27
+ btn.disabled = false;
28
+ });
27
29
  }, 200);
28
30
  };
29
31
 
@@ -34,16 +36,16 @@ var changedLayoutSelection = function(e){
34
36
  spud.admin.editor.unload();
35
37
 
36
38
  $("#page_partials_form").replaceWith(data);
37
- spud.admin.cms.pages.initFormTabs();
39
+ tb.cms.pages.initFormTabs();
38
40
 
39
- spud.admin.editor.init({selector: '.page-partial-content-editor', width: $("#page_partials_form").width()});
41
+ tb.editor.init();
40
42
 
41
43
  }, 'text').error(function(jqXHR) {
42
44
  alert("Error: " + jqXHR.responseText);
43
45
  });
44
46
  };
45
47
 
46
- spud.admin.cms.pages.initFormTabs = function(){
48
+ tb.cms.pages.initFormTabs = function(){
47
49
  var tabNames = [];
48
50
 
49
51
  $('.formtabs .formtab').each(function(tabind) {
@@ -4,7 +4,7 @@ class Admin::PagesController < Admin::ApplicationController
4
4
  before_action :load_page, only: [:edit, :update, :show, :destroy]
5
5
 
6
6
  def index
7
- @pages = SpudPage.where(spud_page_id: nil).order(:page_order).includes(:spud_pages)
7
+ @pages = SpudPage.where(spud_page_id: nil).ordered.includes(:spud_pages)
8
8
  home_page = SpudPage.where(url_name: Spud::Cms.root_page_name).first
9
9
  if home_page.blank?
10
10
  flash.now[:warning] = "You have not setup your default CMS page. This page will be your homepage. To do so, create a page with the name '#{Spud::Cms.root_page_name.titlecase}'"
@@ -1,4 +1,4 @@
1
- class Cms::SitemapsController < Spud::ApplicationController
1
+ class Cms::SitemapsController < TbCore::ApplicationController
2
2
  respond_to :xml
3
3
  def show
4
4
  @pages = SpudPage.published_pages.viewable.order(:spud_page_id)
@@ -12,7 +12,7 @@ class PagesController < ApplicationController
12
12
  end
13
13
 
14
14
  url_name = !params[:id].blank? ? params[:id] : Spud::Cms.root_page_name
15
- @page = SpudPage.published_pages.find_by(url_name: url_name)
15
+ @page = SpudPage.published_pages.find_ignoring_case(url_name)
16
16
 
17
17
  if @page.blank?
18
18
  render_404
@@ -34,11 +34,11 @@ class PagesController < ApplicationController
34
34
  private
35
35
 
36
36
  def render_404
37
- raise Spud::NotFoundError, item: 'page'
38
- end
37
+ raise TbCore::NotFoundError, item: 'page'
38
+ end
39
39
 
40
40
  def set_default_content_type
41
41
  request.format = :html if params[:format].blank?
42
- end
42
+ end
43
43
 
44
44
  end
@@ -85,8 +85,8 @@ module Cms::ApplicationHelper
85
85
  menu_id = menu.id
86
86
  end
87
87
 
88
- cache(['sp_list_menu', menu, options]) do
89
- link_options = options[:link_options] if options.key?(:link_options)
88
+ Rails.cache.fetch(['sp_list_menu', menu, options]) do
89
+ link_options = options[:link_options] if options.has_key?(:link_options)
90
90
 
91
91
  start_menu_item = options[:start_menu_item_id] if options.key?(:start_menu_item_id)
92
92
  content = if options.key?(:id)
@@ -136,8 +136,8 @@ module Cms::ApplicationHelper
136
136
 
137
137
  content += '</ul>'
138
138
 
139
- concat content.html_safe
140
- end
139
+ content
140
+ end.html_safe
141
141
  end
142
142
 
143
143
  def sp_menu_with_seperator(options = {})
@@ -1,7 +1,7 @@
1
1
  class SpudMenuItem < ActiveRecord::Base
2
- belongs_to :parent, polymorphic: true
3
- belongs_to :spud_menu, touch: true
4
- belongs_to :spud_page
2
+ belongs_to :parent, polymorphic: true, required: false
3
+ belongs_to :spud_menu, touch: true, required: false
4
+ belongs_to :spud_page, required: false
5
5
  has_many :spud_menu_items, as: :parent, dependent: :destroy
6
6
 
7
7
  validates :name, presence: true
@@ -2,13 +2,19 @@ class SpudPage < ActiveRecord::Base
2
2
  include CmsDeprecatedMultisite
3
3
  include TbRedirects::HasRedirects
4
4
 
5
- spud_searchable
6
- belongs_to :spud_page
5
+ belongs_to :spud_page,
6
+ required: false
7
7
  has_many :spud_page_partial_revisions
8
8
  has_many :spud_pages, dependent: :nullify
9
9
  has_many :spud_page_partials, dependent: :destroy
10
- belongs_to :created_by_user, class_name: 'SpudUser', foreign_key: :created_by
11
- belongs_to :updated_by_user, class_name: 'SpudUser', foreign_key: :updated_by
10
+ belongs_to :created_by_user,
11
+ class_name: 'SpudUser',
12
+ foreign_key: :created_by,
13
+ required: false
14
+ belongs_to :updated_by_user,
15
+ class_name: 'SpudUser',
16
+ foreign_key: :updated_by,
17
+ required: false
12
18
 
13
19
  before_validation :generate_url_name
14
20
  validates :name, presence: true, uniqueness: { scope: :spud_page_id }
@@ -20,13 +26,15 @@ class SpudPage < ActiveRecord::Base
20
26
  scope :parent_pages, -> { where(spud_page_id: nil) }
21
27
  scope :published_pages, -> { where(published: true) }
22
28
  scope :viewable, -> { where(visibility: 0) }
29
+ scope :ordered, -> { order(page_order: :asc, name: :asc) }
23
30
 
24
31
  def full_content_processed
32
+ ActiveSupport::Deprecation.warn('#full_content_processed is deprecated; use #full_content instead.')
25
33
  spud_page_partials.collect(&:content_processed).join(' ')
26
34
  end
27
35
 
28
- def to_liquid
29
- return { 'name' => name, 'url_name' => url_name }
36
+ def full_content
37
+ spud_page_partials.collect(&:content).join(' ')
30
38
  end
31
39
 
32
40
  # Returns an array of pages in order of heirarchy
@@ -43,7 +51,7 @@ class SpudPage < ActiveRecord::Base
43
51
  if filter.blank? || c.id != filter.id
44
52
  list << [Array.new(level) { '- ' }.join('') + c.name, c[value]]
45
53
  list += options_tree_for_page(collection: collection, parent_id: c.id, level: level + 1, filter: filter)
46
- end
54
+ end
47
55
  end
48
56
  return list
49
57
  end
@@ -52,6 +60,10 @@ class SpudPage < ActiveRecord::Base
52
60
  return visibility == 1
53
61
  end
54
62
 
63
+ def self.find_ignoring_case(url_name)
64
+ find_by(arel_table[:url_name].matches(url_name))
65
+ end
66
+
55
67
  private
56
68
 
57
69
  def generate_url_name
@@ -65,13 +77,13 @@ class SpudPage < ActiveRecord::Base
65
77
  end
66
78
 
67
79
  def create_redirect_if_necessary
68
- if url_name_changed?
69
- TbRedirect.create_smart(source: "/#{url_name_was}",
80
+ if saved_change_to_attribute?(:url_name)
81
+ TbRedirect.create_smart(source: "/#{attribute_before_last_save(:url_name)}",
70
82
  destination: "/#{url_name}",
71
83
  created_by: 'cms',
72
84
  owner: self)
73
85
  end
74
- return true
86
+ true
75
87
  end
76
88
 
77
89
  end
@@ -1,10 +1,8 @@
1
1
  class SpudPagePartial < ActiveRecord::Base
2
2
  belongs_to :spud_page, touch: true
3
- has_many :spud_liquid_tags, as: :attachment, dependent: :destroy
4
3
  validates :name, presence: true
5
4
  before_save :maintain_revisions
6
5
  before_save :update_symbol_name
7
- acts_as_tb_liquid_content
8
6
 
9
7
  def update_symbol_name
10
8
  self.symbol_name = name.parameterize.underscore
@@ -14,24 +12,9 @@ class SpudPagePartial < ActiveRecord::Base
14
12
  return @symbol_name || name.parameterize.underscore
15
13
  end
16
14
 
17
- def postprocess_content
18
- @_template = Liquid::Template.parse(content)
19
- self.content_processed = @_template.render('page' => spud_page)
20
- end
21
-
22
- def content_processed=(content)
23
- self[:content_processed] = content
24
- end
25
-
26
15
  def content_processed
27
- if self[:content_processed].blank?
28
- if new_record?
29
- self.content_processed = postprocess_content()
30
- else
31
- update_column(:content_processed, postprocess_content)
32
- end
33
- end
34
- return self[:content_processed]
16
+ ActiveSupport::Deprecation.warn('#content_processed is deprecated; use #content instead.')
17
+ content
35
18
  end
36
19
 
37
20
  def maintain_revisions
@@ -44,7 +27,7 @@ class SpudPagePartial < ActiveRecord::Base
44
27
  revision_bye = SpudPagePartialRevision.where(spud_page_id: spud_page_id, name: name).order('created_at ASC').first
45
28
  revision_bye.destroy unless revision_bye.blank?
46
29
  end
47
- end
30
+ end
48
31
  return true
49
32
  end
50
33
  end
@@ -4,11 +4,8 @@ class SpudSnippet < ActiveRecord::Base
4
4
  validates :name, presence: true
5
5
  validates :name, uniqueness: true
6
6
 
7
- acts_as_tb_liquid_content
8
-
9
7
  def postprocess_content
10
- template = Liquid::Template.parse(content)
11
- self.content_processed = template.render()
8
+ content
12
9
  end
13
10
 
14
11
  def content_processed=(content)
@@ -21,8 +21,8 @@
21
21
  <input type="hidden" value=<%= @menu.id %> id="menu-id">
22
22
  </div>
23
23
  <script type="text/javascript">
24
- $(document).ready(spud.admin.cms.menu_items.init);
24
+ $(document).ready(tb.cms.menu_items.init);
25
25
  </script>
26
26
 
27
27
  <% end %>
28
-
28
+
@@ -17,7 +17,7 @@
17
17
  <%= f.fields_for :spud_page_partials do |b| %>
18
18
  <div class="formtab tab-pane">
19
19
  <%= b.hidden_field :name, :class => "tab_name" %>
20
- <%= b.text_area :content, :class => "page-partial-content-editor" %>
20
+ <%= b.text_area :content, :class => "page-partial-content-editor tinymce" %>
21
21
  </div>
22
22
  <% end %>
23
23
  </div>
@@ -101,5 +101,5 @@
101
101
  <%= hidden_field_tag "preview", 0 %>
102
102
 
103
103
  <script type="text/javascript">
104
- $(document).ready(spud.admin.cms.pages.edit);
104
+ $(document).ready(tb.cms.pages.edit);
105
105
  </script>
@@ -8,7 +8,7 @@
8
8
  <% if spud_page_partial.id %>
9
9
  <%= hidden_field_tag "spud_page[spud_page_partials_attributes][#{index}][id]", spud_page_partial.id %>
10
10
  <% end %>
11
- <textarea class="page-partial-content-editor" name="spud_page[spud_page_partials_attributes][<%= index %>][content]">
11
+ <textarea class="page-partial-content-editor tinymce" name="spud_page[spud_page_partials_attributes][<%= index %>][content]">
12
12
  <%= spud_page_partial.content %>
13
13
  </textarea>
14
14
  </div>
@@ -10,6 +10,6 @@
10
10
  <%= link_to 'Delete', admin_page_path(page), :method => :delete, :data => {:confirm => 'Are you sure?"'}, :class => 'btn btn-danger btn-sm' %>
11
11
  </td>
12
12
  </tr>
13
- <% page.spud_pages.each do |page| %>
13
+ <% page.spud_pages.ordered.each do |page| %>
14
14
  <%= render :partial => 'page_row', :locals => {:depth => depth+1, :page => page} %>
15
15
  <% end %>
@@ -1,20 +1,17 @@
1
-
2
1
  <%=content_for :head do%>
3
- <meta name="description" content="<%=@page.meta_description%>" />
4
-
5
- <meta name="keywords" content="<%=@page.meta_keywords%>" />
2
+ <meta name="description" content="<%=@page.meta_description%>" />
3
+ <meta name="keywords" content="<%=@page.meta_keywords%>" />
6
4
  <% end %>
7
5
 
8
- <%if !@inline.blank?%>
9
- <%=render :inline => @inline%>
6
+ <% if !@inline.blank? %>
7
+ <%= render :inline => @inline %>
10
8
  <% end %>
11
- <%@page.spud_page_partials.each do |page_partial|%>
12
-
13
- <%if(page_partial.name.downcase == 'body' && Spud::Cms.yield_body_as_content_block == false)%>
14
- <%=page_partial.postprocess_content.html_safe%>
15
- <%else%>
16
- <%=content_for page_partial.name.parameterize.underscore.to_sym do%>
17
- <%=page_partial.postprocess_content.html_safe%>
18
- <% end %>
19
- <% end %>
9
+ <% @page.spud_page_partials.each do |page_partial| %>
10
+ <% if page_partial.name.downcase == 'body' && Spud::Cms.yield_body_as_content_block == false %>
11
+ <%= page_partial.content.html_safe %>
12
+ <% else %>
13
+ <%= content_for page_partial.name.parameterize.underscore.to_sym do %>
14
+ <%= page_partial.content.html_safe %>
15
+ <% end %>
16
+ <% end %>
20
17
  <% end %>
@@ -17,12 +17,12 @@
17
17
  <% @page.spud_page_partials.each do |page_partial| %>
18
18
  <% if(page_partial.name.match(/^body$/i) && Spud::Cms.yield_body_as_content_block == false) %>
19
19
  <% cache(page_partial) do %>
20
- <%= page_partial.content_processed.html_safe %>
20
+ <%= page_partial.content.html_safe %>
21
21
  <% end %>
22
22
  <% else%>
23
23
  <%= content_for page_partial.symbol_name.to_sym do %>
24
24
  <% cache(page_partial) do %>
25
- <%= page_partial.content_processed.html_safe %>
25
+ <%= page_partial.content.html_safe %>
26
26
  <% end %>
27
27
  <% end %>
28
28
  <% end %>
@@ -1,4 +1,4 @@
1
- class CreateSpudPages < ActiveRecord::Migration
1
+ class CreateSpudPages < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :spud_pages do |t|
4
4
  t.string :name