tb_cms 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/admin/cms/pages.js +3 -0
- data/app/models/spud_menu_item.rb +3 -3
- data/app/models/spud_page.rb +13 -6
- data/app/views/admin/pages/show.html.erb +12 -15
- data/lib/spud_cms/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c7c821abf433b7551fd0945474f55285c337bc4
|
4
|
+
data.tar.gz: 945f3a55ef2288ca26ef6fa3090573c153d5d6ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5da1e47e8ad75547832558aa1b4ece99367437ef577189daf24c0f569189a256a7f67320ff61e13bfab42774edd24279c489447294e95cc09ef3bdbc124111b4
|
7
|
+
data.tar.gz: fd87881e33441d399c6ab0ae5e435e3f8d383119844e628fc3734f50e5d9f904c79d77f78d410123c16e12653478f76803d4cb992e942154ed8ff8abce72551c
|
@@ -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
|
data/app/models/spud_page.rb
CHANGED
@@ -3,12 +3,19 @@ class SpudPage < ActiveRecord::Base
|
|
3
3
|
include TbRedirects::HasRedirects
|
4
4
|
|
5
5
|
spud_searchable
|
6
|
-
belongs_to :spud_page
|
6
|
+
belongs_to :spud_page,
|
7
|
+
required: false
|
7
8
|
has_many :spud_page_partial_revisions
|
8
9
|
has_many :spud_pages, dependent: :nullify
|
9
10
|
has_many :spud_page_partials, dependent: :destroy
|
10
|
-
belongs_to :created_by_user,
|
11
|
-
|
11
|
+
belongs_to :created_by_user,
|
12
|
+
class_name: 'SpudUser',
|
13
|
+
foreign_key: :created_by,
|
14
|
+
required: false
|
15
|
+
belongs_to :updated_by_user,
|
16
|
+
class_name: 'SpudUser',
|
17
|
+
foreign_key: :updated_by,
|
18
|
+
required: false
|
12
19
|
|
13
20
|
before_validation :generate_url_name
|
14
21
|
validates :name, presence: true, uniqueness: { scope: :spud_page_id }
|
@@ -66,13 +73,13 @@ class SpudPage < ActiveRecord::Base
|
|
66
73
|
end
|
67
74
|
|
68
75
|
def create_redirect_if_necessary
|
69
|
-
if
|
70
|
-
TbRedirect.create_smart(source: "/#{
|
76
|
+
if saved_change_to_attribute?(:url_name)
|
77
|
+
TbRedirect.create_smart(source: "/#{attribute_before_last_save(:url_name)}",
|
71
78
|
destination: "/#{url_name}",
|
72
79
|
created_by: 'cms',
|
73
80
|
owner: self)
|
74
81
|
end
|
75
|
-
|
82
|
+
true
|
76
83
|
end
|
77
84
|
|
78
85
|
end
|
@@ -1,20 +1,17 @@
|
|
1
|
-
|
2
1
|
<%=content_for :head do%>
|
3
|
-
|
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
|
-
|
6
|
+
<% if !@inline.blank? %>
|
7
|
+
<%= render :inline => @inline %>
|
10
8
|
<% end %>
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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 %>
|
data/lib/spud_cms/version.rb
CHANGED
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.2
|
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-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 5.
|
19
|
+
version: 5.1.3
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 5.
|
26
|
+
version: 5.1.3
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: tb_core
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|