tb_cms 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -9
- data/app/assets/javascripts/admin/cms/menu_items.js +12 -6
- data/app/controllers/cms/sitemaps_controller.rb +1 -1
- data/app/helpers/cms/application_helper.rb +4 -4
- data/app/models/spud_page.rb +4 -3
- data/app/models/spud_page_partial.rb +3 -20
- data/app/models/spud_snippet.rb +1 -4
- data/app/views/pages/show.html.erb +2 -2
- data/db/migrate/20120101192412_create_spud_pages.rb +1 -1
- data/db/migrate/20120101193138_create_spud_menus.rb +1 -1
- data/db/migrate/20120101193255_create_spud_menu_items.rb +1 -1
- data/db/migrate/20120101194124_create_spud_templates.rb +1 -1
- data/db/migrate/20120103034659_create_spud_page_partials.rb +1 -1
- data/db/migrate/20120104194032_add_visibility_to_spud_pages.rb +1 -1
- data/db/migrate/20120107181337_add_menu_name_to_spud_menu_items.rb +1 -1
- data/db/migrate/20120111134754_add_use_custom_url_name_to_spud_pages.rb +1 -1
- data/db/migrate/20120118141852_add_notes_to_spud_pages.rb +1 -1
- data/db/migrate/20120126232428_add_menu_id_to_spud_menu_items.rb +1 -1
- data/db/migrate/20120128163601_add_classes_to_spud_menu_items.rb +1 -1
- data/db/migrate/20120329132314_add_site_id_to_spud_pages.rb +1 -1
- data/db/migrate/20120329132322_add_site_id_to_spud_templates.rb +1 -1
- data/db/migrate/20120329132330_add_site_id_to_spud_menus.rb +1 -1
- data/db/migrate/20120510195151_create_spud_page_partial_revisions.rb +1 -1
- data/db/migrate/20120911190030_add_symbol_name_to_spud_page_partials.rb +1 -1
- data/db/migrate/20120912121313_modify_site_id_for_spud_pages.rb +1 -1
- data/db/migrate/20121016233715_add_content_processed_to_spud_page_partials.rb +1 -1
- data/db/migrate/20121112151110_add_layout_to_spud_pages.rb +1 -1
- data/db/migrate/20121119025608_create_spud_snippets.rb +1 -1
- data/db/migrate/20150108162839_remove_site_id_from_cms_tables.rb +1 -1
- data/db/migrate/20150622161403_add_title_tag_to_spud_page.rb +1 -1
- data/lib/spud_cms/engine.rb +1 -6
- data/lib/spud_cms/version.rb +1 -1
- data/lib/tb_cms.rb +0 -1
- data/spec/dummy/app/controllers/application_controller.rb +1 -1
- data/spec/dummy/db/migrate/20141231214446_create_spud_admin_permissions.tb_core.rb +1 -1
- data/spec/dummy/db/migrate/20141231214447_create_spud_users.tb_core.rb +1 -1
- data/spec/dummy/db/migrate/20141231214448_add_time_zone_to_spud_user.tb_core.rb +1 -1
- data/spec/dummy/db/migrate/20141231214449_add_scope_to_spud_admin_permissions.tb_core.rb +1 -1
- data/spec/dummy/db/migrate/20141231214450_create_spud_user_settings.tb_core.rb +1 -1
- data/spec/dummy/db/migrate/20141231214451_create_spud_roles.tb_core.rb +1 -1
- data/spec/dummy/db/migrate/20141231214452_create_spud_permissions.tb_core.rb +1 -1
- data/spec/dummy/db/migrate/20141231214453_create_spud_role_permissions.tb_core.rb +1 -1
- data/spec/dummy/db/migrate/20141231214454_drop_spud_admin_permissions.tb_core.rb +1 -1
- data/spec/dummy/db/migrate/20141231214455_create_spud_permalinks.tb_permalinks.rb +1 -1
- data/spec/dummy/db/migrate/20141231214456_add_site_id_to_spud_permalinks.tb_permalinks.rb +1 -1
- data/spec/dummy/db/migrate/20141231214457_modify_site_id_for_spud_permalinks.tb_permalinks.rb +1 -1
- data/spec/dummy/db/migrate/20141231214459_create_spud_pages.tb_cms.rb +1 -1
- data/spec/dummy/db/migrate/20141231214460_create_spud_menus.tb_cms.rb +1 -1
- data/spec/dummy/db/migrate/20141231214461_create_spud_menu_items.tb_cms.rb +1 -1
- data/spec/dummy/db/migrate/20141231214462_create_spud_templates.tb_cms.rb +1 -1
- data/spec/dummy/db/migrate/20141231214463_create_spud_page_partials.tb_cms.rb +1 -1
- data/spec/dummy/db/migrate/20141231214464_add_visibility_to_spud_pages.tb_cms.rb +1 -1
- data/spec/dummy/db/migrate/20141231214465_add_menu_name_to_spud_menu_items.tb_cms.rb +1 -1
- data/spec/dummy/db/migrate/20141231214466_add_use_custom_url_name_to_spud_pages.tb_cms.rb +1 -1
- data/spec/dummy/db/migrate/20141231214467_add_notes_to_spud_pages.tb_cms.rb +1 -1
- data/spec/dummy/db/migrate/20141231214468_add_menu_id_to_spud_menu_items.tb_cms.rb +1 -1
- data/spec/dummy/db/migrate/20141231214469_add_classes_to_spud_menu_items.tb_cms.rb +1 -1
- data/spec/dummy/db/migrate/20141231214470_add_site_id_to_spud_pages.tb_cms.rb +1 -1
- data/spec/dummy/db/migrate/20141231214471_add_site_id_to_spud_templates.tb_cms.rb +1 -1
- data/spec/dummy/db/migrate/20141231214472_add_site_id_to_spud_menus.tb_cms.rb +1 -1
- data/spec/dummy/db/migrate/20141231214473_create_spud_page_partial_revisions.tb_cms.rb +1 -1
- data/spec/dummy/db/migrate/20141231214474_add_symbol_name_to_spud_page_partials.tb_cms.rb +1 -1
- data/spec/dummy/db/migrate/20141231214475_modify_site_id_for_spud_pages.tb_cms.rb +1 -1
- data/spec/dummy/db/migrate/20141231214476_add_content_processed_to_spud_page_partials.tb_cms.rb +1 -1
- data/spec/dummy/db/migrate/20141231214477_add_layout_to_spud_pages.tb_cms.rb +1 -1
- data/spec/dummy/db/migrate/20141231214479_create_spud_snippets.tb_cms.rb +1 -1
- data/spec/dummy/db/migrate/20150108164814_remove_site_id_from_cms_tables.tb_cms.rb +1 -1
- data/spec/dummy/db/migrate/20150911185843_add_requires_password_change_to_spud_users.tb_core.rb +1 -1
- data/spec/dummy/db/migrate/20150911185844_add_title_tag_to_spud_page.tb_cms.rb +1 -1
- data/spec/dummy/db/migrate/20160215180157_create_tb_redirects.tb_redirects.rb +1 -1
- data/spec/dummy/db/schema.rb +0 -10
- data/spec/helpers/cms/application_helper_spec.rb +8 -8
- metadata +2 -28
- data/db/migrate/20121112212113_create_spud_page_liquid_tags.rb +0 -11
- data/db/migrate/20121119030136_change_liquid_tags_to_polymorphic.rb +0 -17
- data/db/migrate/20140110142037_drop_spud_page_liquid_tags.rb +0 -31
- data/lib/spud_cms/liquid_snippet.rb +0 -27
- data/spec/dummy/db/migrate/20141231214458_create_tb_liquid_spud_liquid_tags.tb_liquid.rb +0 -13
- data/spec/dummy/db/migrate/20141231214478_create_spud_page_liquid_tags.tb_cms.rb +0 -12
- data/spec/dummy/db/migrate/20141231214480_change_liquid_tags_to_polymorphic.tb_cms.rb +0 -18
- 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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71c7f1ff25083a54d690e16a3ddd75126bc67cbc
|
4
|
+
data.tar.gz: f6c6451194dbd039b601e24676951249c08530a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 586998011f575c2f7943e91df9c37372db0e4c8cf499104a1b0d5088cd4ec22ed45607b5403d2cb014609cfdb464109f19e3469320aac350877b6b602272b3c0
|
7
|
+
data.tar.gz: 8e837878a843444b59001314982a60f046f984961675629f1af7ea4dd414c898317cc00038636a8ec60029178b6224065cefda0f8035b3af9d94c34e4a9ed8fd
|
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
|
-
|
@@ -3,7 +3,7 @@ spud.admin.cms.menu_items = {};
|
|
3
3
|
(function() {
|
4
4
|
var menu_items = spud.admin.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",
|
@@ -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.
|
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
|
-
|
140
|
-
end
|
139
|
+
content
|
140
|
+
end.html_safe
|
141
141
|
end
|
142
142
|
|
143
143
|
def sp_menu_with_seperator(options = {})
|
data/app/models/spud_page.rb
CHANGED
@@ -22,11 +22,12 @@ class SpudPage < ActiveRecord::Base
|
|
22
22
|
scope :viewable, -> { where(visibility: 0) }
|
23
23
|
|
24
24
|
def full_content_processed
|
25
|
+
ActiveSupport::Deprecation.warn('#full_content_processed is deprecated; use #full_content instead.')
|
25
26
|
spud_page_partials.collect(&:content_processed).join(' ')
|
26
27
|
end
|
27
28
|
|
28
|
-
def
|
29
|
-
|
29
|
+
def full_content
|
30
|
+
spud_page_partials.collect(&:content).join(' ')
|
30
31
|
end
|
31
32
|
|
32
33
|
# Returns an array of pages in order of heirarchy
|
@@ -43,7 +44,7 @@ class SpudPage < ActiveRecord::Base
|
|
43
44
|
if filter.blank? || c.id != filter.id
|
44
45
|
list << [Array.new(level) { '- ' }.join('') + c.name, c[value]]
|
45
46
|
list += options_tree_for_page(collection: collection, parent_id: c.id, level: level + 1, filter: filter)
|
46
|
-
|
47
|
+
end
|
47
48
|
end
|
48
49
|
return list
|
49
50
|
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
|
-
|
28
|
-
|
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
|
-
|
30
|
+
end
|
48
31
|
return true
|
49
32
|
end
|
50
33
|
end
|
data/app/models/spud_snippet.rb
CHANGED
@@ -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
|
-
|
11
|
-
self.content_processed = template.render()
|
8
|
+
content
|
12
9
|
end
|
13
10
|
|
14
11
|
def content_processed=(content)
|
@@ -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.
|
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.
|
25
|
+
<%= page_partial.content.html_safe %>
|
26
26
|
<% end %>
|
27
27
|
<% end %>
|
28
28
|
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class ModifySiteIdForSpudPages < ActiveRecord::Migration
|
1
|
+
class ModifySiteIdForSpudPages < ActiveRecord::Migration[4.2]
|
2
2
|
def up
|
3
3
|
change_column :spud_pages,:site_id,:integer,:default => 0,:null => false
|
4
4
|
change_column :spud_templates,:site_id,:integer,:default => 0,:null => false
|
data/lib/spud_cms/engine.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'tb_core'
|
2
2
|
require 'tb_redirects'
|
3
|
-
require 'tb_liquid'
|
4
3
|
|
5
4
|
module Spud
|
6
5
|
module Cms
|
@@ -40,12 +39,8 @@ module Spud
|
|
40
39
|
Rails.application.config.assets.precompile += ['admin/pages_thumb.png', 'admin/snippets_thumb.png', 'admin/menus_thumb.png']
|
41
40
|
end
|
42
41
|
|
43
|
-
initializer :liquid do |_config|
|
44
|
-
Liquid::Template.register_tag('snippet', Spud::Cms::LiquidSnippet)
|
45
|
-
end
|
46
|
-
|
47
42
|
initializer :template_parser do |_config|
|
48
|
-
@template_parser = Spud::Cms::TemplateParser.new
|
43
|
+
@template_parser = Spud::Cms::TemplateParser.new
|
49
44
|
end
|
50
45
|
|
51
46
|
def template_parser
|
data/lib/spud_cms/version.rb
CHANGED
data/lib/tb_cms.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# This migration comes from tb_core (originally 20111214161011)
|
2
|
-
class CreateSpudAdminPermissions < ActiveRecord::Migration
|
2
|
+
class CreateSpudAdminPermissions < ActiveRecord::Migration[4.2]
|
3
3
|
def change
|
4
4
|
create_table :spud_admin_permissions do |t|
|
5
5
|
t.integer :user_id
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# This migration comes from tb_core (originally 20120328235431)
|
2
|
-
class AddScopeToSpudAdminPermissions < ActiveRecord::Migration
|
2
|
+
class AddScopeToSpudAdminPermissions < ActiveRecord::Migration[4.2]
|
3
3
|
def change
|
4
4
|
add_column :spud_admin_permissions, :scope, :string
|
5
5
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# This migration comes from tb_core (originally 20130620151132)
|
2
|
-
class CreateSpudRolePermissions < ActiveRecord::Migration
|
2
|
+
class CreateSpudRolePermissions < ActiveRecord::Migration[4.2]
|
3
3
|
def change
|
4
4
|
create_table :spud_role_permissions do |t|
|
5
5
|
t.integer :spud_role_id, null: false
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# This migration comes from tb_permalinks (originally 20120329135522)
|
2
|
-
class AddSiteIdToSpudPermalinks < ActiveRecord::Migration
|
2
|
+
class AddSiteIdToSpudPermalinks < ActiveRecord::Migration[4.2]
|
3
3
|
def change
|
4
4
|
add_column :spud_permalinks, :site_id, :integer
|
5
5
|
add_index :spud_permalinks, :site_id, name: 'idx_permalinks_site_id'
|
data/spec/dummy/db/migrate/20141231214457_modify_site_id_for_spud_permalinks.tb_permalinks.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# This migration comes from tb_permalinks (originally 20120912123700)
|
2
|
-
class ModifySiteIdForSpudPermalinks < ActiveRecord::Migration
|
2
|
+
class ModifySiteIdForSpudPermalinks < ActiveRecord::Migration[4.2]
|
3
3
|
def up
|
4
4
|
change_column :spud_permalinks, :site_id, :integer, default: 0, null: false
|
5
5
|
# SpudPermalink.where(:site_id => nil).each {|f| f.site_id = 0 ; f.save}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# This migration comes from tb_cms (originally 20120104194032)
|
2
|
-
class AddVisibilityToSpudPages < ActiveRecord::Migration
|
2
|
+
class AddVisibilityToSpudPages < ActiveRecord::Migration[4.2]
|
3
3
|
def change
|
4
4
|
add_column :spud_pages, :visibility, :integer, default: 0
|
5
5
|
add_column :spud_pages, :published, :boolean, default: true
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# This migration comes from tb_cms (originally 20120111134754)
|
2
|
-
class AddUseCustomUrlNameToSpudPages < ActiveRecord::Migration
|
2
|
+
class AddUseCustomUrlNameToSpudPages < ActiveRecord::Migration[4.2]
|
3
3
|
def change
|
4
4
|
add_column :spud_pages, :use_custom_url_name, :boolean, default: false
|
5
5
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# This migration comes from tb_cms (originally 20120329132322)
|
2
|
-
class AddSiteIdToSpudTemplates < ActiveRecord::Migration
|
2
|
+
class AddSiteIdToSpudTemplates < ActiveRecord::Migration[4.2]
|
3
3
|
def change
|
4
4
|
add_column :spud_templates, :site_id, :integer
|
5
5
|
add_index :spud_templates, :site_id
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# This migration comes from tb_cms (originally 20120510195151)
|
2
|
-
class CreateSpudPagePartialRevisions < ActiveRecord::Migration
|
2
|
+
class CreateSpudPagePartialRevisions < ActiveRecord::Migration[4.2]
|
3
3
|
def change
|
4
4
|
create_table :spud_page_partial_revisions do |t|
|
5
5
|
t.string :name
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# This migration comes from tb_cms (originally 20120911190030)
|
2
|
-
class AddSymbolNameToSpudPagePartials < ActiveRecord::Migration
|
2
|
+
class AddSymbolNameToSpudPagePartials < ActiveRecord::Migration[4.2]
|
3
3
|
def change
|
4
4
|
add_column :spud_page_partials, :symbol_name, :string
|
5
5
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# This migration comes from tb_cms (originally 20120912121313)
|
2
|
-
class ModifySiteIdForSpudPages < ActiveRecord::Migration
|
2
|
+
class ModifySiteIdForSpudPages < ActiveRecord::Migration[4.2]
|
3
3
|
def up
|
4
4
|
change_column :spud_pages, :site_id, :integer, default: 0, null: false
|
5
5
|
change_column :spud_templates, :site_id, :integer, default: 0, null: false
|
data/spec/dummy/db/migrate/20141231214476_add_content_processed_to_spud_page_partials.tb_cms.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# This migration comes from tb_cms (originally 20121016233715)
|
2
|
-
class AddContentProcessedToSpudPagePartials < ActiveRecord::Migration
|
2
|
+
class AddContentProcessedToSpudPagePartials < ActiveRecord::Migration[4.2]
|
3
3
|
def change
|
4
4
|
add_column :spud_page_partials, :content_processed, :text
|
5
5
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# This migration comes from tb_cms (originally 20150108162839)
|
2
|
-
class RemoveSiteIdFromCmsTables < ActiveRecord::Migration
|
2
|
+
class RemoveSiteIdFromCmsTables < ActiveRecord::Migration[4.2]
|
3
3
|
def up
|
4
4
|
remove_column :spud_menus, :site_id
|
5
5
|
remove_column :spud_pages, :site_id
|
data/spec/dummy/db/migrate/20150911185843_add_requires_password_change_to_spud_users.tb_core.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# This migration comes from tb_core (originally 20150610143438)
|
2
|
-
class AddRequiresPasswordChangeToSpudUsers < ActiveRecord::Migration
|
2
|
+
class AddRequiresPasswordChangeToSpudUsers < ActiveRecord::Migration[4.2]
|
3
3
|
def change
|
4
4
|
add_column :spud_users, :requires_password_change, :boolean, default: false
|
5
5
|
end
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -12,16 +12,6 @@
|
|
12
12
|
|
13
13
|
ActiveRecord::Schema.define(version: 20160215180157) do
|
14
14
|
|
15
|
-
create_table "spud_liquid_tags", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
|
16
|
-
t.integer "attachment_id"
|
17
|
-
t.string "attachment_type"
|
18
|
-
t.string "tag_name"
|
19
|
-
t.string "value"
|
20
|
-
t.datetime "created_at"
|
21
|
-
t.datetime "updated_at"
|
22
|
-
t.index ["tag_name", "value"], name: "index_spud_liquid_tags_on_tag_name_and_value", using: :btree
|
23
|
-
end
|
24
|
-
|
25
15
|
create_table "spud_menu_items", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
|
26
16
|
t.string "parent_type"
|
27
17
|
t.integer "parent_id"
|
@@ -10,16 +10,16 @@ describe Cms::ApplicationHelper, type: :helper do
|
|
10
10
|
menu = FactoryGirl.create(:spud_menu, name: 'Main')
|
11
11
|
2.times { |_x| FactoryGirl.create(:spud_menu_item, parent_id: menu.id, spud_menu_id: menu.id, url: '/') }
|
12
12
|
|
13
|
-
helper.sp_list_menu(name: 'Main', active_class: 'active')
|
14
|
-
expect(
|
13
|
+
result = helper.sp_list_menu(name: 'Main', active_class: 'active')
|
14
|
+
expect(result).to match /\<li/
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'should assign id to ul block' do
|
18
18
|
menu = FactoryGirl.create(:spud_menu)
|
19
19
|
2.times { |_x| s = FactoryGirl.create(:spud_menu_item, parent_id: menu.id, spud_menu_id: menu.id, url: '/') }
|
20
20
|
|
21
|
-
helper.sp_list_menu(name: menu.name, id: 'nav')
|
22
|
-
expect(
|
21
|
+
result = helper.sp_list_menu(name: menu.name, id: 'nav')
|
22
|
+
expect(result).to match /id=\'nav\'/
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'should render nested menu items' do
|
@@ -28,8 +28,8 @@ describe Cms::ApplicationHelper, type: :helper do
|
|
28
28
|
s2 = FactoryGirl.create(:spud_menu_item, parent_id: menu.id, spud_menu_id: menu.id, url: '/')
|
29
29
|
s3 = FactoryGirl.create(:spud_menu_item, parent_type: 'SpudMenuItem', parent_id: s.id, spud_menu_id: menu.id, url: '/', name: 'SubItem')
|
30
30
|
|
31
|
-
helper.sp_list_menu(name: 'Main2')
|
32
|
-
expect(
|
31
|
+
result = helper.sp_list_menu(name: 'Main2')
|
32
|
+
expect(result).to match /SubItem/
|
33
33
|
end
|
34
34
|
|
35
35
|
it 'should respect max depth' do
|
@@ -38,8 +38,8 @@ describe Cms::ApplicationHelper, type: :helper do
|
|
38
38
|
s2 = FactoryGirl.create(:spud_menu_item, parent_id: menu.id, spud_menu_id: menu.id, url: '/')
|
39
39
|
s3 = FactoryGirl.create(:spud_menu_item, parent_type: 'SpudMenuItem', parent_id: s.id, spud_menu_id: menu.id, url: '/', name: 'SubItem')
|
40
40
|
|
41
|
-
helper.sp_list_menu(name: 'Main4', max_depth: 1)
|
42
|
-
expect(
|
41
|
+
result = helper.sp_list_menu(name: 'Main4', max_depth: 1)
|
42
|
+
expect(result).to_not match /SubItem/
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tb_cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Moser Consulting
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 1.0.beta1
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: tb_liquid
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 1.1.beta1
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 1.1.beta1
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: mysql2
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -240,10 +226,7 @@ files:
|
|
240
226
|
- db/migrate/20120912121313_modify_site_id_for_spud_pages.rb
|
241
227
|
- db/migrate/20121016233715_add_content_processed_to_spud_page_partials.rb
|
242
228
|
- db/migrate/20121112151110_add_layout_to_spud_pages.rb
|
243
|
-
- db/migrate/20121112212113_create_spud_page_liquid_tags.rb
|
244
229
|
- db/migrate/20121119025608_create_spud_snippets.rb
|
245
|
-
- db/migrate/20121119030136_change_liquid_tags_to_polymorphic.rb
|
246
|
-
- db/migrate/20140110142037_drop_spud_page_liquid_tags.rb
|
247
230
|
- db/migrate/20150108162839_remove_site_id_from_cms_tables.rb
|
248
231
|
- db/migrate/20150622161403_add_title_tag_to_spud_page.rb
|
249
232
|
- lib/generators/spud/cms/layout_generator.rb
|
@@ -251,7 +234,6 @@ files:
|
|
251
234
|
- lib/generators/spud/cms/templates/layout_actions.rb
|
252
235
|
- lib/spud_cms/configuration.rb
|
253
236
|
- lib/spud_cms/engine.rb
|
254
|
-
- lib/spud_cms/liquid_snippet.rb
|
255
237
|
- lib/spud_cms/page_route.rb
|
256
238
|
- lib/spud_cms/template_parser.rb
|
257
239
|
- lib/spud_cms/test_files.rb
|
@@ -299,7 +281,6 @@ files:
|
|
299
281
|
- spec/dummy/db/migrate/20141231214455_create_spud_permalinks.tb_permalinks.rb
|
300
282
|
- spec/dummy/db/migrate/20141231214456_add_site_id_to_spud_permalinks.tb_permalinks.rb
|
301
283
|
- spec/dummy/db/migrate/20141231214457_modify_site_id_for_spud_permalinks.tb_permalinks.rb
|
302
|
-
- spec/dummy/db/migrate/20141231214458_create_tb_liquid_spud_liquid_tags.tb_liquid.rb
|
303
284
|
- spec/dummy/db/migrate/20141231214459_create_spud_pages.tb_cms.rb
|
304
285
|
- spec/dummy/db/migrate/20141231214460_create_spud_menus.tb_cms.rb
|
305
286
|
- spec/dummy/db/migrate/20141231214461_create_spud_menu_items.tb_cms.rb
|
@@ -319,10 +300,7 @@ files:
|
|
319
300
|
- spec/dummy/db/migrate/20141231214475_modify_site_id_for_spud_pages.tb_cms.rb
|
320
301
|
- spec/dummy/db/migrate/20141231214476_add_content_processed_to_spud_page_partials.tb_cms.rb
|
321
302
|
- spec/dummy/db/migrate/20141231214477_add_layout_to_spud_pages.tb_cms.rb
|
322
|
-
- spec/dummy/db/migrate/20141231214478_create_spud_page_liquid_tags.tb_cms.rb
|
323
303
|
- spec/dummy/db/migrate/20141231214479_create_spud_snippets.tb_cms.rb
|
324
|
-
- spec/dummy/db/migrate/20141231214480_change_liquid_tags_to_polymorphic.tb_cms.rb
|
325
|
-
- spec/dummy/db/migrate/20141231214481_drop_spud_page_liquid_tags.tb_cms.rb
|
326
304
|
- spec/dummy/db/migrate/20150108164814_remove_site_id_from_cms_tables.tb_cms.rb
|
327
305
|
- spec/dummy/db/migrate/20150911185843_add_requires_password_change_to_spud_users.tb_core.rb
|
328
306
|
- spec/dummy/db/migrate/20150911185844_add_title_tag_to_spud_page.tb_cms.rb
|
@@ -404,7 +382,6 @@ test_files:
|
|
404
382
|
- spec/dummy/db/migrate/20141231214455_create_spud_permalinks.tb_permalinks.rb
|
405
383
|
- spec/dummy/db/migrate/20141231214456_add_site_id_to_spud_permalinks.tb_permalinks.rb
|
406
384
|
- spec/dummy/db/migrate/20141231214457_modify_site_id_for_spud_permalinks.tb_permalinks.rb
|
407
|
-
- spec/dummy/db/migrate/20141231214458_create_tb_liquid_spud_liquid_tags.tb_liquid.rb
|
408
385
|
- spec/dummy/db/migrate/20141231214459_create_spud_pages.tb_cms.rb
|
409
386
|
- spec/dummy/db/migrate/20141231214460_create_spud_menus.tb_cms.rb
|
410
387
|
- spec/dummy/db/migrate/20141231214461_create_spud_menu_items.tb_cms.rb
|
@@ -424,10 +401,7 @@ test_files:
|
|
424
401
|
- spec/dummy/db/migrate/20141231214475_modify_site_id_for_spud_pages.tb_cms.rb
|
425
402
|
- spec/dummy/db/migrate/20141231214476_add_content_processed_to_spud_page_partials.tb_cms.rb
|
426
403
|
- spec/dummy/db/migrate/20141231214477_add_layout_to_spud_pages.tb_cms.rb
|
427
|
-
- spec/dummy/db/migrate/20141231214478_create_spud_page_liquid_tags.tb_cms.rb
|
428
404
|
- spec/dummy/db/migrate/20141231214479_create_spud_snippets.tb_cms.rb
|
429
|
-
- spec/dummy/db/migrate/20141231214480_change_liquid_tags_to_polymorphic.tb_cms.rb
|
430
|
-
- spec/dummy/db/migrate/20141231214481_drop_spud_page_liquid_tags.tb_cms.rb
|
431
405
|
- spec/dummy/db/migrate/20150108164814_remove_site_id_from_cms_tables.tb_cms.rb
|
432
406
|
- spec/dummy/db/migrate/20150911185843_add_requires_password_change_to_spud_users.tb_core.rb
|
433
407
|
- spec/dummy/db/migrate/20150911185844_add_title_tag_to_spud_page.tb_cms.rb
|
@@ -1,11 +0,0 @@
|
|
1
|
-
class CreateSpudPageLiquidTags < ActiveRecord::Migration
|
2
|
-
def change
|
3
|
-
create_table :spud_page_liquid_tags do |t|
|
4
|
-
t.integer :spud_page_partial_id
|
5
|
-
t.string :tag_name
|
6
|
-
t.string :value
|
7
|
-
t.timestamps
|
8
|
-
end
|
9
|
-
add_index :spud_page_liquid_tags, [:tag_name,:value]
|
10
|
-
end
|
11
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
class ChangeLiquidTagsToPolymorphic < ActiveRecord::Migration
|
2
|
-
def up
|
3
|
-
rename_column :spud_page_liquid_tags, :spud_page_partial_id, :attachment_id
|
4
|
-
add_column :spud_page_liquid_tags, :attachment_type, :string
|
5
|
-
add_index :spud_page_liquid_tags, [:attachment_type, :attachment_id], :name => 'inde_spud_page_liquid_tags_on_attachment'
|
6
|
-
if defined?(SpudPageLiquidTag)
|
7
|
-
SpudPageLiquidTag.all.each do |f|
|
8
|
-
f.update_attributes(:attachment_type => "SpudPagePartial")
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def down
|
14
|
-
rename_column :spud_page_liquid_tags, :attachment_id, :spud_page_partial_id
|
15
|
-
remove_column :spud_page_liquid_tags, :attachment_type
|
16
|
-
end
|
17
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
class DropSpudPageLiquidTags < ActiveRecord::Migration
|
2
|
-
|
3
|
-
class SpudPageLiquidTag < ActiveRecord::Base
|
4
|
-
end
|
5
|
-
|
6
|
-
def up
|
7
|
-
if defined?(SpudLiquidTag)
|
8
|
-
SpudPageLiquidTag.all.each do |tag|
|
9
|
-
SpudLiquidTag.create({
|
10
|
-
:attachment_id => tag.attachment_id,
|
11
|
-
:attachment_type => tag.attachment_type,
|
12
|
-
:tag_name => tag.tag_name,
|
13
|
-
:value => tag.value
|
14
|
-
})
|
15
|
-
end
|
16
|
-
end
|
17
|
-
drop_table :spud_page_liquid_tags
|
18
|
-
end
|
19
|
-
|
20
|
-
def down
|
21
|
-
create_table :spud_page_liquid_tags do |t|
|
22
|
-
t.integer :attachment_id
|
23
|
-
t.string :attachment_type
|
24
|
-
t.string :tag_name
|
25
|
-
t.string :value
|
26
|
-
t.timestamps
|
27
|
-
end
|
28
|
-
add_index :spud_page_liquid_tags, [:tag_name,:value]
|
29
|
-
add_index :spud_page_liquid_tags, [:attachment_type,:attachment_id]
|
30
|
-
end
|
31
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'liquid'
|
2
|
-
module Spud
|
3
|
-
module Cms
|
4
|
-
class LiquidSnippet < Liquid::Tag
|
5
|
-
def initialize(_tag_name, snippet_name, _tokens)
|
6
|
-
@snippet_name = snippet_name
|
7
|
-
@snippet = SpudSnippet.where(name: snippet_name).first
|
8
|
-
end
|
9
|
-
|
10
|
-
def tag_name
|
11
|
-
return 'snippet'
|
12
|
-
end
|
13
|
-
|
14
|
-
def tag_value
|
15
|
-
return @snippet_name
|
16
|
-
end
|
17
|
-
|
18
|
-
def render(_context)
|
19
|
-
if !@snippet.blank?
|
20
|
-
return @snippet.content_processed.html_safe
|
21
|
-
else
|
22
|
-
return ''
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# This migration comes from tb_liquid (originally 20140110142037)
|
2
|
-
class CreateTbLiquidSpudLiquidTags < ActiveRecord::Migration
|
3
|
-
def change
|
4
|
-
create_table :spud_liquid_tags do |t|
|
5
|
-
t.integer :attachment_id
|
6
|
-
t.string :attachment_type
|
7
|
-
t.string :tag_name
|
8
|
-
t.string :value
|
9
|
-
t.timestamps
|
10
|
-
end
|
11
|
-
add_index :spud_liquid_tags, [:tag_name, :value]
|
12
|
-
end
|
13
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# This migration comes from tb_cms (originally 20121112212113)
|
2
|
-
class CreateSpudPageLiquidTags < ActiveRecord::Migration
|
3
|
-
def change
|
4
|
-
create_table :spud_page_liquid_tags do |t|
|
5
|
-
t.integer :spud_page_partial_id
|
6
|
-
t.string :tag_name
|
7
|
-
t.string :value
|
8
|
-
t.timestamps
|
9
|
-
end
|
10
|
-
add_index :spud_page_liquid_tags, [:tag_name, :value]
|
11
|
-
end
|
12
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# This migration comes from tb_cms (originally 20121119030136)
|
2
|
-
class ChangeLiquidTagsToPolymorphic < ActiveRecord::Migration
|
3
|
-
def up
|
4
|
-
rename_column :spud_page_liquid_tags, :spud_page_partial_id, :attachment_id
|
5
|
-
add_column :spud_page_liquid_tags, :attachment_type, :string
|
6
|
-
add_index :spud_page_liquid_tags, [:attachment_type, :attachment_id], name: 'inde_spud_page_liquid_tags_on_attachment'
|
7
|
-
if defined?(SpudPageLiquidTag)
|
8
|
-
SpudPageLiquidTag.all.each do |f|
|
9
|
-
f.update_attributes(attachment_type: 'SpudPagePartial')
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def down
|
15
|
-
rename_column :spud_page_liquid_tags, :attachment_id, :spud_page_partial_id
|
16
|
-
remove_column :spud_page_liquid_tags, :attachment_type
|
17
|
-
end
|
18
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# This migration comes from tb_cms (originally 20140110142037)
|
2
|
-
class DropSpudPageLiquidTags < ActiveRecord::Migration
|
3
|
-
|
4
|
-
class SpudPageLiquidTag < ActiveRecord::Base
|
5
|
-
end
|
6
|
-
|
7
|
-
def up
|
8
|
-
if defined?(SpudLiquidTag)
|
9
|
-
SpudPageLiquidTag.all.each do |tag|
|
10
|
-
SpudLiquidTag.create(attachment_id: tag.attachment_id,
|
11
|
-
attachment_type: tag.attachment_type,
|
12
|
-
tag_name: tag.tag_name,
|
13
|
-
value: tag.value)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
drop_table :spud_page_liquid_tags
|
17
|
-
end
|
18
|
-
|
19
|
-
def down
|
20
|
-
create_table :spud_page_liquid_tags do |t|
|
21
|
-
t.integer :attachment_id
|
22
|
-
t.string :attachment_type
|
23
|
-
t.string :tag_name
|
24
|
-
t.string :value
|
25
|
-
t.timestamps
|
26
|
-
end
|
27
|
-
add_index :spud_page_liquid_tags, [:tag_name, :value]
|
28
|
-
add_index :spud_page_liquid_tags, [:attachment_type, :attachment_id]
|
29
|
-
end
|
30
|
-
end
|