Skip to content

Commit 6abce2d

Browse files
committed
Add Scenarios for selecting content.
1 parent afd8737 commit 6abce2d

File tree

7 files changed

+43
-10
lines changed

7 files changed

+43
-10
lines changed

app/views/cms/pages/_edit_container.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="cms_edit_container" style="height: auto; background: url(/images/cms/containers/alpha.png) repeat-x 0 0; border: 1px solid #999; margin: -8px 0 0 -8px; padding: 24px 7px 1px 7px; position: relative;">
22
<div style="display: block; width: 100%; position: absolute; top: 5px; left: 5px; height: 30px;">
33
<%= link_to image_tag("cms/pages/add_connectable.gif", :style => "text-decoration: none; padding: 0; background: none; margin: 0; float: none; border: none;"), cms_content_types_path(:connect_to_page_id => @page, :connect_to_container => name), :title => "Add new content to this container (#{name})" , :style => "text-decoration: none; padding: 0 2px 0 0; background: none; margin: 0; float: none; border: none;"%>
4-
<%= link_to image_tag("cms/pages/connect_connectable.gif", :style => "text-decoration: none; padding: 0; background: none; margin: 0; float: none; border: none;"), new_cms_connector_path(:page_id => @page, :container => name), :title => "Insert existing content into this container (#{name})" , :style => "text-decoration: none; padding: 0 2px 0 0; background: none; margin: 0; float: none; border: none;"%>
4+
<%= link_to image_tag("cms/pages/connect_connectable.gif", :style => "text-decoration: none; padding: 0; background: none; margin: 0; float: none; border: none;"), new_cms_connector_path(:page_id => @page, :container => name), :title => "Insert existing content into this container (#{name})" , :style => "text-decoration: none; padding: 0 2px 0 0; background: none; margin: 0; float: none; border: none;", :id=>"insert_existing_content_#{name}"%>
55
<%= image_tag "cms/#{@page.container_published?(name) ? 'published' : 'draft'}_status.gif",
66
:class => "published_status",
77
:title => @page.container_published?(name) ? "This content is published and can be seen by site visitors." : "This content is a draft and won't be seen by site visitors until this page is published.",

db/browsercms.seeds.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
end
99
Cms::User.current = create_user(:cmsadmin, :login => "cmsadmin", :first_name => "CMS", :last_name => "Administrator", :email => "cmsadmin@example.com", :password => pwd, :password_confirmation => pwd)
1010

11+
[["Cms::CategoryType", "Categorization"], ["Cms::Category","Categorization"], ["Cms::Tag", "Categorization"],
12+
["Cms::HtmlBlock", "Core"], ["Cms::Portlet", "Core"], ["Cms::FileBlock", "Core"], ["Cms::ImageBlock", "Core"]
13+
].each do |type|
14+
create_content_type(type[0].to_sym, :name=>type[0], :group_name=>type[1])
15+
end
1116
create_permission(:administrate, :name => "administrate", :full_name => "Administer CMS", :description => "Allows users to administer the CMS, including adding users and groups.")
1217
create_permission(:edit_content, :name => "edit_content", :full_name => "Edit Content", :description => "Allows users to Add, Edit and Delete both Pages and Blocks. Can Save (but not Publish) and Assign them as well.")
1318
create_permission(:publish_content, :name => "publish_content", :full_name => "Publish Content", :description => "Allows users to Save and Publish, Hide and Archive both Pages and Blocks.")

db/migrate/20080815014337_browsercms_3_0_0.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ def self.up
4040
t.string :name
4141
t.timestamps
4242
end
43-
Cms::ContentTypeGroup.create!(:name => "Core")
4443

4544
create_table prefix(:content_types) do |t|
4645
t.string :name
@@ -53,15 +52,13 @@ def self.up
5352
t.string :name
5453
t.timestamps
5554
end
56-
Cms::ContentType.create!(:name => "Cms::CategoryType", :group_name => "Categorization")
5755

5856
create_table prefix(:categories) do |t|
5957
t.belongs_to :category_type
6058
t.belongs_to :parent
6159
t.string :name
6260
t.timestamps
6361
end
64-
Cms::ContentType.create!(:name => "Cms::Category", :group_name => "Categorization")
6562

6663
create_table prefix(:connectors) do |t|
6764
t.integer :page_id
@@ -78,7 +75,6 @@ def self.up
7875
t.string :name
7976
t.string :content, :limit => 64.kilobytes + 1
8077
end
81-
Cms::ContentType.create!(:name => "Cms::HtmlBlock", :group_name => "Core", :priority => 1)
8278

8379
create_table prefix(:sections) do |t|
8480
t.string :name
@@ -101,7 +97,6 @@ def self.up
10197
t.string :name
10298
t.text :value
10399
end
104-
Cms::ContentType.create!(:name => "Cms::Portlet", :group_name => "Core", :priority => 1)
105100

106101
create_table prefix(:redirects) do |t|
107102
t.string :from_path
@@ -124,8 +119,6 @@ def self.up
124119
t.integer :attachment_id
125120
t.integer :attachment_version
126121
end
127-
Cms::ContentType.create!(:name => "Cms::FileBlock", :group_name => "Core")
128-
Cms::ContentType.create!(:name => "Cms::ImageBlock", :group_name => "Core")
129122

130123
create_table prefix(:group_types) do |t|
131124
t.string :name
@@ -190,7 +183,6 @@ def self.up
190183
t.string :name
191184
t.timestamps
192185
end
193-
Cms::ContentType.create!(:name => "Cms::Tag", :group_name => "Categorization")
194186

195187
create_table prefix(:taggings) do |t|
196188
t.integer :tag_id
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Feature: Add
2+
The content management system should serve content

features/step_definitions/content_pages_steps.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,13 @@
4141
fill_in 'login', :with=>"privileged"
4242
fill_in 'password', :with=>"password"
4343
click_button 'LOGIN'
44-
end
44+
end
45+
When /^I click the Select Existing Content button$/ do
46+
container = "main"
47+
click_link "insert_existing_content_#{container}"
48+
end
49+
50+
When /^I turn on edit mode for (.*)$/ do |path|
51+
goto = path + "?mode=edit"
52+
visit(goto)
53+
end

features/step_definitions/data_steps.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,12 @@
1717

1818
When /^I request (.*)$/ do |path|
1919
visit path
20+
end
21+
22+
Given /^there is an Html Block with:$/ do |table|
23+
Factory(:html_block, table.hashes.first)
24+
end
25+
26+
When /^there is a Page with:$/ do |table|
27+
Factory(:public_page, { :publish_on_save=>true }.merge(table.hashes.first))
2028
end

test/factories.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,23 @@ def find_or_create_root_section
135135
m.name "Test"
136136
m.path "/test"
137137
m.parent { find_or_create_root_section }
138+
139+
end
140+
141+
Factory.define :public_page, :class => Cms::Page do |m|
142+
m.sequence(:name) { |n| "Page #{n}" }
143+
m.path { |a| "/#{a.name.gsub(/\s/, '_').downcase}" }
144+
m.template_file_name "default.html.erb"
145+
m.association :section, :factory=>:public_section
146+
end
147+
148+
Factory.define :public_section, :class=>Cms::Section do |m|
149+
m.name "Test"
150+
m.path "/test"
151+
m.parent { find_or_create_root_section }
152+
m.after_create { |section|
153+
section.allow_groups = :all
154+
}
138155
end
139156

140157
Factory.define :protected_section, :class=>Cms::Section do |m|

0 commit comments

Comments
 (0)