refinerycms-pages 1.0.11 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/refinery/admin/page_parts_controller.rb +26 -0
- data/app/controllers/refinery/admin/pages_controller.rb +77 -0
- data/app/controllers/refinery/admin/pages_dialogs_controller.rb +91 -0
- data/app/controllers/refinery/page_sweeper.rb +29 -0
- data/app/controllers/refinery/pages_controller.rb +103 -0
- data/app/helpers/refinery/pages/content_pages_helper.rb +26 -0
- data/app/helpers/refinery/pages_helper.rb +4 -0
- data/app/models/refinery/page.rb +467 -0
- data/app/models/refinery/page_part.rb +33 -0
- data/app/presenters/refinery/page_presenter.rb +7 -0
- data/app/views/admin/pages/_sortable_list.html.erb +7 -4
- data/app/views/{admin → refinery/admin}/pages/_actions.html.erb +5 -4
- data/app/views/refinery/admin/pages/_form.html.erb +63 -0
- data/app/views/{admin → refinery/admin}/pages/_form_advanced_options.html.erb +35 -16
- data/app/views/refinery/admin/pages/_form_advanced_options_seo.html.erb +3 -0
- data/app/views/{admin → refinery/admin}/pages/_form_fields_after_title.html.erb +0 -0
- data/app/views/{admin → refinery/admin}/pages/_form_new_page_parts.html.erb +5 -7
- data/app/views/{admin → refinery/admin}/pages/_form_page_parts.html.erb +19 -11
- data/app/views/{admin → refinery/admin}/pages/_locale_picker.html.erb +3 -3
- data/app/views/refinery/admin/pages/_page.html.erb +48 -0
- data/app/views/{admin → refinery/admin}/pages/_page_part_field.html.erb +1 -1
- data/app/views/refinery/admin/pages/_records.html.erb +14 -0
- data/app/views/refinery/admin/pages/_sortable_list.html.erb +4 -0
- data/app/views/refinery/admin/pages/children.html.erb +1 -0
- data/app/views/refinery/admin/pages/edit.html.erb +1 -0
- data/app/views/refinery/admin/pages/index.html.erb +9 -0
- data/app/views/refinery/admin/pages/new.html.erb +1 -0
- data/app/views/refinery/admin/pages_dialogs/_page_link.html.erb +20 -0
- data/app/views/{admin → refinery/admin}/pages_dialogs/link_to.html.erb +31 -36
- data/app/views/refinery/pages/home.html.erb +1 -0
- data/app/views/refinery/pages/show.html.erb +1 -0
- data/config/locales/bg.yml +81 -73
- data/config/locales/cs.yml +71 -72
- data/config/locales/da.yml +69 -72
- data/config/locales/de.yml +69 -72
- data/config/locales/el.yml +70 -72
- data/config/locales/en.yml +88 -73
- data/config/locales/es.yml +70 -73
- data/config/locales/fi.yml +70 -73
- data/config/locales/fr.yml +69 -72
- data/config/locales/it.yml +92 -89
- data/config/locales/ja.yml +72 -0
- data/config/locales/ko.yml +83 -0
- data/config/locales/lt.yml +71 -73
- data/config/locales/lv.yml +71 -74
- data/config/locales/nb.yml +69 -72
- data/config/locales/nl.yml +68 -71
- data/config/locales/pl.yml +70 -73
- data/config/locales/pt-BR.yml +70 -73
- data/config/locales/pt-PT.yml +75 -0
- data/config/locales/rs.yml +69 -72
- data/config/locales/ru.yml +77 -96
- data/config/locales/sk.yml +69 -72
- data/config/locales/sl.yml +68 -71
- data/config/locales/sv.yml +69 -72
- data/config/locales/vi.yml +69 -72
- data/config/locales/zh-CN.yml +75 -72
- data/config/locales/zh-TW.yml +69 -72
- data/config/routes.rb +10 -5
- data/db/migrate/20100913234708_create_refinerycms_pages_schema.rb +49 -43
- data/db/seeds.rb +41 -0
- data/lib/generators/refinery/pages/pages_generator.rb +21 -0
- data/lib/generators/refinery/pages/templates/config/initializers/refinery/pages.rb.erb +44 -0
- data/lib/refinery/pages/admin/instance_methods.rb +10 -8
- data/lib/refinery/pages/configuration.rb +44 -0
- data/lib/refinery/pages/content_page_presenter.rb +33 -0
- data/lib/refinery/pages/content_presenter.rb +56 -0
- data/lib/refinery/pages/engine.rb +73 -0
- data/lib/refinery/pages/instance_methods.rb +12 -26
- data/lib/refinery/pages/page_part_section_presenter.rb +19 -0
- data/lib/refinery/pages/section_presenter.rb +69 -0
- data/lib/{pages/tabs.rb → refinery/pages/tab.rb} +0 -0
- data/lib/refinery/pages/title_section_presenter.rb +14 -0
- data/lib/refinery/pages/type.rb +17 -0
- data/lib/refinery/pages/types.rb +32 -0
- data/lib/refinery/pages.rb +55 -0
- data/lib/refinerycms-pages.rb +1 -61
- data/refinerycms-pages.gemspec +17 -118
- data/spec/factories/pages.rb +5 -0
- data/spec/helpers/refinery/pages/content_pages_helper_spec.rb +44 -0
- data/spec/lib/generators/refinery/pages/pages_generator_spec.rb +29 -0
- data/spec/lib/pages/content_page_presenter_spec.rb +43 -0
- data/spec/lib/pages/content_presenter_spec.rb +97 -0
- data/spec/lib/pages/page_part_section_presenter_spec.rb +35 -0
- data/spec/lib/pages/section_presenter_spec.rb +86 -0
- data/spec/lib/pages/title_section_presenter_spec.rb +21 -0
- data/spec/lib/pages_spec.rb +26 -0
- data/spec/models/refinery/page_spec.rb +415 -0
- data/spec/requests/refinery/admin/pages_spec.rb +581 -0
- data/spec/requests/refinery/pages_spec.rb +302 -0
- metadata +162 -153
- data/app/controllers/admin/page_parts_controller.rb +0 -24
- data/app/controllers/admin/pages_controller.rb +0 -68
- data/app/controllers/admin/pages_dialogs_controller.rb +0 -85
- data/app/controllers/pages_controller.rb +0 -33
- data/app/helpers/pages_helper.rb +0 -2
- data/app/models/page.rb +0 -391
- data/app/models/page_part.rb +0 -29
- data/app/presenters/page_presenter.rb +0 -7
- data/app/views/admin/pages/_form.html.erb +0 -61
- data/app/views/admin/pages/_form_advanced_options_seo.html.erb +0 -4
- data/app/views/admin/pages/_page.html.erb +0 -33
- data/app/views/admin/pages/_records.html.erb +0 -14
- data/app/views/admin/pages/edit.html.erb +0 -1
- data/app/views/admin/pages/index.html.erb +0 -11
- data/app/views/admin/pages/new.html.erb +0 -1
- data/app/views/admin/pages_dialogs/_page_link.html.erb +0 -14
- data/app/views/pages/home.html.erb +0 -1
- data/app/views/pages/show.html.erb +0 -1
- data/config/locales/jp.yml +0 -75
- data/config/locales/lolcat.yml +0 -76
- data/db/migrate/20101214040815_translate_page_plugin.rb +0 -29
- data/db/migrate/20101216194133_remove_cached_slug_from_pages.rb +0 -11
- data/db/migrate/20110307025652_translate_custom_title_on_pages.rb +0 -26
- data/db/migrate/20110314213540_remove_translated_fields_from_pages.rb +0 -13
- data/db/migrate/20110329080451_create_seo_meta.rb +0 -89
- data/db/seeds/pages.rb +0 -42
- data/features/manage_pages.feature +0 -48
- data/features/step_definitions/page_steps.rb +0 -72
- data/features/support/paths.rb +0 -28
- data/features/translate_pages.feature +0 -40
- data/features/visit_pages.feature +0 -68
- data/lib/gemspec.rb +0 -40
- data/lib/generators/refinerycms_pages_generator.rb +0 -8
- data/lib/pages/marketable_routes.rb +0 -12
- data/spec/models/page_spec.rb +0 -235
data/features/support/paths.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
module NavigationHelpers
|
2
|
-
module Refinery
|
3
|
-
module Pages
|
4
|
-
def path_to(page_name)
|
5
|
-
case page_name
|
6
|
-
when /the home\s?page/
|
7
|
-
root_path
|
8
|
-
when /the list of pages/
|
9
|
-
admin_pages_path
|
10
|
-
when /the new page form/
|
11
|
-
new_admin_page_path
|
12
|
-
else
|
13
|
-
begin
|
14
|
-
if page_name =~ /the page titled "?([^\"]*)"? with locale "?([^\"]*)"?/ and (page = Page.by_title($1).first).present?
|
15
|
-
self.url_for(page.url.is_a?(String) ? "/#{$2}#{page.url}" : page.url.merge(:locale => $2))
|
16
|
-
elsif page_name =~ /the page titled "?([^\"]*)"?/ and (page = Page.by_title($1).first).present?
|
17
|
-
self.url_for(page.url)
|
18
|
-
else
|
19
|
-
nil
|
20
|
-
end
|
21
|
-
rescue
|
22
|
-
nil
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
@refinerycms @pages @pages-translate @i18n
|
2
|
-
Feature: Translate Pages
|
3
|
-
In order to make the content on my website accessible in many countries
|
4
|
-
As a translator
|
5
|
-
I want to translate manage pages
|
6
|
-
|
7
|
-
Background:
|
8
|
-
Given A Refinery user exists
|
9
|
-
And I am a logged in Refinery Translator
|
10
|
-
And I have pages titled Home, About
|
11
|
-
|
12
|
-
Scenario: Pages List
|
13
|
-
When I go to the list of pages
|
14
|
-
Then I should see "Home"
|
15
|
-
And I should see "About"
|
16
|
-
|
17
|
-
Scenario: Add page to main locale
|
18
|
-
When I go to the list of pages
|
19
|
-
And I follow "Add new page"
|
20
|
-
And I fill in "Title" with "Pickles are Cucumbers Soaked in Evil"
|
21
|
-
And I press "Save"
|
22
|
-
Then I should see "You do not have the required permission to modify pages in this language"
|
23
|
-
And I should have 2 pages
|
24
|
-
|
25
|
-
Scenario: Add page to second locale
|
26
|
-
Given I have frontend locales en, fr
|
27
|
-
When I go to the list of pages
|
28
|
-
And I follow "Add new page"
|
29
|
-
And I follow "Fr" within "#switch_locale_picker"
|
30
|
-
And I fill in "Title" with "Pickles sont Concombres Trempé dans le Mal"
|
31
|
-
And I press "Save"
|
32
|
-
Then I should see "'Pickles sont Concombres Trempé dans le Mal' was successfully added."
|
33
|
-
And I should have 3 pages
|
34
|
-
|
35
|
-
Scenario: Delete page from main locale
|
36
|
-
Given I only have a page titled "test"
|
37
|
-
When I go to the list of pages
|
38
|
-
And I follow "Remove this page forever"
|
39
|
-
Then I should see "You do not have the required permission to modify pages in this language."
|
40
|
-
And I should have 1 pages
|
@@ -1,68 +0,0 @@
|
|
1
|
-
@refinerycms @pages @pages-visit @visit-pages
|
2
|
-
Feature: Visit Pages
|
3
|
-
In order to view the content on this website
|
4
|
-
As a visitor
|
5
|
-
I want to view pages
|
6
|
-
|
7
|
-
Background:
|
8
|
-
Given A Refinery user exists
|
9
|
-
And I have a page titled "Home" with a custom url "/"
|
10
|
-
And I have a page titled "About"
|
11
|
-
And I have a page titled "ä ö ü spéciål chåråctÉrs"
|
12
|
-
And I have a page titled "Hidden"
|
13
|
-
And the page titled "Hidden" is a child of Home
|
14
|
-
And the page titled "Hidden" is not shown in the menu
|
15
|
-
|
16
|
-
@pages-visit-home
|
17
|
-
Scenario: Home Page
|
18
|
-
When I go to the home page
|
19
|
-
Then I should see "Home"
|
20
|
-
And I should see "About"
|
21
|
-
And I should see "Home" within ".selected"
|
22
|
-
|
23
|
-
@pages-visit-show
|
24
|
-
Scenario: Content Page
|
25
|
-
When I go to the page titled "About"
|
26
|
-
Then I should see "Home"
|
27
|
-
And I should see "About"
|
28
|
-
And I should see "About" within ".selected > a"
|
29
|
-
|
30
|
-
@pages-visit-special
|
31
|
-
Scenario: Special Characters Title
|
32
|
-
When I go to the page titled "ä ö ü spéciål chåråctÉrs"
|
33
|
-
Then I should see "Home"
|
34
|
-
And I should see "About"
|
35
|
-
And I should see "ä ö ü spéciål chåråctÉrs"
|
36
|
-
And I should see "ä ö ü spéciål chåråctÉrs" within ".selected > a"
|
37
|
-
|
38
|
-
@pages-visit-special
|
39
|
-
Scenario: Special Characters Title as submenu page
|
40
|
-
Given the page titled "ä ö ü spéciål chåråctÉrs" is a child of About
|
41
|
-
When I go to the page titled "ä ö ü spéciål chåråctÉrs"
|
42
|
-
Then I should see "Home"
|
43
|
-
And I should see "About"
|
44
|
-
And I should see "ä ö ü spéciål chåråctÉrs"
|
45
|
-
And I should see "ä ö ü spéciål chåråctÉrs" within ".selected * > .selected a"
|
46
|
-
|
47
|
-
@pages-visit-hidden
|
48
|
-
Scenario: Hidden Page
|
49
|
-
When I go to the page titled "Hidden"
|
50
|
-
Then I should see "Home"
|
51
|
-
And I should see "About"
|
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"
|
62
|
-
|
63
|
-
@pages-visit-i18n
|
64
|
-
Scenario: Translated URI
|
65
|
-
Given I have frontend locales "en, de"
|
66
|
-
And the page titled "Home" is fully translated
|
67
|
-
When I go to the page titled "Home" with locale "de"
|
68
|
-
Then I should see "Home" within ".selected > a"
|
data/lib/gemspec.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
# Encoding: UTF-8
|
2
|
-
require 'pathname'
|
3
|
-
gempath = Pathname.new(File.expand_path('../../', __FILE__))
|
4
|
-
require gempath.join('..', 'base', 'lib', 'base', 'refinery')
|
5
|
-
|
6
|
-
gemspec = <<EOF
|
7
|
-
# Encoding: UTF-8
|
8
|
-
# DO NOT EDIT THIS FILE DIRECTLY! Instead, use lib/gemspec.rb to generate it.
|
9
|
-
|
10
|
-
Gem::Specification.new do |s|
|
11
|
-
s.name = %q{#{gemname = 'refinerycms-pages'}}
|
12
|
-
s.version = %q{#{::Refinery.version}}
|
13
|
-
s.summary = %q{Pages engine for Refinery CMS}
|
14
|
-
s.description = %q{The default content engine of Refinery CMS. This engine handles the administration and display of user-editable pages.}
|
15
|
-
s.date = %q{#{Time.now.strftime('%Y-%m-%d')}}
|
16
|
-
s.email = %q{info@refinerycms.com}
|
17
|
-
s.homepage = %q{http://refinerycms.com}
|
18
|
-
s.rubyforge_project = %q{refinerycms}
|
19
|
-
s.authors = ['Resolve Digital', 'Philip Arndt', 'David Jones', 'Steven Heidel', 'Uģis Ozols']
|
20
|
-
s.license = %q{MIT}
|
21
|
-
s.require_paths = %w(lib)
|
22
|
-
s.executables = %w(#{Pathname.glob(gempath.join('bin/*')).map{|d| d.relative_path_from(gempath)}.sort.join(" ")})
|
23
|
-
|
24
|
-
s.files = [
|
25
|
-
'#{%w( **/{*,.rspec,.gitignore,.yardopts} ).map { |file| Pathname.glob(gempath.join(file)) }.flatten.reject{|f|
|
26
|
-
!f.exist? or f.to_s =~ /(\.(gem|rbc)|tmp(\/.*)?|spec\/lib\/tmp(\/.*)?)$/ or (f.directory? and f.children.empty?)
|
27
|
-
}.map{|d| d.relative_path_from(gempath)}.uniq.sort.join("',\n '")}'
|
28
|
-
]
|
29
|
-
|
30
|
-
s.add_dependency 'refinerycms-core', '= #{::Refinery::Version}'
|
31
|
-
s.add_dependency 'activerecord', '~> 3.0.10'
|
32
|
-
s.add_dependency 'friendly_id_globalize3', '~> 3.2.1'
|
33
|
-
s.add_dependency 'globalize3', '~> 0.2.0.beta4'
|
34
|
-
s.add_dependency 'awesome_nested_set', '~> 2.0'
|
35
|
-
s.add_dependency 'seo_meta', '~> 1.1'
|
36
|
-
end
|
37
|
-
EOF
|
38
|
-
|
39
|
-
(gemfile = gempath.join("#{gemname}.gemspec")).open('w') {|f| f.puts(gemspec)}
|
40
|
-
puts `cd #{gempath} && gem build #{gemfile}` if ARGV.any?{|a| a == "BUILD=true"}
|
@@ -1,12 +0,0 @@
|
|
1
|
-
|
2
|
-
if Page.use_marketable_urls?
|
3
|
-
::Refinery::Application.routes.draw do
|
4
|
-
match '*path' => 'pages#show'
|
5
|
-
end
|
6
|
-
|
7
|
-
# Add any parts of routes as reserved words.
|
8
|
-
route_paths = ::Refinery::Application.routes.named_routes.routes.map{|name, route| route.path}
|
9
|
-
Page.friendly_id_config.reserved_words |= route_paths.map { |path|
|
10
|
-
path.to_s.gsub(/^\//, '').to_s.split('(').first.to_s.split(':').first.to_s.split('/')
|
11
|
-
}.flatten.reject{|w| w =~ /\_/}.uniq
|
12
|
-
end
|
data/spec/models/page_spec.rb
DELETED
@@ -1,235 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Page do
|
4
|
-
|
5
|
-
let(:page) do
|
6
|
-
Page.create!({
|
7
|
-
:title => "RSpec is great for testing too",
|
8
|
-
:deletable => true
|
9
|
-
})
|
10
|
-
end
|
11
|
-
let(:child) { page.children.create(:title => 'The child page') }
|
12
|
-
|
13
|
-
def page_cannot_be_destroyed
|
14
|
-
page.destroy.should == false
|
15
|
-
end
|
16
|
-
|
17
|
-
def turn_off_marketable_urls
|
18
|
-
RefinerySetting.set(:use_marketable_urls, {:value => false, :scoping => 'pages'})
|
19
|
-
end
|
20
|
-
|
21
|
-
def turn_on_marketable_urls
|
22
|
-
RefinerySetting.set(:use_marketable_urls, {:value => true, :scoping => 'pages'})
|
23
|
-
end
|
24
|
-
|
25
|
-
def create_page_parts
|
26
|
-
page.parts.create(:title => 'body', :content => "I'm the first page part for this page.")
|
27
|
-
page.parts.create(:title => 'side body', :content => "Closely followed by the second page part.")
|
28
|
-
end
|
29
|
-
|
30
|
-
context "cannot be deleted under certain rules" do
|
31
|
-
it "if link_url is present" do
|
32
|
-
page.link_url = '/plugin-name'
|
33
|
-
page_cannot_be_destroyed
|
34
|
-
end
|
35
|
-
|
36
|
-
|
37
|
-
it "if refinery team deems it so" do
|
38
|
-
page.deletable = false
|
39
|
-
page_cannot_be_destroyed
|
40
|
-
end
|
41
|
-
|
42
|
-
it "if menu_match is present" do
|
43
|
-
page.menu_match = '^/RSpec is great for testing too.*$'
|
44
|
-
page_cannot_be_destroyed
|
45
|
-
end
|
46
|
-
|
47
|
-
it "unless you really want it to! >:]" do
|
48
|
-
page.deletable = false
|
49
|
-
page_cannot_be_destroyed
|
50
|
-
page.destroy!.should be
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
context "page urls" do
|
55
|
-
|
56
|
-
it "return a full path" do
|
57
|
-
page.path.should == 'RSpec is great for testing too'
|
58
|
-
end
|
59
|
-
|
60
|
-
it "and all of its parent page titles, reversed" do
|
61
|
-
child.path.should == 'RSpec is great for testing too - The child page'
|
62
|
-
end
|
63
|
-
|
64
|
-
it "or normally ;-)" do
|
65
|
-
child.path({:reversed => false}).should == 'The child page - RSpec is great for testing too'
|
66
|
-
end
|
67
|
-
|
68
|
-
it "returns its url" do
|
69
|
-
page.link_url = '/contact'
|
70
|
-
page.url.should == '/contact'
|
71
|
-
end
|
72
|
-
|
73
|
-
it "returns its path with marketable urls" do
|
74
|
-
page.url[:id].should be_nil
|
75
|
-
page.url[:path].should == ["rspec-is-great-for-testing-too"]
|
76
|
-
end
|
77
|
-
|
78
|
-
it "returns its path underneath its parent with marketable urls" do
|
79
|
-
child.url[:id].should be_nil
|
80
|
-
child.url[:path].should == [page.url[:path].first, 'the-child-page']
|
81
|
-
end
|
82
|
-
|
83
|
-
it "no path parameter without marketable urls" do
|
84
|
-
turn_off_marketable_urls
|
85
|
-
page.url[:path].should be_nil
|
86
|
-
page.url[:id].should == "rspec-is-great-for-testing-too"
|
87
|
-
turn_on_marketable_urls
|
88
|
-
end
|
89
|
-
|
90
|
-
it "doesn't mention its parent without marketable urls" do
|
91
|
-
turn_off_marketable_urls
|
92
|
-
child.url[:id].should == 'the-child-page'
|
93
|
-
child.url[:path].should be_nil
|
94
|
-
turn_on_marketable_urls
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
context "home page" do
|
99
|
-
it "responds as the home page" do
|
100
|
-
page.link_url = '/'
|
101
|
-
page.home?.should == true
|
102
|
-
end
|
103
|
-
|
104
|
-
it "responds as a normal page when not set to home page" do
|
105
|
-
page.home?.should == false
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
context "content sections (page parts)" do
|
110
|
-
before { create_page_parts }
|
111
|
-
|
112
|
-
it "return the content when using [] and moan about it" do
|
113
|
-
capture_stdout { page[:body].should == "<p>I'm the first page part for this page.</p>" }[:stderr].should =~ /DEPRECATION\ WARNING/
|
114
|
-
capture_stdout { page["BoDY"].should == "<p>I'm the first page part for this page.</p>" }[:stderr].should =~ /DEPRECATION\ WARNING/
|
115
|
-
end
|
116
|
-
|
117
|
-
it "return the content when using content_for" do
|
118
|
-
page.content_for(:body).should == "<p>I'm the first page part for this page.</p>"
|
119
|
-
page.content_for("BoDY").should == "<p>I'm the first page part for this page.</p>"
|
120
|
-
end
|
121
|
-
|
122
|
-
it "return all page part content" do
|
123
|
-
page.all_page_part_content.should == "<p>I'm the first page part for this page.</p> <p>Closely followed by the second page part.</p>"
|
124
|
-
end
|
125
|
-
|
126
|
-
it "reposition correctly" do
|
127
|
-
page.parts.first.position = 6
|
128
|
-
page.parts.last.position = 4
|
129
|
-
|
130
|
-
page.parts.first.position.should == 6
|
131
|
-
page.parts.last.position.should == 4
|
132
|
-
|
133
|
-
page.reposition_parts!
|
134
|
-
|
135
|
-
page.parts.first.position.should == 0
|
136
|
-
page.parts.last.position.should == 1
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
context "draft pages" do
|
141
|
-
it "not live when set to draft" do
|
142
|
-
page.draft = true
|
143
|
-
page.live?.should_not be
|
144
|
-
end
|
145
|
-
|
146
|
-
it "live when not set to draft" do
|
147
|
-
page.draft = false
|
148
|
-
page.live?.should be
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
context "should add url suffix" do
|
153
|
-
let(:reserved_word) { Page.friendly_id_config.reserved_words.last }
|
154
|
-
let(:page_with_reserved_title) do
|
155
|
-
Page.create!({
|
156
|
-
:title => reserved_word,
|
157
|
-
:deletable => true
|
158
|
-
})
|
159
|
-
end
|
160
|
-
let(:child_with_reserved_title_parent) do
|
161
|
-
page_with_reserved_title.children.create(:title => 'reserved title child page')
|
162
|
-
end
|
163
|
-
|
164
|
-
before { turn_on_marketable_urls }
|
165
|
-
|
166
|
-
it "when title is set to a reserved word" do
|
167
|
-
page_with_reserved_title.url[:path].should == ["#{reserved_word}-page"]
|
168
|
-
end
|
169
|
-
|
170
|
-
it "when parent page title is set to a reserved word" do
|
171
|
-
child_with_reserved_title_parent.url[:path].should == ["#{reserved_word}-page", 'reserved-title-child-page']
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
|
-
context "meta data" do
|
176
|
-
context "responds to" do
|
177
|
-
it "meta_keywords" do
|
178
|
-
page.respond_to?(:meta_keywords)
|
179
|
-
end
|
180
|
-
|
181
|
-
it "meta_description" do
|
182
|
-
page.respond_to?(:meta_description)
|
183
|
-
end
|
184
|
-
|
185
|
-
it "browser_title" do
|
186
|
-
page.respond_to?(:browser_title)
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
context "allows us to assign to" do
|
191
|
-
it "meta_keywords" do
|
192
|
-
page.meta_keywords = 'Some, great, keywords'
|
193
|
-
page.meta_keywords.should == 'Some, great, keywords'
|
194
|
-
end
|
195
|
-
|
196
|
-
it "meta_description" do
|
197
|
-
page.meta_description = 'This is my description of the page for search results.'
|
198
|
-
page.meta_description.should == 'This is my description of the page for search results.'
|
199
|
-
end
|
200
|
-
|
201
|
-
it "browser_title" do
|
202
|
-
page.browser_title = 'An awesome browser title for SEO'
|
203
|
-
page.browser_title.should == 'An awesome browser title for SEO'
|
204
|
-
end
|
205
|
-
end
|
206
|
-
|
207
|
-
context "allows us to update" do
|
208
|
-
it "meta_keywords" do
|
209
|
-
page.meta_keywords = 'Some, great, keywords'
|
210
|
-
page.save
|
211
|
-
|
212
|
-
page.reload
|
213
|
-
page.meta_keywords.should == 'Some, great, keywords'
|
214
|
-
end
|
215
|
-
|
216
|
-
it "meta_description" do
|
217
|
-
page.meta_description = 'This is my description of the page for search results.'
|
218
|
-
page.save
|
219
|
-
|
220
|
-
page.reload
|
221
|
-
page.meta_description.should == 'This is my description of the page for search results.'
|
222
|
-
end
|
223
|
-
|
224
|
-
it "browser_title" do
|
225
|
-
page.browser_title = 'An awesome browser title for SEO'
|
226
|
-
page.save
|
227
|
-
|
228
|
-
page.reload
|
229
|
-
page.browser_title.should == 'An awesome browser title for SEO'
|
230
|
-
end
|
231
|
-
end
|
232
|
-
|
233
|
-
end
|
234
|
-
|
235
|
-
end
|