refinerycms-pages 0.9.9.22 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/admin/pages_controller.rb +1 -1
- data/app/controllers/pages_controller.rb +1 -1
- data/app/models/page.rb +69 -43
- data/app/views/admin/pages/_form.html.erb +1 -1
- data/app/views/admin/pages/_page.html.erb +1 -1
- data/db/migrate/20110329080451_create_seo_meta.rb +18 -2
- data/db/seeds/pages.rb +0 -1
- data/features/step_definitions/page_steps.rb +6 -1
- data/features/visit_pages.feature +15 -1
- data/lib/gemspec.rb +1 -1
- data/lib/pages/marketable_routes.rb +3 -2
- data/lib/refinery/pages/instance_methods.rb +21 -3
- data/lib/refinerycms-pages.rb +1 -1
- data/refinerycms-pages.gemspec +4 -4
- data/spec/models/page_spec.rb +12 -5
- metadata +5 -5
@@ -12,7 +12,7 @@ module Admin
|
|
12
12
|
after_filter lambda{::Page.expire_page_caching}, :only => [:update_positions]
|
13
13
|
|
14
14
|
before_filter :restrict_access, :only => [:create, :update, :update_positions, :destroy], :if => proc {|c|
|
15
|
-
|
15
|
+
::Refinery.i18n_enabled?
|
16
16
|
}
|
17
17
|
|
18
18
|
def new
|
@@ -20,7 +20,7 @@ class PagesController < ApplicationController
|
|
20
20
|
|
21
21
|
if @page.try(:live?) || (refinery_user? && current_user.authorized_plugins.include?("refinery_pages"))
|
22
22
|
# if the admin wants this to be a "placeholder" page which goes to its first child, go to that instead.
|
23
|
-
if @page.skip_to_first_child
|
23
|
+
if @page.skip_to_first_child && (first_live_child = @page.children.order('lft ASC').live.first).present?
|
24
24
|
redirect_to first_live_child.url
|
25
25
|
elsif @page.link_url.present?
|
26
26
|
redirect_to @page.link_url and return
|
data/app/models/page.rb
CHANGED
@@ -2,6 +2,15 @@ require 'globalize3'
|
|
2
2
|
|
3
3
|
class Page < ActiveRecord::Base
|
4
4
|
|
5
|
+
# when a dialog pops up to link to a page, how many pages per page should there be
|
6
|
+
PAGES_PER_DIALOG = 14
|
7
|
+
|
8
|
+
# when listing pages out in the admin area, how many pages should show per page
|
9
|
+
PAGES_PER_ADMIN_INDEX = 20
|
10
|
+
|
11
|
+
# when collecting the pages path how is each of the pages seperated?
|
12
|
+
PATH_SEPARATOR = " - "
|
13
|
+
|
5
14
|
if self.respond_to?(:translates)
|
6
15
|
translates :title, :custom_title, :meta_keywords, :meta_description, :browser_title, :include => :seo_meta
|
7
16
|
|
@@ -34,7 +43,7 @@ class Page < ActiveRecord::Base
|
|
34
43
|
end
|
35
44
|
|
36
45
|
before_create :ensure_locale, :if => proc { |c|
|
37
|
-
|
46
|
+
::Refinery.i18n_enabled?
|
38
47
|
}
|
39
48
|
end
|
40
49
|
|
@@ -71,18 +80,25 @@ class Page < ActiveRecord::Base
|
|
71
80
|
:custom_title, :browser_title, :all_page_part_content]
|
72
81
|
|
73
82
|
before_destroy :deletable?
|
74
|
-
after_save :reposition_parts!, :
|
83
|
+
after_save :reposition_parts!, :invalidate_cached_urls, :expire_page_caching
|
75
84
|
after_destroy :expire_page_caching
|
76
85
|
|
77
86
|
# Wrap up the logic of finding the pages based on the translations table.
|
78
87
|
if defined?(::Page::Translation)
|
79
88
|
def self.with_globalize(conditions = {})
|
80
89
|
conditions = {:locale => Globalize.locale}.merge(conditions)
|
81
|
-
|
90
|
+
globalized_conditions = {}
|
91
|
+
conditions.keys.each do |key|
|
92
|
+
if (translated_attribute_names.map(&:to_s) | %w(locale)).include?(key.to_s)
|
93
|
+
globalized_conditions["#{self.translation_class.table_name}.#{key}"] = conditions.delete(key)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
# A join implies readonly which we don't really want.
|
97
|
+
joins(:translations).where(globalized_conditions).where(conditions).readonly(false)
|
82
98
|
end
|
83
99
|
else
|
84
100
|
def self.with_globalize(conditions = {})
|
85
|
-
where(conditions)
|
101
|
+
where(conditions)
|
86
102
|
end
|
87
103
|
end
|
88
104
|
|
@@ -95,15 +111,6 @@ class Page < ActiveRecord::Base
|
|
95
111
|
# using all of the page_ids we further filter against this model's table.
|
96
112
|
scope :in_menu, proc { where(:show_in_menu => true).with_globalize }
|
97
113
|
|
98
|
-
# when a dialog pops up to link to a page, how many pages per page should there be
|
99
|
-
PAGES_PER_DIALOG = 14
|
100
|
-
|
101
|
-
# when listing pages out in the admin area, how many pages should show per page
|
102
|
-
PAGES_PER_ADMIN_INDEX = 20
|
103
|
-
|
104
|
-
# when collecting the pages path how is each of the pages seperated?
|
105
|
-
PATH_SEPARATOR = " - "
|
106
|
-
|
107
114
|
# Am I allowed to delete this page?
|
108
115
|
# If a link_url is set we don't want to break the link so we don't allow them to delete
|
109
116
|
# If deletable is set to false then we don't allow this page to be deleted. These are often Refinery system pages
|
@@ -122,19 +129,17 @@ class Page < ActiveRecord::Base
|
|
122
129
|
# Before destroying a page we check to see if it's a deletable page or not
|
123
130
|
# Refinery system pages are not deletable.
|
124
131
|
def destroy
|
125
|
-
if deletable?
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
puts "set .deletable to true" unless deletable
|
134
|
-
end
|
135
|
-
|
136
|
-
return false
|
132
|
+
return super if deletable?
|
133
|
+
|
134
|
+
unless Rails.env.test?
|
135
|
+
# give useful feedback when trying to delete from console
|
136
|
+
puts "This page is not deletable. Please use .destroy! if you really want it deleted "
|
137
|
+
puts "unset .link_url," if link_url.present?
|
138
|
+
puts "unset .menu_match," if menu_match.present?
|
139
|
+
puts "set .deletable to true" unless deletable
|
137
140
|
end
|
141
|
+
|
142
|
+
return false
|
138
143
|
end
|
139
144
|
|
140
145
|
# If you want to destroy a page that is set to be not deletable this is the way to do it.
|
@@ -152,7 +157,7 @@ class Page < ActiveRecord::Base
|
|
152
157
|
# Override default options with any supplied.
|
153
158
|
options = {:reversed => true}.merge(options)
|
154
159
|
|
155
|
-
unless
|
160
|
+
unless parent_id.nil?
|
156
161
|
parts = [title, parent.path(options)]
|
157
162
|
parts.reverse! if options[:reversed]
|
158
163
|
parts.join(PATH_SEPARATOR)
|
@@ -179,7 +184,7 @@ class Page < ActiveRecord::Base
|
|
179
184
|
end
|
180
185
|
|
181
186
|
def link_url_localised?
|
182
|
-
return link_url unless
|
187
|
+
return link_url unless ::Refinery.i18n_enabled?
|
183
188
|
|
184
189
|
current_url = link_url
|
185
190
|
|
@@ -235,7 +240,7 @@ class Page < ActiveRecord::Base
|
|
235
240
|
end
|
236
241
|
|
237
242
|
def cache_key
|
238
|
-
[Refinery.base_cache_key, ::I18n.locale,
|
243
|
+
[Refinery.base_cache_key, ::I18n.locale, to_param].compact.join('/')
|
239
244
|
end
|
240
245
|
|
241
246
|
# Returns true if this page is "published"
|
@@ -255,7 +260,7 @@ class Page < ActiveRecord::Base
|
|
255
260
|
|
256
261
|
# Returns true if this page is the home page or links to it.
|
257
262
|
def home?
|
258
|
-
link_url ==
|
263
|
+
link_url == '/'
|
259
264
|
end
|
260
265
|
|
261
266
|
# Returns all visible sibling pages that can be rendered for the menu
|
@@ -263,6 +268,19 @@ class Page < ActiveRecord::Base
|
|
263
268
|
siblings.reject(&:not_in_menu?)
|
264
269
|
end
|
265
270
|
|
271
|
+
def to_refinery_menu_item
|
272
|
+
{
|
273
|
+
:id => id,
|
274
|
+
:lft => lft,
|
275
|
+
:menu_match => menu_match,
|
276
|
+
:parent_id => parent_id,
|
277
|
+
:rgt => rgt,
|
278
|
+
:title => (page_title if respond_to?(:page_title)) || title,
|
279
|
+
:type => self.class.name,
|
280
|
+
:url => url
|
281
|
+
}
|
282
|
+
end
|
283
|
+
|
266
284
|
class << self
|
267
285
|
# Accessor to find out the default page parts created for each new page
|
268
286
|
def default_parts
|
@@ -273,9 +291,7 @@ class Page < ActiveRecord::Base
|
|
273
291
|
# the current frontend locale is different to the current one set by ::I18n.locale.
|
274
292
|
# This terminates in a false if i18n engine is not defined or enabled.
|
275
293
|
def different_frontend_locale?
|
276
|
-
|
277
|
-
::Refinery::I18n.enabled? &&
|
278
|
-
::Refinery::I18n.current_frontend_locale != ::I18n.locale
|
294
|
+
::Refinery.i18n_enabled? && ::Refinery::I18n.current_frontend_locale != ::I18n.locale
|
279
295
|
end
|
280
296
|
|
281
297
|
# Returns how many pages per page should there be when paginating pages
|
@@ -300,15 +316,10 @@ class Page < ActiveRecord::Base
|
|
300
316
|
# Accessor method to get a page part from a page.
|
301
317
|
# Example:
|
302
318
|
#
|
303
|
-
# Page.first
|
319
|
+
# Page.first.content_for(:body)
|
304
320
|
#
|
305
321
|
# Will return the body page part of the first page.
|
306
|
-
def
|
307
|
-
# Allow for calling attributes with [] shorthand (eg page[:parent_id])
|
308
|
-
return super if self.attributes.has_key?(part_title.to_s)
|
309
|
-
|
310
|
-
# the way that we call page parts seems flawed, will probably revert to page.parts[:title] in a future release.
|
311
|
-
# self.parts is already eager loaded so we can now just grab the first element matching the title we specified.
|
322
|
+
def content_for(part_title)
|
312
323
|
part = self.parts.detect do |part|
|
313
324
|
part.title.present? and #protecting against the problem that occurs when have nil title
|
314
325
|
part.title == part_title.to_s or
|
@@ -318,6 +329,20 @@ class Page < ActiveRecord::Base
|
|
318
329
|
part.try(:body)
|
319
330
|
end
|
320
331
|
|
332
|
+
def [](part_title)
|
333
|
+
# Allow for calling attributes with [] shorthand (eg page[:parent_id])
|
334
|
+
return super if self.respond_to?(part_title.to_s.to_sym) or self.attributes.has_key?(part_title.to_s)
|
335
|
+
|
336
|
+
Refinery.deprecate({
|
337
|
+
:what => "page[#{part_title.inspect}]",
|
338
|
+
:when => '1.1',
|
339
|
+
:replacement => "content_for(#{part_title.inspect})",
|
340
|
+
:caller => caller
|
341
|
+
})
|
342
|
+
|
343
|
+
content_for(part_title)
|
344
|
+
end
|
345
|
+
|
321
346
|
# In the admin area we use a slightly different title to inform the which pages are draft or hidden pages
|
322
347
|
def title_with_meta
|
323
348
|
title = if self.title.nil?
|
@@ -353,14 +378,15 @@ class Page < ActiveRecord::Base
|
|
353
378
|
|
354
379
|
private
|
355
380
|
|
356
|
-
def
|
381
|
+
def invalidate_cached_urls
|
357
382
|
return true unless self.class.use_marketable_urls?
|
358
383
|
|
359
|
-
children.each do |
|
360
|
-
Rails.cache.delete(
|
361
|
-
Rails.cache.delete(
|
384
|
+
[self, children].flatten.each do |page|
|
385
|
+
Rails.cache.delete(page.url_cache_key)
|
386
|
+
Rails.cache.delete(page.path_cache_key)
|
362
387
|
end
|
363
388
|
end
|
389
|
+
alias_method :invalidate_child_cached_url, :invalidate_cached_urls
|
364
390
|
|
365
391
|
def ensure_locale
|
366
392
|
unless self.translations.present?
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<div class='clearfix'>
|
3
3
|
<span class='title'>
|
4
4
|
<%= page.title_with_meta.html_safe %>
|
5
|
-
<% if
|
5
|
+
<% if ::Refinery.i18n_enabled? and ::Refinery::I18n.frontend_locales.many? and
|
6
6
|
(locales = page.translations.map(&:locale)).present? %>
|
7
7
|
<span class='preview'>
|
8
8
|
<% ([page.translation.try(:locale)] | locales).each do |locale| %>
|
@@ -41,6 +41,9 @@ class CreateSeoMeta < ActiveRecord::Migration
|
|
41
41
|
}
|
42
42
|
)
|
43
43
|
end
|
44
|
+
|
45
|
+
# Reset column information again because otherwise the old columns will still exist.
|
46
|
+
::Page.reset_column_information
|
44
47
|
end
|
45
48
|
|
46
49
|
def self.down
|
@@ -59,13 +62,26 @@ class CreateSeoMeta < ActiveRecord::Migration
|
|
59
62
|
|
60
63
|
# Migrate data
|
61
64
|
existing_translations.each do |translation|
|
62
|
-
::Page::Translation.
|
65
|
+
::Page::Translation.update_all(
|
63
66
|
::SeoMeta.attributes.keys.inject({}) {|attributes, name|
|
64
67
|
attributes.merge(name => translation[name.to_s])
|
65
|
-
}
|
68
|
+
}, :id => translation['id']
|
66
69
|
)
|
67
70
|
end
|
68
71
|
|
72
|
+
::SeoMeta.attributes.keys.each do |k|
|
73
|
+
::Page::Translation.module_eval %{
|
74
|
+
def #{k}
|
75
|
+
end
|
76
|
+
|
77
|
+
def #{k}=(*args)
|
78
|
+
end
|
79
|
+
}
|
80
|
+
end
|
81
|
+
|
82
|
+
# Reset column information again because otherwise the old columns will still exist.
|
83
|
+
::Page.reset_column_information
|
84
|
+
|
69
85
|
drop_table :seo_meta
|
70
86
|
end
|
71
87
|
|
data/db/seeds/pages.rb
CHANGED
@@ -8,6 +8,10 @@ Given /^the page titled "?([^\"]*)"? has a menu match "?([^\"]*)"?$/ do |title,
|
|
8
8
|
Page.by_title(title).first.update_attribute(:menu_match, menu_match)
|
9
9
|
end
|
10
10
|
|
11
|
+
Given /^the page titled "?([^\"]*)"? is set to skip to first child$/ do |title|
|
12
|
+
Page.by_title(title).first.update_attribute(:skip_to_first_child, true)
|
13
|
+
end
|
14
|
+
|
11
15
|
Given /^I (only )?have pages titled "?([^\"]*)"?$/ do |only, titles|
|
12
16
|
Page.delete_all if only
|
13
17
|
titles.split(', ').each do |title|
|
@@ -28,7 +32,8 @@ Given /^I (only )?have a page titled "?([^\"]*)"?$/ do |only, title|
|
|
28
32
|
end
|
29
33
|
|
30
34
|
Given /^the page titled "?([^\"]*)"? is a child of "?([^\"]*)"?$/ do |title, parent_title|
|
31
|
-
|
35
|
+
parent_page = Page.by_title(parent_title).first
|
36
|
+
Page.by_title(title).first.update_attribute(:parent_id, parent_page.id)
|
32
37
|
end
|
33
38
|
|
34
39
|
Given /^the page titled "?([^\"]*)"? is not shown in the menu$/ do |title|
|
@@ -13,18 +13,21 @@ Feature: Visit Pages
|
|
13
13
|
And the page titled "Hidden" is a child of Home
|
14
14
|
And the page titled "Hidden" is not shown in the menu
|
15
15
|
|
16
|
+
@pages-visit-home
|
16
17
|
Scenario: Home Page
|
17
18
|
When I go to the home page
|
18
19
|
Then I should see "Home"
|
19
20
|
And I should see "About"
|
20
21
|
And I should see "Home" within ".selected"
|
21
22
|
|
23
|
+
@pages-visit-show
|
22
24
|
Scenario: Content Page
|
23
25
|
When I go to the page titled "About"
|
24
26
|
Then I should see "Home"
|
25
27
|
And I should see "About"
|
26
28
|
And I should see "About" within ".selected > a"
|
27
29
|
|
30
|
+
@pages-visit-special
|
28
31
|
Scenario: Special Characters Title
|
29
32
|
When I go to the page titled "ä ö ü spéciål chåråctÉrs"
|
30
33
|
Then I should see "Home"
|
@@ -32,6 +35,7 @@ Feature: Visit Pages
|
|
32
35
|
And I should see "ä ö ü spéciål chåråctÉrs"
|
33
36
|
And I should see "ä ö ü spéciål chåråctÉrs" within ".selected > a"
|
34
37
|
|
38
|
+
@pages-visit-special
|
35
39
|
Scenario: Special Characters Title as submenu page
|
36
40
|
Given the page titled "ä ö ü spéciål chåråctÉrs" is a child of About
|
37
41
|
When I go to the page titled "ä ö ü spéciål chåråctÉrs"
|
@@ -40,8 +44,18 @@ Feature: Visit Pages
|
|
40
44
|
And I should see "ä ö ü spéciål chåråctÉrs"
|
41
45
|
And I should see "ä ö ü spéciål chåråctÉrs" within ".selected * > .selected a"
|
42
46
|
|
47
|
+
@pages-visit-hidden
|
43
48
|
Scenario: Hidden Page
|
44
49
|
When I go to the page titled "Hidden"
|
45
50
|
Then I should see "Home"
|
46
51
|
And I should see "About"
|
47
|
-
And I should see "
|
52
|
+
And I should see "Hidden"
|
53
|
+
And I should not see "Hidden" within "nav"
|
54
|
+
|
55
|
+
@pages-visit-skip
|
56
|
+
Scenario: Skip to first child
|
57
|
+
Given I have a page titled "Child Page"
|
58
|
+
And the page titled "Child Page" is a child of About
|
59
|
+
And the page titled "About" is set to skip to first child
|
60
|
+
When I go to the page titled "About"
|
61
|
+
Then I should see "Child Page" within ".selected * > .selected a"
|
data/lib/gemspec.rb
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
|
|
27
27
|
|
28
28
|
s.add_dependency 'refinerycms-core', '= #{::Refinery::Version}'
|
29
29
|
s.add_dependency 'friendly_id_globalize3', '~> 3.2.1'
|
30
|
-
s.add_dependency 'globalize3', '
|
30
|
+
s.add_dependency 'globalize3', '~> 0.1'
|
31
31
|
s.add_dependency 'awesome_nested_set', '~> 2.0'
|
32
32
|
s.add_dependency 'seo_meta', '~> 1.1'
|
33
33
|
end
|
@@ -4,7 +4,8 @@ end
|
|
4
4
|
|
5
5
|
# Add any parts of routes as reserved words.
|
6
6
|
if Page.use_marketable_urls?
|
7
|
-
|
8
|
-
|
7
|
+
route_paths = ::Refinery::Application.routes.named_routes.routes.map{|name, route| route.path}
|
8
|
+
Page.friendly_id_config.reserved_words |= route_paths.map { |path|
|
9
|
+
path.to_s.gsub(/^\//, '').to_s.split('(').first.to_s.split(':').first.to_s.split('/')
|
9
10
|
}.flatten.reject{|w| w =~ /\_/}.uniq
|
10
11
|
end
|
@@ -3,9 +3,9 @@ module Refinery
|
|
3
3
|
module InstanceMethods
|
4
4
|
|
5
5
|
def error_404(exception=nil)
|
6
|
-
if (@page = ::Page.where(:menu_match =>
|
6
|
+
if (@page = ::Page.where(:menu_match => '^/404$').includes(:parts, :slugs).first).present?
|
7
7
|
# render the application's custom 404 page with layout and meta.
|
8
|
-
render :template =>
|
8
|
+
render :template => '/pages/show',
|
9
9
|
:format => 'html',
|
10
10
|
:status => 404
|
11
11
|
else
|
@@ -15,7 +15,25 @@ module Refinery
|
|
15
15
|
|
16
16
|
protected
|
17
17
|
def find_pages_for_menu
|
18
|
-
|
18
|
+
# First, apply a filter to determine which pages to show.
|
19
|
+
# We need to join to the page's slug to avoid multiple queries.
|
20
|
+
pages = ::Page.live.in_menu.includes(:slug).order('lft ASC')
|
21
|
+
|
22
|
+
# Now we only want to select particular columns to avoid any further queries.
|
23
|
+
# Title is retrieved in the next block below so it's not here.
|
24
|
+
%w(id depth parent_id lft rgt link_url menu_match).each do |column|
|
25
|
+
pages = pages.select(::Page.arel_table[column.to_sym])
|
26
|
+
end
|
27
|
+
|
28
|
+
# If we have translations then we get the title from that table.
|
29
|
+
if ::Page.respond_to?(:translation_class)
|
30
|
+
pages = pages.joins(:translations).select("#{::Page.translation_class.table_name}.title as page_title")
|
31
|
+
else
|
32
|
+
pages = pages.select('title as page_title')
|
33
|
+
end
|
34
|
+
|
35
|
+
# Compile the menu
|
36
|
+
@menu_pages = ::Refinery::Menu.new(pages)
|
19
37
|
end
|
20
38
|
|
21
39
|
def render(*args)
|
data/lib/refinerycms-pages.rb
CHANGED
@@ -37,7 +37,7 @@ module Refinery
|
|
37
37
|
::Refinery::Plugin.register do |plugin|
|
38
38
|
plugin.name = 'refinery_pages'
|
39
39
|
plugin.directory = 'pages'
|
40
|
-
plugin.version = %q{0.
|
40
|
+
plugin.version = %q{1.0.0}
|
41
41
|
plugin.menu_match = /(refinery|admin)\/page(_part)?s(_dialogs)?$/
|
42
42
|
plugin.activity = {
|
43
43
|
:class => Page,
|
data/refinerycms-pages.gemspec
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{refinerycms-pages}
|
5
|
-
s.version = %q{0.
|
5
|
+
s.version = %q{1.0.0}
|
6
6
|
s.summary = %q{Pages engine for Refinery CMS}
|
7
7
|
s.description = %q{The default content engine of Refinery CMS. This engine handles the administration and display of user-editable pages.}
|
8
|
-
s.date = %q{2011-05-
|
8
|
+
s.date = %q{2011-05-28}
|
9
9
|
s.email = %q{info@refinerycms.com}
|
10
10
|
s.homepage = %q{http://refinerycms.com}
|
11
11
|
s.rubyforge_project = %q{refinerycms}
|
@@ -119,9 +119,9 @@ Gem::Specification.new do |s|
|
|
119
119
|
'spec/models/page_spec.rb'
|
120
120
|
]
|
121
121
|
|
122
|
-
s.add_dependency 'refinerycms-core', '= 0.
|
122
|
+
s.add_dependency 'refinerycms-core', '= 1.0.0'
|
123
123
|
s.add_dependency 'friendly_id_globalize3', '~> 3.2.1'
|
124
|
-
s.add_dependency 'globalize3', '
|
124
|
+
s.add_dependency 'globalize3', '~> 0.1'
|
125
125
|
s.add_dependency 'awesome_nested_set', '~> 2.0'
|
126
126
|
s.add_dependency 'seo_meta', '~> 1.1'
|
127
127
|
end
|
data/spec/models/page_spec.rb
CHANGED
@@ -107,9 +107,14 @@ describe Page do
|
|
107
107
|
context "content sections (page parts)" do
|
108
108
|
before { create_page_parts }
|
109
109
|
|
110
|
-
it "return the content when using []" do
|
111
|
-
page[:body].should == "<p>I'm the first page part for this page.</p>"
|
112
|
-
page["BoDY"].should == "<p>I'm the first page part for this page.</p>"
|
110
|
+
it "return the content when using [] and moan about it" do
|
111
|
+
capture_stdout { page[:body].should == "<p>I'm the first page part for this page.</p>" }[:stderr].should =~ /DEPRECATION\ WARNING/
|
112
|
+
capture_stdout { page["BoDY"].should == "<p>I'm the first page part for this page.</p>" }[:stderr].should =~ /DEPRECATION\ WARNING/
|
113
|
+
end
|
114
|
+
|
115
|
+
it "return the content when using content_for" do
|
116
|
+
page.content_for(:body).should == "<p>I'm the first page part for this page.</p>"
|
117
|
+
page.content_for("BoDY").should == "<p>I'm the first page part for this page.</p>"
|
113
118
|
end
|
114
119
|
|
115
120
|
it "return all page part content" do
|
@@ -150,6 +155,9 @@ describe Page do
|
|
150
155
|
:deletable => true
|
151
156
|
})
|
152
157
|
end
|
158
|
+
let(:child_with_reserved_title_parent) do
|
159
|
+
page_with_reserved_title.children.create(:title => 'reserved title child page')
|
160
|
+
end
|
153
161
|
|
154
162
|
before { turn_on_marketable_urls }
|
155
163
|
|
@@ -158,8 +166,7 @@ describe Page do
|
|
158
166
|
end
|
159
167
|
|
160
168
|
it "when parent page title is set to a reserved word" do
|
161
|
-
|
162
|
-
child.url[:path].should == ["#{reserved_word}-page", 'the-child-page']
|
169
|
+
child_with_reserved_title_parent.url[:path].should == ["#{reserved_word}-page", 'reserved-title-child-page']
|
163
170
|
end
|
164
171
|
end
|
165
172
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: refinerycms-pages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 1.0.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Resolve Digital
|
@@ -13,7 +13,7 @@ autorequire:
|
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
15
|
|
16
|
-
date: 2011-05-
|
16
|
+
date: 2011-05-28 00:00:00 +12:00
|
17
17
|
default_executable:
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
requirements:
|
25
25
|
- - "="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 0.
|
27
|
+
version: 1.0.0
|
28
28
|
type: :runtime
|
29
29
|
version_requirements: *id001
|
30
30
|
- !ruby/object:Gem::Dependency
|
@@ -44,9 +44,9 @@ dependencies:
|
|
44
44
|
requirement: &id003 !ruby/object:Gem::Requirement
|
45
45
|
none: false
|
46
46
|
requirements:
|
47
|
-
- -
|
47
|
+
- - ~>
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 0.1
|
49
|
+
version: "0.1"
|
50
50
|
type: :runtime
|
51
51
|
version_requirements: *id003
|
52
52
|
- !ruby/object:Gem::Dependency
|