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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e66573e24ded851715eb030ec7e56c42c7d5fcba
4
- data.tar.gz: a5e7e009811a415a95e5911fcf739d32d3d77151
3
+ metadata.gz: 6f503f368f89b0578401ea340bd135e5aac4a4ef
4
+ data.tar.gz: f6ea7967a335cf7107ad792f37f87b60f3116968
5
5
  SHA512:
6
- metadata.gz: 11f6602c5142b8d36d9663d81d4af8cb99e85c57964b76315dd1c0d49a64ac4d3ff0b2273377ae042e29f77cc31cb54ecd9c5dd5449dada00b332c38fd90d24f
7
- data.tar.gz: 9583d10fff14df271d377f178e3d5763ef4177ec7218888c86227a43fad848f2dec191380c93b423ae04496d20bc9678e1b05d05db8145996997fb0fe494b988
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), :status => 301 and return
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
@@ -163,15 +163,15 @@ module Refinery
163
163
 
164
164
  # The canonical page for this particular page.
165
165
  # Consists of:
166
- # * The default locale's translated slug
166
+ # * The current locale's translated slug
167
167
  def canonical
168
- Globalize.with_locale(::Refinery::I18n.default_frontend_locale) { url }
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 default frontend locale.
172
+ # This is the slug for the current frontend locale.
173
173
  def canonical_slug
174
- Globalize.with_locale(::Refinery::I18n.default_frontend_locale) { slug }
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
@@ -1,7 +1,7 @@
1
1
  module Refinery
2
2
  class PagePart < Refinery::Core::BaseModel
3
3
 
4
- belongs_to :page, :foreign_key => :refinery_page_id
4
+ belongs_to :page, :foreign_key => :refinery_page_id, :touch => true
5
5
 
6
6
  before_validation :set_default_slug
7
7
 
@@ -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 'translated page returns master page' do
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).to eq(default_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 master page's slug'" do
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).to eq(default_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
- @errors.rewind
121
- expect(@errors.read).to eq(
122
- %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}
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.5
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
- CZImiZPyLGQBGRYCaW8wHhcNMTYwNjEwMDMwNjQyWhcNMTcwNjEwMDMwNjQyWjBN
17
+ CZImiZPyLGQBGRYCaW8wHhcNMTcwNzI1MTMxMjIwWhcNMTgwNzI1MTMxMjIwWjBN
18
18
  MQ0wCwYDVQQDDARnZW1zMREwDwYKCZImiZPyLGQBGRYBcDEVMBMGCgmSJomT8ixk
19
19
  ARkWBWFybmR0MRIwEAYKCZImiZPyLGQBGRYCaW8wggEiMA0GCSqGSIb3DQEBAQUA
20
- A4IBDwAwggEKAoIBAQDMLLiiRX/NrRDQxcNO/bPNe51IhKeyACDjTTx0VGCG696t
21
- qdD23F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vG6kMljgYBamucfrAkKdmHWn9ydST3o8RQAcYxS8
30
- bz49gD3c4Nm4P6eEVKFmebO9/MoiM7rMb0lk/xH1drtey/9ulohrg8Dz+BoQJ+9T
31
- m2lJzojOU7w461lPVZtKlDlseu68KvEQ2AdUBBa1b6w3S/EFkcdhErOT7dyQpePI
32
- +wsbjPvdIWsjWQMn6MasZYIVTnenwP2jg+z9HSNxW0NL2vZx8VabpsWGWfrb+koj
33
- rE1h12GTgwaC3r9FOkdnSpClgPYAzTTCJ8kD74qO2zC9pGegrUXdWFM6
28
+ bmR0LmlvMA0GCSqGSIb3DQEBBQUAA4IBAQB12WMsC+yuuIeM0Ib6HUYZ2IbhRnuW
29
+ 4uydNRvKDPdwzjChnOI0POGpcL8O1s1gh+19o/ITq6zRfTLhkwR2ir7XfwHJNppJ
30
+ yg48wbdL5gpZwggKWggKX5G9pqv9LjRsSAew6r0WB+5KW+ArCl/iNo9+AdeR3nUx
31
+ I+L/QiUxYU6XAXSrczL/i7kF5Xc3ZXQYuFsyGW9plA3i9faWUMvGKQc6pvUHIUZC
32
+ jOQmH9VbgbfUrXYM1YOKdlwW5sPR1f4PKLDlvEE+bppIUgKOgLOIv3i7KwrGvFOq
33
+ 5r7Wz/HY31SM47mkK21saPJG4NvUFEycf0wlpzP657Pl9aVo47aKKbxX
34
34
  -----END CERTIFICATE-----
35
- date: 2016-11-23 00:00:00.000000000 Z
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.5
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.5
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.5.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
- "��|-h�/��pA3�.N�|��[��=�|�����=�8C�,���;W�âDfup��?�ܜ�*�����_��l�\zmrܮBe��MnY���MQL1�� @[�k�&��?g�ޖ���04�pءC�d������9��/DG��0�.����!�8���Knj� ����zn�r��S�:l�v�b�i��RK_%iU�Ṣk�����a��80�����K�q�i���v�A�%N��5�:���
1
+ 1�*��)!wbCH*~L'{`zn�D^�j��9���.Ȗٛ��n�
2
+ ;{�ll俻�g�