refinerycms-pages 3.0.5 → 3.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/app/controllers/refinery/pages_controller.rb +4 -4
- data/app/models/refinery/page.rb +4 -4
- data/app/models/refinery/page_part.rb +1 -1
- data/app/presenters/refinery/pages/section_presenter.rb +3 -2
- data/spec/models/refinery/page_part_spec.rb +6 -0
- data/spec/models/refinery/page_url_spec.rb +10 -4
- data/spec/presenters/refinery/pages/section_presenter_spec.rb +14 -4
- metadata +19 -19
- metadata.gz.sig +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f503f368f89b0578401ea340bd135e5aac4a4ef
|
4
|
+
data.tar.gz: f6ea7967a335cf7107ad792f37f87b60f3116968
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 805867400c5c99ff7402ca86e747509a179fceadd081a31518b43706e995b4bfe44a08b2c0c5f9ae4742f4ef1c8dfcb53959d38677f96078ca6ae22c675b79f6
|
7
|
+
data.tar.gz: ef16b436cbc796b1a697c0fdf5e18ce92a26d8869b519ed0de0be351c430ff60a703fee797f209104ddda6a1b061860bd98563eab08921bcb9671a707c9304d9
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
@@ -25,11 +25,11 @@ module Refinery
|
|
25
25
|
#
|
26
26
|
def show
|
27
27
|
if should_skip_to_first_child?
|
28
|
-
redirect_to refinery.url_for(first_live_child.url) and return
|
28
|
+
redirect_to refinery.url_for(first_live_child.url), status: 301 and return
|
29
29
|
elsif page.link_url.present?
|
30
|
-
redirect_to page.link_url and return
|
30
|
+
redirect_to page.link_url, status: 301 and return
|
31
31
|
elsif should_redirect_to_friendly_url?
|
32
|
-
redirect_to refinery.url_for(page.url), :
|
32
|
+
redirect_to refinery.url_for(page.url), status: 301 and return
|
33
33
|
end
|
34
34
|
|
35
35
|
render_with_templates?
|
@@ -66,7 +66,7 @@ module Refinery
|
|
66
66
|
def current_refinery_user_can_access?(plugin)
|
67
67
|
admin? && authorisation_manager.allow?(:plugin, plugin)
|
68
68
|
end
|
69
|
-
|
69
|
+
|
70
70
|
def first_live_child
|
71
71
|
page.children.order('lft ASC').live.first
|
72
72
|
end
|
data/app/models/refinery/page.rb
CHANGED
@@ -163,15 +163,15 @@ module Refinery
|
|
163
163
|
|
164
164
|
# The canonical page for this particular page.
|
165
165
|
# Consists of:
|
166
|
-
# * The
|
166
|
+
# * The current locale's translated slug
|
167
167
|
def canonical
|
168
|
-
Globalize.with_locale(::Refinery::I18n.
|
168
|
+
Globalize.with_locale(::Refinery::I18n.current_frontend_locale) { url }
|
169
169
|
end
|
170
170
|
|
171
171
|
# The canonical slug for this particular page.
|
172
|
-
# This is the slug for the
|
172
|
+
# This is the slug for the current frontend locale.
|
173
173
|
def canonical_slug
|
174
|
-
Globalize.with_locale(::Refinery::I18n.
|
174
|
+
Globalize.with_locale(::Refinery::I18n.current_frontend_locale) { slug }
|
175
175
|
end
|
176
176
|
|
177
177
|
# Returns in cascading order: custom_slug or menu_title or title depending on
|
@@ -16,7 +16,7 @@ module Refinery
|
|
16
16
|
include ActionView::Helpers::SanitizeHelper
|
17
17
|
|
18
18
|
def initialize(initial_hash = {})
|
19
|
-
initial_hash.map do |key, value|
|
19
|
+
{ logger: Rails.logger }.merge(initial_hash).map do |key, value|
|
20
20
|
send("#{key}=", value)
|
21
21
|
end
|
22
22
|
end
|
@@ -62,6 +62,7 @@ module Refinery
|
|
62
62
|
|
63
63
|
private
|
64
64
|
|
65
|
+
attr_accessor :logger
|
65
66
|
attr_writer :id, :fallback_html, :hidden
|
66
67
|
|
67
68
|
def wrap_content_in_tag(content)
|
@@ -77,7 +78,7 @@ module Refinery
|
|
77
78
|
warning << "Refinery::Pages::SectionPresenter#wrap_content_in_tag\n"
|
78
79
|
warning << "HTML attributes and/or elements content has been sanitized\n"
|
79
80
|
warning << "#{::Diffy::Diff.new(input, output).to_s(:color)}\n"
|
80
|
-
warn warning
|
81
|
+
logger.warn warning
|
81
82
|
end
|
82
83
|
|
83
84
|
return output
|
@@ -31,6 +31,12 @@ module Refinery
|
|
31
31
|
expect(part_two.errors[:slug]).to be_empty
|
32
32
|
end
|
33
33
|
|
34
|
+
it 'updates the page updated_at field when changed' do
|
35
|
+
page.save
|
36
|
+
expect(page).to receive(:touch)
|
37
|
+
page.parts.first.update_attribute(:content, 'Modified')
|
38
|
+
end
|
39
|
+
|
34
40
|
context 'when using content_for?' do
|
35
41
|
|
36
42
|
it 'return true when page part has content' do
|
@@ -118,12 +118,15 @@ module Refinery
|
|
118
118
|
expect(default_canonical).to eq(page.canonical)
|
119
119
|
end
|
120
120
|
|
121
|
-
specify
|
121
|
+
specify "translated page returns its pages's canonical" do
|
122
|
+
allow(Refinery::I18n).to receive(:current_frontend_locale).and_return(:ru)
|
123
|
+
|
122
124
|
Globalize.with_locale(:ru) do
|
123
125
|
page.title = ru_page_title
|
124
126
|
page.save
|
125
127
|
|
126
|
-
expect(page.canonical).
|
128
|
+
expect(page.canonical).to_not eq(default_canonical)
|
129
|
+
expect(page.canonical).to eq(page.url)
|
127
130
|
end
|
128
131
|
end
|
129
132
|
end
|
@@ -142,12 +145,15 @@ module Refinery
|
|
142
145
|
expect(default_canonical_slug).to eq(page.canonical_slug)
|
143
146
|
end
|
144
147
|
|
145
|
-
specify "translated page returns
|
148
|
+
specify "translated page returns its page's canonical slug'" do
|
149
|
+
allow(Refinery::I18n).to receive(:current_frontend_locale).and_return(:ru)
|
150
|
+
|
146
151
|
Globalize.with_locale(:ru) do
|
147
152
|
page.title = ru_page_title
|
148
153
|
page.save
|
149
154
|
|
150
|
-
expect(page.canonical_slug).
|
155
|
+
expect(page.canonical_slug).to_not eq(default_canonical_slug)
|
156
|
+
expect(page.canonical_slug).to eq(page.canonical_slug)
|
151
157
|
end
|
152
158
|
end
|
153
159
|
end
|
@@ -113,14 +113,24 @@ module Refinery
|
|
113
113
|
end
|
114
114
|
|
115
115
|
describe "#sanitize_content" do
|
116
|
+
let(:warning) do
|
117
|
+
%Q{\n-- SANITIZED CONTENT WARNING --\nRefinery::Pages::SectionPresenter#wrap_content_in_tag\nHTML attributes and/or elements content has been sanitized\n\e[31m-<dummy></dummy>\e[0m\n\\n\n}
|
118
|
+
end
|
119
|
+
|
116
120
|
it "shows a sanitized content warning" do
|
121
|
+
expect(Rails.logger).to receive(:warn).with(warning)
|
117
122
|
section = SectionPresenter.new
|
118
123
|
section.override_html = %Q{<dummy></dummy>}
|
119
124
|
section.wrapped_html(true)
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
)
|
125
|
+
end
|
126
|
+
|
127
|
+
it "accepts a custom logger" do
|
128
|
+
logger = spy(:logger, warn: true)
|
129
|
+
SectionPresenter.new(logger: logger).tap do |presenter|
|
130
|
+
presenter.override_html = %Q{<dummy></dummy>}
|
131
|
+
presenter.wrapped_html(true)
|
132
|
+
end
|
133
|
+
expect(logger).to have_received(:warn).with(warning)
|
124
134
|
end
|
125
135
|
end
|
126
136
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: refinerycms-pages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Philip Arndt
|
@@ -14,25 +14,25 @@ cert_chain:
|
|
14
14
|
-----BEGIN CERTIFICATE-----
|
15
15
|
MIIDhjCCAm6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBNMQ0wCwYDVQQDDARnZW1z
|
16
16
|
MREwDwYKCZImiZPyLGQBGRYBcDEVMBMGCgmSJomT8ixkARkWBWFybmR0MRIwEAYK
|
17
|
-
|
17
|
+
CZImi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30
|
+
yg48wbdL5gpZwggKWggKX5G9pqv9LjRsSAew6r0WB+5KW+ArCl/iNo9+AdeR3nUx
|
31
|
+
I+L/QiUxYU6XAXSrczL/i7kF5Xc3ZXQYuFsyGW9plA3i9faWUMvGKQc6pvUHIUZC
|
32
|
+
jOQmH9VbgbfUrXYM1YOKdlwW5sPR1f4PKLDlvEE+bppIUgKOgLOIv3i7KwrGvFOq
|
33
|
+
5r7Wz/HY31SM47mkK21saPJG4NvUFEycf0wlpzP657Pl9aVo47aKKbxX
|
34
34
|
-----END CERTIFICATE-----
|
35
|
-
date:
|
35
|
+
date: 2017-10-02 00:00:00.000000000 Z
|
36
36
|
dependencies:
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: friendly_id
|
@@ -108,14 +108,14 @@ dependencies:
|
|
108
108
|
requirements:
|
109
109
|
- - '='
|
110
110
|
- !ruby/object:Gem::Version
|
111
|
-
version: 3.0.
|
111
|
+
version: 3.0.6
|
112
112
|
type: :runtime
|
113
113
|
prerelease: false
|
114
114
|
version_requirements: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
116
|
- - '='
|
117
117
|
- !ruby/object:Gem::Version
|
118
|
-
version: 3.0.
|
118
|
+
version: 3.0.6
|
119
119
|
- !ruby/object:Gem::Dependency
|
120
120
|
name: babosa
|
121
121
|
requirement: !ruby/object:Gem::Requirement
|
@@ -302,7 +302,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
302
302
|
version: '0'
|
303
303
|
requirements: []
|
304
304
|
rubyforge_project: refinerycms
|
305
|
-
rubygems_version: 2.
|
305
|
+
rubygems_version: 2.6.13
|
306
306
|
signing_key:
|
307
307
|
specification_version: 4
|
308
308
|
summary: Pages extension for Refinery CMS
|
metadata.gz.sig
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
1�*��)!w�b�CH*~L'�{`zn�D^�j��9���.Ȗٛ��n�
|
2
|
+
;{�ll俻�g�
|