browsercms 3.4.2.rc1 → 3.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- browsercms (3.4.2.rc1)
4
+ browsercms (3.4.2)
5
5
  ancestry (~> 1.2.4)
6
6
  ckeditor_rails (~> 3.6.2.2)
7
7
  jquery-rails (~> 1.0.14)
@@ -168,7 +168,7 @@ GEM
168
168
  treetop (1.4.10)
169
169
  polyglot
170
170
  polyglot (>= 0.3.1)
171
- tzinfo (0.3.32)
171
+ tzinfo (0.3.33)
172
172
  xpath (0.1.4)
173
173
  nokogiri (~> 1.3)
174
174
  yard (0.7.2)
@@ -18,7 +18,7 @@ module Cms
18
18
  end
19
19
 
20
20
  def create
21
- @view = dynamic_view_type.new(params[dynamic_view_type.resource_collection_name])
21
+ @view = dynamic_view_type.new(params[view_param_name])
22
22
  if @view.save
23
23
  flash[:notice] = "#{dynamic_view_type} '#{@view.name}' was created"
24
24
  redirect_to cms_index_path_for(dynamic_view_type)
@@ -32,9 +32,9 @@ module Cms
32
32
  end
33
33
 
34
34
  def update
35
- if @view.update_attributes(params[ActionController::RecordIdentifier.singular_class_name(dynamic_view_type)])
35
+ if @view.update_attributes(params[view_param_name])
36
36
  flash[:notice] = "#{dynamic_view_type} '#{@view.name}' was updated"
37
- redirect_to cms_index_path_for(dynamic_view_type.name.underscore.pluralize)
37
+ redirect_to cms_index_path_for(dynamic_view_type)
38
38
  else
39
39
  render :action => "edit"
40
40
  end
@@ -43,10 +43,15 @@ module Cms
43
43
  def destroy
44
44
  @view.destroy
45
45
  flash[:notice] = "#{dynamic_view_type} '#{@view.name}' was deleted"
46
- redirect_to cms_index_path_for(dynamic_view_type.name.underscore.pluralize)
46
+ redirect_to cms_index_path_for(dynamic_view_type)
47
47
  end
48
48
 
49
49
  protected
50
+
51
+ def view_param_name
52
+ dynamic_view_type.resource_collection_name
53
+ end
54
+
50
55
  def dynamic_view_type
51
56
  @dynamic_view_type ||= begin
52
57
  url = request.path.sub(/\?.*/, '')
@@ -42,17 +42,6 @@ module Cms
42
42
  image_tag "cms/icons/status/#{status.to_s.underscore}.gif", {:alt => status.to_s.titleize}.merge(options)
43
43
  end
44
44
 
45
- def link_to_usages(block)
46
- count = block.connected_pages.count
47
- if count > 0
48
- # Would love a cleaner solution to this problem, see http://stackoverflow.com/questions/702728
49
- path = Portlet === block ? usages_portlet_path(block) : [:usages, block]
50
- link_to count, path, :id => block.id, :block_type => block.content_block_type
51
- else
52
- count
53
- end
54
- end
55
-
56
45
  def time_on_date(time)
57
46
  time && "#{time.strftime("%l:%M %p")} on #{time.strftime("%b %e, %Y")}"
58
47
  end
@@ -27,7 +27,7 @@ module Cms
27
27
  if Portlet === connectable
28
28
  cms.portlet_path(connectable)
29
29
  else
30
- connectable
30
+ polymorphic_path(build_path_for(connectable), options)
31
31
  end
32
32
  end
33
33
 
@@ -38,7 +38,26 @@ module Cms
38
38
  if Portlet === connectable
39
39
  edit_portlet_path(connectable, options)
40
40
  else
41
- polymorphic_path([:edit, connectable], options)
41
+ edit_polymorphic_path(build_path_for(connectable), options)
42
+ end
43
+ end
44
+
45
+ def link_to_usages(block)
46
+ count = block.connected_pages.count
47
+ if count > 0
48
+ # Would love a cleaner solution to this problem, see http://stackoverflow.com/questions/702728
49
+ path = if Portlet === block
50
+ usages_portlet_path(block)
51
+ else
52
+ p = []
53
+ p << engine_for(block)
54
+ p << :usages
55
+ p.concat path_elements_for(block)
56
+ p
57
+ end
58
+ link_to count, path, :id => block.id, :block_type => block.content_block_type
59
+ else
60
+ count
42
61
  end
43
62
  end
44
63
 
@@ -1,3 +1,3 @@
1
1
  <% @page_title = @toolbar_title = "Edit '#{@view.name}' #{dynamic_view_type.name.titleize}" %>
2
- <%= content_for :functions, link_to(span_tag("List All"), cms_index_path_for(dynamic_view_type.name.underscore.pluralize), :class => "button") %>
2
+ <%= content_for :functions, link_to(span_tag("List All"), cms_index_path_for(dynamic_view_type), :class => "button") %>
3
3
  <%= render :partial => 'form' %>
@@ -1,10 +1,10 @@
1
1
  <div class="cms_edit_container" style="height: auto; background: url(<%= asset_path "cms/containers/alpha.png" %>) repeat-x 0 0; border: 1px solid #999; margin: -8px 0 0 -8px; padding: 24px 7px 1px 7px; position: relative;">
2
2
  <div style="display: block; width: 100%; position: absolute; top: 5px; left: 5px; height: 30px;">
3
- <%= 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;"%>
3
+ <%= 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;", :id=>"add_new_content_#{name}"%>
4
4
  <%= link_to image_tag("cms/pages/connect_connectable.gif", :style => "text-decoration: none; padding: 0; background: none; margin: 0; float: none; border: none;"), cms.new_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}"%>
5
- <%= image_tag "cms/#{@page.container_published?(name) ? 'published' : 'draft'}_status.gif",
5
+ <%= image_tag "cms/#{@page.container_published?(name) ? 'published' : 'draft'}_status.gif",
6
6
  :class => "published_status",
7
- :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.",
7
+ :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.",
8
8
  :style => "text-decoration: none; padding: 0 2px 0 0; background: none; margin: 0; float: none; border: none; position: absolute; top: -1px; right: 12px;" %>
9
9
  </div>
10
10
  <%= content %>
data/doc/release_notes.md CHANGED
@@ -1,3 +1,13 @@
1
+ v3.4.2
2
+ ======
3
+
4
+ Maintenance Release
5
+
6
+ * [#502] Fix issue where Page templates/partials could not be editted through the UI
7
+ * [#491] Fix issue where custom blocks couldn't be viewed in page edit mode
8
+ * [#470] Fix issue where loading throws errors on some OS's (Ubuntu)
9
+
10
+
1
11
  v3.4.0
2
12
  ======
3
13
 
@@ -6,7 +6,7 @@ Feature: New Project Generator
6
6
 
7
7
  Scenario: Output the Version
8
8
  When I run `bcms -v`
9
- Then the output should contain "BrowserCMS 3.4.0"
9
+ Then the output should contain "BrowserCMS 3.4.2"
10
10
 
11
11
  Scenario: Create a new BrowserCMS project
12
12
  When I create a new BrowserCMS project named "hello"
@@ -40,6 +40,25 @@ Feature: Manage Content Blocks
40
40
  When I delete "Kindle Fire"
41
41
  Then I should be redirected to /cms/products
42
42
 
43
+ Scenario: Add to a page
44
+ When I visit /
45
+ And I turn on edit mode for /
46
+ And I add content to the main area of the page
47
+ And I click on "Product"
48
+ And I fill in "Name" with "iPhone"
49
+ And I click on "Save"
50
+ Then the response should be 200
51
+ And I should see "Name: iPhone"
52
+
53
+ Scenario: View Usages
54
+ Given a product "iPhone" has been added to a page
55
+ When I view that product
56
+ Then the response should be 200
57
+ And the page header should be "View Product 'iPhone'"
58
+ And I should see "Used on: 1 page"
59
+
60
+
61
+
43
62
 
44
63
 
45
64
 
@@ -38,5 +38,11 @@ Feature: Manage Html Blocks
38
38
  | published |
39
39
  | View Text 'Hello World' |
40
40
 
41
+ Scenario: View Usages
42
+ Given html with "Hello World" has been added to a page
43
+ When I view that block
44
+ Then the response should be 200
45
+ And the page header should be "View Text"
46
+ And I should see "Used on: 1 page"
41
47
 
42
48
 
@@ -23,3 +23,27 @@ Feature: Page Templates
23
23
  Then I should see "Displaying 1 - 15 of 20"
24
24
  When I click on "next_page_link"
25
25
  Then I should see "Displaying 16 - 20 of 20"
26
+
27
+ Scenario: Edit a template
28
+ Given the following page template exists:
29
+ | name |
30
+ | hello |
31
+ When I edit that page template
32
+ Then the response should be 200
33
+ And the page header should be "Edit 'hello' Cms/Page Template"
34
+ When I fill in "Name" with "hello_world"
35
+ And I press "Save"
36
+ Then the response should be 200
37
+ And the page header should be "List Page Templates"
38
+ And I should see the following content:
39
+ | hello_world |
40
+
41
+
42
+ Scenario: Delete a template
43
+ Given the following page template exists:
44
+ | name |
45
+ | hello |
46
+ When I delete that page template
47
+ Then the response should be 200
48
+ And the page header should be "List Page Templates"
49
+ And I should not see the "hello" template in the table
@@ -90,4 +90,11 @@ Feature: Portlets
90
90
  Given I am not logged in
91
91
  And a page with a portlet that raises both a 403 and any other error exists
92
92
  When I visit that page
93
- Then I should see the CMS :forbidden page
93
+ Then I should see the CMS :forbidden page
94
+
95
+ Scenario: View Usages
96
+ Given portlet named "Hello World" has been added to a page
97
+ When I view that portlet
98
+ Then the response should be 200
99
+ And the page header should be "View Portlet 'Hello World'"
100
+ And I should see "Used on: 1 page"
@@ -122,7 +122,7 @@ When /^BrowserCMS should be added the Gemfile$/ do
122
122
  end
123
123
 
124
124
  Then /^Gemfile should have the correct version of BrowserCMS$/ do
125
- check_file_content("Gemfile", %!gem "browsercms", "3.4.0.rc3"!, true)
125
+ check_file_content("Gemfile", %!gem "browsercms", "#{Cms::VERSION}"!, true)
126
126
  end
127
127
 
128
128
  When /^the production environment should be configured with reasonable defaults$/ do
@@ -0,0 +1,21 @@
1
+ Given /^the following page template exists:$/ do |table|
2
+ @page_templates =[]
3
+ table.hashes.each do |r|
4
+ @page_templates << Factory(:page_template, r)
5
+ end
6
+ end
7
+
8
+ When /^I edit that page template$/ do
9
+ visit "/cms/page_templates/#{@page_templates.first.id}/edit"
10
+ end
11
+ When /^I delete that page template$/ do
12
+ page.driver.delete "/cms/page_templates/#{@page_templates.first.id}"
13
+ assert_equal 302, page.status_code, "Should redirect after deleting"
14
+ visit "/cms/page_templates"
15
+ end
16
+
17
+ When /^I should not see the "([^"]*)" template in the table$/ do |content|
18
+ within ".data" do
19
+ assert !page.has_content?(content)
20
+ end
21
+ end
@@ -0,0 +1,34 @@
1
+ # Merge this into manage_content_block_steps after pulling this forward into 3.5.x
2
+
3
+ When /^I add content to the main area of the page$/ do
4
+ click_on "add_new_content_main"
5
+ end
6
+
7
+ Given /^a product "([^"]*)" has been added to a page$/ do |name|
8
+ @product = Product.create!(:name => name)
9
+ page = Factory(:public_page)
10
+ page.add_content(@product)
11
+ page.publish!
12
+ end
13
+
14
+ When /^I view that product$/ do
15
+ visit "/cms/products/#{@product.id}"
16
+ end
17
+
18
+ Given /^html with "([^"]*)" has been added to a page$/ do |body|
19
+ @block = Factory(:html_block, :content => body)
20
+ page = Factory(:public_page)
21
+ page.add_content(@block)
22
+ page.publish!
23
+ end
24
+
25
+ When /^I view that block/ do
26
+ visit "/cms/html_blocks/#{@block.id}"
27
+ end
28
+
29
+ Given /^portlet named "([^"]*)" has been added to a page$/ do |name|
30
+ @subject = Factory(:portlet, :name=>name)
31
+ page = Factory(:public_page)
32
+ page.add_content(@subject)
33
+ page.publish!
34
+ end
data/lib/cms/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
  # Allows the precise version of BrowserCMS to be determined programatically.
3
3
  #
4
4
  module Cms
5
- VERSION = "3.4.2.rc1"
5
+ VERSION = "3.4.2"
6
6
  end
@@ -13,17 +13,8 @@ class Cms::PathHelperTest < ActionController::TestCase
13
13
  def teardown
14
14
  end
15
15
 
16
- def test_edit_cms_connectable_path_for_html
17
- block = Cms::HtmlBlock.create!(:name=>"Testing")
18
- expected_path = "/cms/html_blocks/#{block.id}/edit"
19
- self.expects(:polymorphic_path).with([:edit, block], {}).returns(expected_path)
20
-
21
- path = edit_cms_connectable_path(block)
22
-
23
- assert_equal expected_path, path
24
- end
25
-
26
-
16
+ # These tests are probably redundant now since we have Scenario coverage.
17
+ # However, it will be easier to merge forward with an editted file rather than a deleted one.
27
18
  def test_edit_cms_connectable_path_for_portlets
28
19
  portlet = DynamicPortlet.create(:name => "Testing Route generation")
29
20
  expected_path = "/cms/portlets/#{portlet.id}/edit"
@@ -34,17 +25,6 @@ class Cms::PathHelperTest < ActionController::TestCase
34
25
  assert_equal(expected_path, path)
35
26
  end
36
27
 
37
- def test_edit_cms_connectable_path_includes_options_for_html
38
- block = Cms::HtmlBlock.create!(:name=>"Testing")
39
- expected_path = "/cms/html_blocks/#{block.id}/edit?_redirect_to=some_path"
40
- self.expects(:polymorphic_path).with([:edit, block], {:_redirect_to => "some_path"}).returns(expected_path)
41
-
42
- path = edit_cms_connectable_path(block, :_redirect_to => "some_path")
43
-
44
- assert_equal expected_path, path
45
-
46
- end
47
-
48
28
  def test_edit_cms_connectable_path_includes_options_for_portlets
49
29
  portlet = DynamicPortlet.create(:name => "Testing Route generation")
50
30
  expected_path = "/cms/portlets/#{portlet.id}/edit?_redirect_to=some_path"
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: browsercms
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.2.rc1
5
- prerelease: 6
4
+ version: 3.4.2
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - BrowserMedia
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-02 00:00:00.000000000 Z
12
+ date: 2012-04-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70352468859460 !ruby/object:Gem::Requirement
16
+ requirement: &70199854735120 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70352468859460
24
+ version_requirements: *70199854735120
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: ancestry
27
- requirement: &70352468884060 !ruby/object:Gem::Requirement
27
+ requirement: &70199854734640 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.2.4
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70352468884060
35
+ version_requirements: *70199854734640
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: ckeditor_rails
38
- requirement: &70352468883560 !ruby/object:Gem::Requirement
38
+ requirement: &70199854734120 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 3.6.2.2
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70352468883560
46
+ version_requirements: *70199854734120
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: jquery-rails
49
- requirement: &70352468883040 !ruby/object:Gem::Requirement
49
+ requirement: &70199854733620 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.0.14
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70352468883040
57
+ version_requirements: *70199854733620
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: term-ansicolor
60
- requirement: &70352468882620 !ruby/object:Gem::Requirement
60
+ requirement: &70199854733220 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70352468882620
68
+ version_requirements: *70199854733220
69
69
  description: Web Content Management in Rails.
70
70
  email: github@browsermedia.com
71
71
  executables:
@@ -631,12 +631,14 @@ files:
631
631
  - features/step_definitions/command_line_steps.rb
632
632
  - features/step_definitions/content_pages_steps.rb
633
633
  - features/step_definitions/data_steps.rb
634
+ - features/step_definitions/edit_page_templates_steps.rb
634
635
  - features/step_definitions/html_blocks_steps.rb
635
636
  - features/step_definitions/install_content_steps.rb
636
637
  - features/step_definitions/manage_content_blocks_steps.rb
637
638
  - features/step_definitions/manage_image_blocks_steps.rb
638
639
  - features/step_definitions/manage_sections_steps.rb
639
640
  - features/step_definitions/manage_user_steps.rb
641
+ - features/step_definitions/more_custom_block_steps.rb
640
642
  - features/step_definitions/page_route_steps.rb
641
643
  - features/step_definitions/page_template_steps.rb
642
644
  - features/step_definitions/permissions_steps.rb
@@ -924,9 +926,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
924
926
  required_rubygems_version: !ruby/object:Gem::Requirement
925
927
  none: false
926
928
  requirements:
927
- - - ! '>'
929
+ - - ! '>='
928
930
  - !ruby/object:Gem::Version
929
- version: 1.3.1
931
+ version: '0'
932
+ segments:
933
+ - 0
934
+ hash: -211829332800878731
930
935
  requirements: []
931
936
  rubyforge_project:
932
937
  rubygems_version: 1.8.10
@@ -974,12 +979,14 @@ test_files:
974
979
  - features/step_definitions/command_line_steps.rb
975
980
  - features/step_definitions/content_pages_steps.rb
976
981
  - features/step_definitions/data_steps.rb
982
+ - features/step_definitions/edit_page_templates_steps.rb
977
983
  - features/step_definitions/html_blocks_steps.rb
978
984
  - features/step_definitions/install_content_steps.rb
979
985
  - features/step_definitions/manage_content_blocks_steps.rb
980
986
  - features/step_definitions/manage_image_blocks_steps.rb
981
987
  - features/step_definitions/manage_sections_steps.rb
982
988
  - features/step_definitions/manage_user_steps.rb
989
+ - features/step_definitions/more_custom_block_steps.rb
983
990
  - features/step_definitions/page_route_steps.rb
984
991
  - features/step_definitions/page_template_steps.rb
985
992
  - features/step_definitions/permissions_steps.rb