browsercms 3.1.1 → 3.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -63,4 +63,4 @@ class Cms::DynamicViewsController < Cms::BaseController
63
63
  @view = dynamic_view_type.find(params[:id])
64
64
  end
65
65
 
66
- end
66
+ end
@@ -6,7 +6,14 @@ class Cms::PortletController < Cms::ApplicationController
6
6
  def execute_handler
7
7
  @portlet = Portlet.find(params[:id])
8
8
  @portlet.controller = self
9
- redirect_to @portlet.send(params[:handler])
9
+
10
+ method = params[:handler]
11
+ if @portlet.class.superclass.method_defined?(method) or @portlet.class.private_method_defined?(method) or @portlet.class.protected_method_defined?(method)
12
+ raise Cms::Errors::AccessDenied
13
+ else
14
+ redirect_to @portlet.send(method)
15
+ end
16
+
10
17
  end
11
18
 
12
- end
19
+ end
@@ -38,9 +38,6 @@ class Cms::TasksController < Cms::BaseController
38
38
  end
39
39
  redirect_to @task.page.path
40
40
  end
41
- rescue ActiveRecord::RecordNotFound
42
- flash[:error] = "No tasks were marked for completion"
43
- redirect_to cms_dashboard_path
44
41
  end
45
42
 
46
43
  private
@@ -21,18 +21,6 @@ module Cms
21
21
  end
22
22
  end
23
23
 
24
- # Determine if a given container has any blocks within it. Useful for determine if markup should be conditionally included
25
- # when a block is present, but not shown if no block was added. For example:
26
- #
27
- # <% unless container_has_block? :sidebar %>
28
- # <div id="sidebar">
29
- # <%= container :sidebar %>
30
- # </div>
31
- # <% end %>
32
- #
33
- # @param [Symbol] name The name of the container to check
34
- # @param [Proc] block
35
- # @return [Boolean] True if the container has one or more blocks, or if we are in edit mode. False otherwise.
36
24
  def container_has_block?(name, &block)
37
25
  has_block = (@mode == "edit") || current_page.connectable_count_for_container(name) > 0
38
26
  logger.info "mode = #{@mode}, has_block = #{has_block}"
@@ -19,7 +19,7 @@ class ContentType < ActiveRecord::Base
19
19
  # Given a 'key' like 'html_blocks' or 'portlet'
20
20
  # Raises exception if nothing was found.
21
21
  def self.find_by_key(key)
22
- class_name = key.singularize.tableize.classify
22
+ class_name = key.tableize.classify
23
23
  content_type = find_by_name(class_name)
24
24
  if content_type.nil?
25
25
  if class_name.constantize.ancestors.include?(Portlet)
data/app/models/page.rb CHANGED
@@ -41,21 +41,6 @@ class Page < ActiveRecord::Base
41
41
  :conditions => ['connectors.connectable_id = ? and connectors.connectable_type = ?', obj.id, obj.class.base_class.name] }
42
42
  end
43
43
  }
44
-
45
- # currently_connected_to tightens the scope of connected_to by restricting to the
46
- # results to matches on current versions of pages only. This renders obj versions
47
- # useless, as the older objects will very likely have older versions of pages and
48
- # thus return no results.
49
- named_scope :currently_connected_to, lambda { |obj|
50
- ver = obj.class.versioned? ? obj.version : nil
51
- if ver
52
- { :include => :connectors,
53
- :conditions => ['connectors.connectable_id = ? and connectors.connectable_type = ? and connectors.connectable_version = ? and connectors.page_version = pages.version', obj.id, obj.class.base_class.name, ver] }
54
- else
55
- { :include => :connectors,
56
- :conditions => ['connectors.connectable_id = ? and connectors.connectable_type = ? and connectors.page_version = pages.version', obj.id, obj.class.base_class.name] }
57
- end
58
- }
59
44
 
60
45
  has_one :section_node, :as => :node, :dependent => :destroy
61
46
 
@@ -95,23 +80,18 @@ class Page < ActiveRecord::Base
95
80
  if c.should_be_copied?
96
81
  connectable = c.connectable_type.constantize.versioned? ? c.connectable.as_of_version(c.connectable_version) : c.connectable
97
82
 
98
- version = connectable.class.versioned? ? connectable.version : nil
99
-
100
83
  #If we are copying connectors from a previous version, that means we are reverting this page,
101
- #in which case we should create a new version of the block, and connect this page to that block.
102
- #If the connectable is versioned, the connector needs to reference the newly drafted connector
103
- #that is created during the revert_to method
84
+ #in which case we should create a new version of the block, and connect this page to that block
104
85
  if @copy_connectors_from_version && connectable.class.versioned? && (connectable.version != connectable.draft.version)
105
86
  connectable = connectable.class.find(connectable.id)
106
87
  connectable.updated_by_page = self
107
88
  connectable.revert_to(c.connectable_version)
108
- version = connectable.class.versioned? ? connectable.draft.version : nil
109
89
  end
110
90
 
111
91
  new_connector = connectors.build(
112
92
  :page_version => options[:to_version_number],
113
93
  :connectable => connectable,
114
- :connectable_version => version,
94
+ :connectable_version => connectable.class.versioned? ? connectable.version : nil,
115
95
  :container => c.container,
116
96
  :position => c.position
117
97
  )
@@ -55,4 +55,4 @@
55
55
  <div class="pagination">No results found for '<%= params[:key_word] %>'</div>
56
56
  <% elsif @views.total_pages > 1 %>
57
57
  <%= render_pagination @views, dynamic_view_type.name.pluralize.underscore.to_sym %>
58
- <% end %>
58
+ <% end %>
data/browsercms.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{browsercms}
8
- s.version = "3.1.1"
8
+ s.version = "3.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["BrowserMedia"]
12
- s.date = %q{2010-06-28}
12
+ s.date = %q{2010-06-30}
13
13
  s.description = %q{General purpose Web Content Management in Rails.}
14
14
  s.email = %q{github@browsermedia.com}
15
15
  s.executables = ["browsercms", "bcms"]
@@ -1342,88 +1342,88 @@ Gem::Specification.new do |s|
1342
1342
  s.rdoc_options = ["--charset=UTF-8"]
1343
1343
  s.require_paths = ["lib"]
1344
1344
  s.rubyforge_project = %q{browsercms}
1345
- s.rubygems_version = %q{1.3.5}
1345
+ s.rubygems_version = %q{1.3.7}
1346
1346
  s.summary = %q{BrowserCMS is a general purpose, open source Web Content Management System (CMS) written in Ruby on Rails. Designed for web developers who want to create great looking websites while using standard Rails tools for customizing it.}
1347
1347
  s.test_files = [
1348
- "test/integration/login_test.rb",
1349
- "test/integration/cms/password_management_test.rb",
1350
- "test/integration/cms/ckeditor_test.rb",
1351
- "test/functional/tests/pretend_controller_test.rb",
1352
- "test/functional/cms/links_controller_test.rb",
1353
- "test/functional/cms/image_blocks_controller_test.rb",
1348
+ "test/custom_assertions.rb",
1349
+ "test/factories.rb",
1354
1350
  "test/functional/cms/cache_controller_test.rb",
1355
- "test/functional/cms/home_controller_test.rb",
1356
- "test/functional/cms/pages_controller_test.rb",
1351
+ "test/functional/cms/categories_controller_test.rb",
1352
+ "test/functional/cms/connectors_controller_test.rb",
1357
1353
  "test/functional/cms/content_block_controller_test.rb",
1358
- "test/functional/cms/dashboard_controller_test.rb",
1354
+ "test/functional/cms/content_controller_test.rb",
1359
1355
  "test/functional/cms/content_types_controller_test.rb",
1360
- "test/functional/cms/portlets_controller_test.rb",
1356
+ "test/functional/cms/dashboard_controller_test.rb",
1357
+ "test/functional/cms/dynamic_views_controller_test.rb",
1358
+ "test/functional/cms/file_blocks_controller_test.rb",
1359
+ "test/functional/cms/groups_controller_test.rb",
1360
+ "test/functional/cms/home_controller_test.rb",
1361
1361
  "test/functional/cms/html_blocks_controller_test.rb",
1362
+ "test/functional/cms/image_blocks_controller_test.rb",
1363
+ "test/functional/cms/links_controller_test.rb",
1364
+ "test/functional/cms/pages_controller_test.rb",
1365
+ "test/functional/cms/portlets_controller_test.rb",
1362
1366
  "test/functional/cms/section_nodes_controller_test.rb",
1363
- "test/functional/cms/toolbar_controller_test.rb",
1367
+ "test/functional/cms/sections_controller_test.rb",
1364
1368
  "test/functional/cms/sessions_controller_test.rb",
1369
+ "test/functional/cms/toolbar_controller_test.rb",
1365
1370
  "test/functional/cms/users_controller_test.rb",
1366
- "test/functional/cms/categories_controller_test.rb",
1367
- "test/functional/cms/file_blocks_controller_test.rb",
1368
- "test/functional/cms/content_controller_test.rb",
1369
- "test/functional/cms/connectors_controller_test.rb",
1370
- "test/functional/cms/dynamic_views_controller_test.rb",
1371
- "test/functional/cms/sections_controller_test.rb",
1372
- "test/functional/cms/groups_controller_test.rb",
1373
- "test/unit/behaviors/searching_test.rb",
1371
+ "test/functional/tests/pretend_controller_test.rb",
1372
+ "test/integration/cms/ckeditor_test.rb",
1373
+ "test/integration/cms/password_management_test.rb",
1374
+ "test/integration/login_test.rb",
1375
+ "test/test_helper.rb",
1376
+ "test/test_logging.rb",
1374
1377
  "test/unit/behaviors/attaching_test.rb",
1375
1378
  "test/unit/behaviors/dynamic_attributes_test.rb",
1376
- "test/unit/behaviors/taggable_test.rb",
1377
1379
  "test/unit/behaviors/publishable_test.rb",
1380
+ "test/unit/behaviors/searching_test.rb",
1381
+ "test/unit/behaviors/taggable_test.rb",
1382
+ "test/unit/extensions/active_record/base_test.rb",
1378
1383
  "test/unit/extensions/hash_test.rb",
1379
1384
  "test/unit/extensions/integer_test.rb",
1380
- "test/unit/extensions/active_record/base_test.rb",
1381
- "test/unit/models/page_test.rb",
1382
- "test/unit/models/email_page_portlet_test.rb",
1385
+ "test/unit/helpers/application_helper_test.rb",
1386
+ "test/unit/helpers/form_builder_test.rb",
1387
+ "test/unit/helpers/menu_helper_test.rb",
1388
+ "test/unit/helpers/page_helper_test.rb",
1389
+ "test/unit/helpers/path_helper_test.rb",
1390
+ "test/unit/lib/acts_as_content_page_test.rb",
1391
+ "test/unit/lib/cms/authentication/controller_test.rb",
1392
+ "test/unit/lib/cms_domain_support_test.rb",
1393
+ "test/unit/lib/command_line_test.rb",
1394
+ "test/unit/lib/content_block_test.rb",
1395
+ "test/unit/lib/content_rendering_support_test.rb",
1396
+ "test/unit/lib/generators_test.rb",
1397
+ "test/unit/lib/routes_test.rb",
1383
1398
  "test/unit/models/attachment_test.rb",
1399
+ "test/unit/models/category_test.rb",
1400
+ "test/unit/models/category_type_test.rb",
1384
1401
  "test/unit/models/connector_test.rb",
1385
- "test/unit/models/html_block_test.rb",
1386
- "test/unit/models/portlet_test.rb",
1387
- "test/unit/models/section_node_test.rb",
1388
1402
  "test/unit/models/content_type_test.rb",
1403
+ "test/unit/models/email_page_portlet_test.rb",
1404
+ "test/unit/models/file_block_test.rb",
1389
1405
  "test/unit/models/group_test.rb",
1390
- "test/unit/models/page_template_test.rb",
1391
- "test/unit/models/site_test.rb",
1392
- "test/unit/models/permission_test.rb",
1406
+ "test/unit/models/html_block_test.rb",
1393
1407
  "test/unit/models/link_test.rb",
1394
- "test/unit/models/task_test.rb",
1395
1408
  "test/unit/models/page_partial_test.rb",
1396
- "test/unit/models/user_test.rb",
1397
- "test/unit/models/file_block_test.rb",
1398
- "test/unit/models/category_type_test.rb",
1399
1409
  "test/unit/models/page_route_test.rb",
1410
+ "test/unit/models/page_template_test.rb",
1411
+ "test/unit/models/page_test.rb",
1412
+ "test/unit/models/permission_test.rb",
1413
+ "test/unit/models/portlet_test.rb",
1414
+ "test/unit/models/section_node_test.rb",
1400
1415
  "test/unit/models/sections_test.rb",
1401
- "test/unit/models/category_test.rb",
1402
- "test/unit/schema_statements_test.rb",
1403
- "test/unit/lib/acts_as_content_page_test.rb",
1404
- "test/unit/lib/generators_test.rb",
1405
- "test/unit/lib/routes_test.rb",
1406
- "test/unit/lib/cms_domain_support_test.rb",
1407
- "test/unit/lib/cms/authentication/controller_test.rb",
1408
- "test/unit/lib/content_rendering_support_test.rb",
1409
- "test/unit/lib/command_line_test.rb",
1410
- "test/unit/lib/content_block_test.rb",
1411
- "test/unit/helpers/menu_helper_test.rb",
1412
- "test/unit/helpers/application_helper_test.rb",
1413
- "test/unit/helpers/page_helper_test.rb",
1414
- "test/unit/helpers/form_builder_test.rb",
1415
- "test/unit/helpers/path_helper_test.rb",
1416
- "test/custom_assertions.rb",
1417
- "test/test_logging.rb",
1418
- "test/factories.rb",
1419
- "test/test_helper.rb"
1416
+ "test/unit/models/site_test.rb",
1417
+ "test/unit/models/task_test.rb",
1418
+ "test/unit/models/user_test.rb",
1419
+ "test/unit/schema_statements_test.rb"
1420
1420
  ]
1421
1421
 
1422
1422
  if s.respond_to? :specification_version then
1423
1423
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
1424
1424
  s.specification_version = 3
1425
1425
 
1426
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
1426
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
1427
1427
  else
1428
1428
  end
1429
1429
  else
@@ -135,7 +135,7 @@
135
135
  <div id="subCol">
136
136
  <h3 class="chapter"><img src="images/chapters_icon.gif" alt="" />Chapters</h3>
137
137
  <ol class="chapters">
138
- <li><a href="#introduction">Introduction</a><ul><li><a href="#typical-design-process">Typical Design Process</a></li><li><a href="#design-considerations">Design Considerations</a></li></ul></li><li><a href="#creating-a-page-template">Creating a Page Template</a><ul><li><a href="#files-or-content">Files or Content?</a></li><li><a href="#understanding-containers">Understanding Containers</a></li><li><a href="#adding-a-sidebar-container">Adding A Sidebar Container</a></li></ul></li><li><a href="#tags-quick-reference">Tags Quick Reference</a><ul><li><a href="#required-tags">Required Tags</a></li><li><a href="#container-tag"><tt>container</tt> Tag</a></li><li><a href="#container-has-block-tag"><tt>container_has_block?</tt> Tag</a></li><li><a href="#cms-toolbar-tag"><tt>cms_toolbar</tt> Tag</a></li><li><a href="#html-head-tag"><span class="caps">HTML</span> Head Tag</a></li><li><a href="#page-title-tag"><tt>page_title</tt> Tag</a></li><li><a href="#current-page-tag"><tt>current_page</tt> Tag</a></li><li><a href="#render-portlet-tag"><tt>render_portlet</tt> Tag</a></li><li><a href="#render-connectable-tag"><tt>render_connectable</tt> Tag</a></li></ul></li><li><a href="#navigation">Navigation</a><ul><li><a href="#basic-rules-of-menus">Basic Rules of Menus</a></li><li><a href="#using-menus">Using Menus</a></li><li><a href="#how-deep-should-menus-be">How Deep Should Menus Be?</a></li><li><a href="#primary-navigation">Primary Navigation</a></li><li><a href="#sub-navigation">Sub Navigation</a></li><li><a href="#site-maps-and-flyout-menus">Site Maps and Flyout Menus</a></li><li><a href="#using-breadcrumbs">Using Breadcrumbs</a></li></ul></li><li><a href="#using-partials">Using Partials</a><ul></ul></li></ol></div>
138
+ <li><a href="#introduction">Introduction</a><ul><li><a href="#typical-design-process">Typical Design Process</a></li><li><a href="#design-considerations">Design Considerations</a></li></ul></li><li><a href="#creating-a-page-template">Creating a Page Template</a><ul><li><a href="#files-or-content">Files or Content?</a></li><li><a href="#understanding-containers">Understanding Containers</a></li><li><a href="#adding-a-sidebar-container">Adding A Sidebar Container</a></li></ul></li><li><a href="#tags-quick-reference">Tags Quick Reference</a><ul><li><a href="#required-tags">Required Tags</a></li><li><a href="#container-tag"><tt>container</tt> Tag</a></li><li><a href="#cms-toolbar-tag"><tt>cms_toolbar</tt> Tag</a></li><li><a href="#html-head-tag"><span class="caps">HTML</span> Head Tag</a></li><li><a href="#page-title-tag"><tt>page_title</tt> Tag</a></li><li><a href="#current-page-tag"><tt>current_page</tt> Tag</a></li><li><a href="#render-portlet-tag"><tt>render_portlet</tt> Tag</a></li><li><a href="#render-connectable-tag"><tt>render_connectable</tt> Tag</a></li></ul></li><li><a href="#navigation">Navigation</a><ul><li><a href="#basic-rules-of-menus">Basic Rules of Menus</a></li><li><a href="#using-menus">Using Menus</a></li><li><a href="#how-deep-should-menus-be">How Deep Should Menus Be?</a></li><li><a href="#primary-navigation">Primary Navigation</a></li><li><a href="#sub-navigation">Sub Navigation</a></li><li><a href="#site-maps-and-flyout-menus">Site Maps and Flyout Menus</a></li><li><a href="#using-breadcrumbs">Using Breadcrumbs</a></li></ul></li><li><a href="#using-partials">Using Partials</a><ul></ul></li></ol></div>
139
139
  </td>
140
140
  <td class="guides">
141
141
  <h2>Templates Guide</h2>
@@ -229,7 +229,6 @@
229
229
  <p>This section covers a reference for all the tags (aka Helper Methods) that can be used in Page Templates to render various elements. Here is a quick list of the available tags, their purpose and whether they are required or not.</p>
230
230
  <p>._ Name |<em>. Purpose | Required? |
231
231
  | <tt>container</tt> | A named area that allows users to add/edit content | Yes |
232
- | <tt>container_has_block</tt> | To hide markup if a container is empty | No |
233
232
  | <tt>cms_toolbar</tt> | Renders the <span class="caps">CMS</span> toolbar controller required for editing and navigation. Should be very first element in <tt>body</tt> | Yes |
234
233
  | <tt>yield :html_head | This allows the CMS to insert javascript and other information into the page. Should be last element in </tt>head+ | Yes |
235
234
  | <tt>page_title</tt> | Inserts the &#8216;Name&#8217; of the page (or &#8216;Title&#8217; if it exists) | No |
@@ -250,13 +249,7 @@
250
249
  &lt;div&gt;&lt;%= container :footer %&gt;&lt;/div&gt;</code></div>
251
250
  <p>Container names are just labels. So if you defined 5 containers on a template (header, footer, left, main, right), you could swap between any two templates which defined all those containers.</p>
252
251
  <div class='note'><p>Be aware that if you add content to a page in a container (like <tt>:sidebar</tt>) then change a pages template to one which does not have that container, the content will be &#8216;orphaned&#8217;. To remove that content, you would need to swap back to the previous template, remove the content, then change back to the new template again.</p></div>
253
- <h4 id="container-has-block-tag">3.3 <tt>container_has_block?</tt> Tag</h4>
254
- <p>This tag can be used to hide or show containers based on whether a user has placed content in them. While an empty <tt>container</tt> tag won&#8217;t show anything, very frequently template builders will create &#8216;wrapper&#8217; markup around containers that shouldn&#8217;t appear when nothing is placed there. For example, suppose we have a sidebar container that we want to have a styled border on, but we only want it to appear when something is in that container. Here&#8217;s how you would do that:</p>
255
- <div class="code_container"><code class="html">&lt;% unless container_has_block? :sidebar %&gt;
256
- &lt;div id=&quot;sidebar&quot;&gt;&lt;%= container :sidebar %&gt;&lt;/div&gt;
257
- &lt;% end %&gt;</code></div>
258
- <p>This tag returns true if the user is in edit mode as well, regardless of whether there is content within the container. This is important, because otherwise, an editor would never be able to select the container to add content to!</p>
259
- <h4 id="cms-toolbar-tag">3.4 <tt>cms_toolbar</tt> Tag</h4>
252
+ <h4 id="cms-toolbar-tag">3.3 <tt>cms_toolbar</tt> Tag</h4>
260
253
  <p>This tag is how the toolbar is inserted into templates. It should be the first element in the <tt>body</tt> element of a page. In most cases, you can just use it as follows:</p>
261
254
  <div class="code_container"><code class="html">&lt;body&gt;
262
255
  &lt;%= cms_toolbar %&gt;
@@ -264,20 +257,20 @@
264
257
  &lt;!-- Text goes here --&gt;
265
258
  &lt;/body&gt;</code></div>
266
259
  <p>The toolbar is written out as an iframe which makes its less likely that styles/javascript will clash with the page being editted.</p>
267
- <h4 id="html-head-tag">3.5 <span class="caps">HTML</span> Head Tag</h4>
260
+ <h4 id="html-head-tag">3.4 <span class="caps">HTML</span> Head Tag</h4>
268
261
  <p>This tag is technically a standard <tt>yield</tt> call, with a particularly named <tt>:html_head</tt>. This tag must be included in all <span class="caps">CMS</span> templates to allow it to insert the necessary javascript and style elements. It should probably be the last element in <tt>head</tt> element of a page.</p>
269
262
  <div class="code_container"><code class="html">&lt;head&gt;
270
263
  &lt;title&gt;&lt;%= page_title %&gt;&lt;/title&gt;
271
264
  &lt;%= yield :html_head %&gt;
272
265
  &lt;/head&gt;</code></div>
273
- <h4 id="page-title-tag">3.6 <tt>page_title</tt> Tag</h4>
266
+ <h4 id="page-title-tag">3.5 <tt>page_title</tt> Tag</h4>
274
267
  <p>This tag will output the <tt>name</tt> attribute of the current page. If the <tt>title</tt> attribute is specified, it will output that instead. This allows users to have one label for a page appear in the navigation (navigation and the sitemap always use <tt>name</tt>) and another in the header or title bar on a page.</p>
275
268
  <p>Example:</p>
276
269
  <div class="code_container"><code class="html">&lt;title&gt;My Site | &lt;%= page_title %&gt;&lt;/title&gt;</code></div>
277
270
  <p>This is using the page_title tag to title element of a page.</p>
278
271
  <div class="code_container"><code class="html">&lt;h1&gt;&lt;%= page_title %&gt;&lt;/h1&gt;</code></div>
279
272
  <p>Another common usage of <tt>page_title</tt> is for the H1 or H2 on a page.</p>
280
- <h4 id="current-page-tag">3.7 <tt>current_page</tt> Tag</h4>
273
+ <h4 id="current-page-tag">3.6 <tt>current_page</tt> Tag</h4>
281
274
  <p>This doesn&#8217;t render anything, but returns a reference to the current <tt>Page</tt> object that is being rendered. It can be used to access other attributes of the page, like the name of the section or the <tt>description</tt> of the Page. Here are some common examples:</p>
282
275
  <div class="code_container"><code class="html">&lt;%= current_page.name %&gt;</code></div>
283
276
  <p>This outputs the <tt>name</tt> attribute of the page, similar to how <tt>page_title</tt> works. You might do this if you had specified a <tt>title</tt> attribute for pages which was different than the <tt>name</tt>, but wanted to compare names.</p>
@@ -288,11 +281,11 @@
288
281
  &lt;% end %&gt;</code></div>
289
282
  <p>This renders a specific image if the page is within the top level &#8216;About Us&#8217; section. The <tt>top_level_section</tt> method finds the very top level section for a give page, regardless of how far down it is in the sitemap. Useful for making comparisons based on the first level of navigation.</p>
290
283
  <div class='note'><p>Any page or section attribute is reachable in the way. You will need to look at the <span class="caps">API</span> documentation for <tt>Page</tt> and <tt>Section</tt> to see all the available attributes.</p></div>
291
- <h4 id="render-portlet-tag">3.8 <tt>render_portlet</tt> Tag</h4>
284
+ <h4 id="render-portlet-tag">3.7 <tt>render_portlet</tt> Tag</h4>
292
285
  <p>This tag will render a portlet from a template. Normally portlets are placed individually on each page by users. This tag is useful for common elements that might appear on multiple pages throughout the site. An example of this might be a Login Portlet which should appear as part of the header on all pages. Here&#8217;s an example:</p>
293
286
  <div class="code_container"><code class="html">&lt;%= render_portlet &quot;Nav Login Form&quot; %&gt;</code></div>
294
287
  <p>The only argument to <tt>render_portlet</tt> is a name. This name will match the name specified in the UI when you add a portlet. You will need to create the portlet and name in appropriately for this tag to work. The portlet will render itself based on its template.</p>
295
- <h4 id="render-connectable-tag">3.9 <tt>render_connectable</tt> Tag</h4>
288
+ <h4 id="render-connectable-tag">3.8 <tt>render_connectable</tt> Tag</h4>
296
289
  <p>This tag can render a specific block in a page. It takes one argument, the block itself. This could be used to automatically include, say a footer, into a page as part of the template. For instance:</p>
297
290
  <div class="code_container"><code class="html">&lt;% footer = HtmlBlock.find(12) %&gt;
298
291
  &lt;%= render_connectable(footer) %&gt;</code></div>
@@ -209,11 +209,12 @@ end</code></div>
209
209
  <p>Now each instance of the RecentProducts can have its own unique template. Each time a new portlet is created, the contents of
210
210
  the &#8216;render.html.erb&#8217; will be copied into the template attribute of the portlet and used to display the portlet. Users can
211
211
  update these views as they see fit.</p>
212
- <p><strong>Gotcha:</strong> It&#8217;s important to remember that once a portlet has a saved template, it will ignore what&#8217;s in the render.html.erb. So changes made there won&#8217;t be reflected until the portlet&#8217;s template has been updated again.</p>
212
+ <p><strong>Gotcha:</strong> It&#8217;s important to remember that once a portlet has a saved template, it will ignore what&#8217;s in the render.html.erb. So changes made there won&#8217;t
213
+ be reflected until the portlet&#8217;s template has been updated again.</p>
213
214
  <h4 id="default-template-handlers">1.2 Default Template Handlers</h4>
214
215
  <p>By default, templates are treated as erb views. The template editor has a drop down that allows users to choose other types like &#8216;builder&#8217; or &#8216;rhtml&#8217;. To set the default handler
215
216
  to something other than erb, modify the _form.html.erb to the following:</p>
216
- <div class="code_container"><code class="html">&lt;%= f.cms_template_editor :template, :default_handler=&gt;&quot;builder&quot; %&gt;</code></div>
217
+ <div class="code_container"><code class="html">&lt;%= f.template_editor :template, :default_handler=&gt;&quot;builder&quot; %&gt;</code></div>
217
218
  <h4 id="alternative-handlers-for-non-editable-templates">1.3 Alternative handlers for non-editable templates</h4>
218
219
  <p>If the template_editor is disabled, you can also set the handler directly on the portlet like so:</p>
219
220
  <div class="code_container"><code class="ruby">class RecentProducts &lt; Portlet
@@ -222,7 +223,7 @@ to something other than erb, modify the _form.html.erb to the following:</p>
222
223
  end</code></div>
223
224
  <h4 id="using-haml-templates">1.4 Using <span class="caps">HAML</span> templates</h4>
224
225
  <p>The default list of handlers does not include Haml. To do that, install the <span class="caps">HAML</span> gem and set the default_value to &#8216;haml&#8217; like so:</p>
225
- <div class="code_container"><code class="html">&lt;%= f.cms_template_editor :template, :default_handler=&gt;&quot;haml&quot; %&gt;</code></div>
226
+ <div class="code_container"><code class="html">&lt;%= f.template_editor :template, :default_handler=&gt;&quot;haml&quot; %&gt;</code></div>
226
227
  </td>
227
228
  </tr>
228
229
  </table>
@@ -39,11 +39,11 @@ module Cms
39
39
  module InstanceMethods
40
40
 
41
41
  def connected_pages
42
- Page.currently_connected_to(self)
42
+ Page.connected_to(self)
43
43
  end
44
44
 
45
45
  def connected_page_count
46
- Page.currently_connected_to(self).count
46
+ Page.connected_to(self).count
47
47
  end
48
48
 
49
49
  def content_block_type
data/lib/cms/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
  # Allows the precise version of BrowserCMS to be determined programmatically.
3
3
  #
4
4
  module Cms
5
- VERSION = "3.2.0"
5
+ VERSION = "3.1.2"
6
6
  end
@@ -24,7 +24,6 @@ class Cms::DynamicViewsControllerTest < ActionController::TestCase
24
24
  assert_select "#page_template_#{@deleted_page_template.id} div",
25
25
  :text => "Deleted (html/erb)", :count => 0
26
26
  end
27
-
28
27
  def test_index_paging
29
28
  @page_templates = []
30
29
  20.times do |i|
@@ -49,6 +48,5 @@ class Cms::DynamicViewsControllerTest < ActionController::TestCase
49
48
  # count minus 15 on second page
50
49
  should_have = PageTemplate.all.length - 15
51
50
  assert_equal should_have, assigns['views'].length
52
- end
53
-
54
- end
51
+ end
52
+ end
@@ -150,8 +150,7 @@ class Cms::HtmlBlocksControllerTest < ActionController::TestCase
150
150
  @page = Factory(:page, :section => root_section, :name => "Included")
151
151
  @page2 = Factory(:page, :section => root_section, :path => "/other_path", :name => "Excluded")
152
152
  @block = Factory(:html_block, :connect_to_page_id => @page.id, :connect_to_container => "main")
153
- @page.publish! # usages are only relevant when page is published
154
-
153
+
155
154
  get :usages, :id => @block.id
156
155
 
157
156
  assert_response :success
@@ -161,4 +160,4 @@ class Cms::HtmlBlocksControllerTest < ActionController::TestCase
161
160
  assert_select "h3", "Content Types"
162
161
  end
163
162
 
164
- end
163
+ end
@@ -50,7 +50,6 @@ class Cms::PortletsControllerTest < ActionController::TestCase
50
50
  @page = Factory(:page, :section => root_section, :name => "Test Page", :path => "test")
51
51
  @page.create_connector(@block, "main")
52
52
  @page.reload
53
- @page.publish! # usages are only relevant when page is published
54
53
 
55
54
  get :usages, :id => @block.id
56
55
 
@@ -65,4 +64,4 @@ class Cms::PortletsControllerTest < ActionController::TestCase
65
64
  assert_select "div.instructions", "Leave blank to send the user to the page they were trying to access"
66
65
 
67
66
  end
68
- end
67
+ end
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: browsercms
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ hash: 7
5
+ prerelease: false
6
+ segments:
7
+ - 3
8
+ - 1
9
+ - 2
10
+ version: 3.1.2
5
11
  platform: ruby
6
12
  authors:
7
13
  - BrowserMedia
@@ -9,7 +15,7 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-06-28 00:00:00 -04:00
18
+ date: 2010-06-30 00:00:00 -04:00
13
19
  default_executable:
14
20
  dependencies: []
15
21
 
@@ -1345,6 +1351,80 @@ files:
1345
1351
  - templates/module.rb
1346
1352
  - LICENSE.txt
1347
1353
  - README.markdown
1354
+ - test/custom_assertions.rb
1355
+ - test/factories.rb
1356
+ - test/functional/cms/cache_controller_test.rb
1357
+ - test/functional/cms/categories_controller_test.rb
1358
+ - test/functional/cms/connectors_controller_test.rb
1359
+ - test/functional/cms/content_block_controller_test.rb
1360
+ - test/functional/cms/content_controller_test.rb
1361
+ - test/functional/cms/content_types_controller_test.rb
1362
+ - test/functional/cms/dashboard_controller_test.rb
1363
+ - test/functional/cms/dynamic_views_controller_test.rb
1364
+ - test/functional/cms/file_blocks_controller_test.rb
1365
+ - test/functional/cms/groups_controller_test.rb
1366
+ - test/functional/cms/home_controller_test.rb
1367
+ - test/functional/cms/html_blocks_controller_test.rb
1368
+ - test/functional/cms/image_blocks_controller_test.rb
1369
+ - test/functional/cms/links_controller_test.rb
1370
+ - test/functional/cms/pages_controller_test.rb
1371
+ - test/functional/cms/portlets_controller_test.rb
1372
+ - test/functional/cms/section_nodes_controller_test.rb
1373
+ - test/functional/cms/sections_controller_test.rb
1374
+ - test/functional/cms/sessions_controller_test.rb
1375
+ - test/functional/cms/toolbar_controller_test.rb
1376
+ - test/functional/cms/users_controller_test.rb
1377
+ - test/functional/tests/pretend_controller_test.rb
1378
+ - test/integration/cms/ckeditor_test.rb
1379
+ - test/integration/cms/password_management_test.rb
1380
+ - test/integration/login_test.rb
1381
+ - test/test_helper.rb
1382
+ - test/test_logging.rb
1383
+ - test/unit/behaviors/attaching_test.rb
1384
+ - test/unit/behaviors/dynamic_attributes_test.rb
1385
+ - test/unit/behaviors/publishable_test.rb
1386
+ - test/unit/behaviors/searching_test.rb
1387
+ - test/unit/behaviors/taggable_test.rb
1388
+ - test/unit/extensions/active_record/base_test.rb
1389
+ - test/unit/extensions/hash_test.rb
1390
+ - test/unit/extensions/integer_test.rb
1391
+ - test/unit/helpers/application_helper_test.rb
1392
+ - test/unit/helpers/form_builder_test.rb
1393
+ - test/unit/helpers/menu_helper_test.rb
1394
+ - test/unit/helpers/page_helper_test.rb
1395
+ - test/unit/helpers/path_helper_test.rb
1396
+ - test/unit/lib/acts_as_content_page_test.rb
1397
+ - test/unit/lib/cms/authentication/controller_test.rb
1398
+ - test/unit/lib/cms_domain_support_test.rb
1399
+ - test/unit/lib/command_line_test.rb
1400
+ - test/unit/lib/content_block_test.rb
1401
+ - test/unit/lib/content_rendering_support_test.rb
1402
+ - test/unit/lib/generators_test.rb
1403
+ - test/unit/lib/routes_test.rb
1404
+ - test/unit/models/attachment_test.rb
1405
+ - test/unit/models/category_test.rb
1406
+ - test/unit/models/category_type_test.rb
1407
+ - test/unit/models/connector_test.rb
1408
+ - test/unit/models/content_type_test.rb
1409
+ - test/unit/models/email_page_portlet_test.rb
1410
+ - test/unit/models/file_block_test.rb
1411
+ - test/unit/models/group_test.rb
1412
+ - test/unit/models/html_block_test.rb
1413
+ - test/unit/models/link_test.rb
1414
+ - test/unit/models/page_partial_test.rb
1415
+ - test/unit/models/page_route_test.rb
1416
+ - test/unit/models/page_template_test.rb
1417
+ - test/unit/models/page_test.rb
1418
+ - test/unit/models/permission_test.rb
1419
+ - test/unit/models/portlet_test.rb
1420
+ - test/unit/models/section_node_test.rb
1421
+ - test/unit/models/sections_test.rb
1422
+ - test/unit/models/site_test.rb
1423
+ - test/unit/models/task_test.rb
1424
+ - test/unit/models/user_test.rb
1425
+ - test/unit/schema_statements_test.rb
1426
+ - bin/browsercms
1427
+ - bin/bcms
1348
1428
  has_rdoc: true
1349
1429
  homepage: http://www.browsercms.org
1350
1430
  licenses: []
@@ -1355,94 +1435,100 @@ rdoc_options:
1355
1435
  require_paths:
1356
1436
  - lib
1357
1437
  required_ruby_version: !ruby/object:Gem::Requirement
1438
+ none: false
1358
1439
  requirements:
1359
1440
  - - ">="
1360
1441
  - !ruby/object:Gem::Version
1442
+ hash: 3
1443
+ segments:
1444
+ - 0
1361
1445
  version: "0"
1362
- version:
1363
1446
  required_rubygems_version: !ruby/object:Gem::Requirement
1447
+ none: false
1364
1448
  requirements:
1365
1449
  - - ">="
1366
1450
  - !ruby/object:Gem::Version
1451
+ hash: 3
1452
+ segments:
1453
+ - 0
1367
1454
  version: "0"
1368
- version:
1369
1455
  requirements: []
1370
1456
 
1371
1457
  rubyforge_project: browsercms
1372
- rubygems_version: 1.3.5
1458
+ rubygems_version: 1.3.7
1373
1459
  signing_key:
1374
1460
  specification_version: 3
1375
1461
  summary: BrowserCMS is a general purpose, open source Web Content Management System (CMS) written in Ruby on Rails. Designed for web developers who want to create great looking websites while using standard Rails tools for customizing it.
1376
1462
  test_files:
1377
- - test/integration/login_test.rb
1378
- - test/integration/cms/password_management_test.rb
1379
- - test/integration/cms/ckeditor_test.rb
1380
- - test/functional/tests/pretend_controller_test.rb
1381
- - test/functional/cms/links_controller_test.rb
1382
- - test/functional/cms/image_blocks_controller_test.rb
1463
+ - test/custom_assertions.rb
1464
+ - test/factories.rb
1383
1465
  - test/functional/cms/cache_controller_test.rb
1384
- - test/functional/cms/home_controller_test.rb
1385
- - test/functional/cms/pages_controller_test.rb
1466
+ - test/functional/cms/categories_controller_test.rb
1467
+ - test/functional/cms/connectors_controller_test.rb
1386
1468
  - test/functional/cms/content_block_controller_test.rb
1387
- - test/functional/cms/dashboard_controller_test.rb
1469
+ - test/functional/cms/content_controller_test.rb
1388
1470
  - test/functional/cms/content_types_controller_test.rb
1389
- - test/functional/cms/portlets_controller_test.rb
1471
+ - test/functional/cms/dashboard_controller_test.rb
1472
+ - test/functional/cms/dynamic_views_controller_test.rb
1473
+ - test/functional/cms/file_blocks_controller_test.rb
1474
+ - test/functional/cms/groups_controller_test.rb
1475
+ - test/functional/cms/home_controller_test.rb
1390
1476
  - test/functional/cms/html_blocks_controller_test.rb
1477
+ - test/functional/cms/image_blocks_controller_test.rb
1478
+ - test/functional/cms/links_controller_test.rb
1479
+ - test/functional/cms/pages_controller_test.rb
1480
+ - test/functional/cms/portlets_controller_test.rb
1391
1481
  - test/functional/cms/section_nodes_controller_test.rb
1392
- - test/functional/cms/toolbar_controller_test.rb
1482
+ - test/functional/cms/sections_controller_test.rb
1393
1483
  - test/functional/cms/sessions_controller_test.rb
1484
+ - test/functional/cms/toolbar_controller_test.rb
1394
1485
  - test/functional/cms/users_controller_test.rb
1395
- - test/functional/cms/categories_controller_test.rb
1396
- - test/functional/cms/file_blocks_controller_test.rb
1397
- - test/functional/cms/content_controller_test.rb
1398
- - test/functional/cms/connectors_controller_test.rb
1399
- - test/functional/cms/dynamic_views_controller_test.rb
1400
- - test/functional/cms/sections_controller_test.rb
1401
- - test/functional/cms/groups_controller_test.rb
1402
- - test/unit/behaviors/searching_test.rb
1486
+ - test/functional/tests/pretend_controller_test.rb
1487
+ - test/integration/cms/ckeditor_test.rb
1488
+ - test/integration/cms/password_management_test.rb
1489
+ - test/integration/login_test.rb
1490
+ - test/test_helper.rb
1491
+ - test/test_logging.rb
1403
1492
  - test/unit/behaviors/attaching_test.rb
1404
1493
  - test/unit/behaviors/dynamic_attributes_test.rb
1405
- - test/unit/behaviors/taggable_test.rb
1406
1494
  - test/unit/behaviors/publishable_test.rb
1495
+ - test/unit/behaviors/searching_test.rb
1496
+ - test/unit/behaviors/taggable_test.rb
1497
+ - test/unit/extensions/active_record/base_test.rb
1407
1498
  - test/unit/extensions/hash_test.rb
1408
1499
  - test/unit/extensions/integer_test.rb
1409
- - test/unit/extensions/active_record/base_test.rb
1410
- - test/unit/models/page_test.rb
1411
- - test/unit/models/email_page_portlet_test.rb
1500
+ - test/unit/helpers/application_helper_test.rb
1501
+ - test/unit/helpers/form_builder_test.rb
1502
+ - test/unit/helpers/menu_helper_test.rb
1503
+ - test/unit/helpers/page_helper_test.rb
1504
+ - test/unit/helpers/path_helper_test.rb
1505
+ - test/unit/lib/acts_as_content_page_test.rb
1506
+ - test/unit/lib/cms/authentication/controller_test.rb
1507
+ - test/unit/lib/cms_domain_support_test.rb
1508
+ - test/unit/lib/command_line_test.rb
1509
+ - test/unit/lib/content_block_test.rb
1510
+ - test/unit/lib/content_rendering_support_test.rb
1511
+ - test/unit/lib/generators_test.rb
1512
+ - test/unit/lib/routes_test.rb
1412
1513
  - test/unit/models/attachment_test.rb
1514
+ - test/unit/models/category_test.rb
1515
+ - test/unit/models/category_type_test.rb
1413
1516
  - test/unit/models/connector_test.rb
1414
- - test/unit/models/html_block_test.rb
1415
- - test/unit/models/portlet_test.rb
1416
- - test/unit/models/section_node_test.rb
1417
1517
  - test/unit/models/content_type_test.rb
1518
+ - test/unit/models/email_page_portlet_test.rb
1519
+ - test/unit/models/file_block_test.rb
1418
1520
  - test/unit/models/group_test.rb
1419
- - test/unit/models/page_template_test.rb
1420
- - test/unit/models/site_test.rb
1421
- - test/unit/models/permission_test.rb
1521
+ - test/unit/models/html_block_test.rb
1422
1522
  - test/unit/models/link_test.rb
1423
- - test/unit/models/task_test.rb
1424
1523
  - test/unit/models/page_partial_test.rb
1425
- - test/unit/models/user_test.rb
1426
- - test/unit/models/file_block_test.rb
1427
- - test/unit/models/category_type_test.rb
1428
1524
  - test/unit/models/page_route_test.rb
1525
+ - test/unit/models/page_template_test.rb
1526
+ - test/unit/models/page_test.rb
1527
+ - test/unit/models/permission_test.rb
1528
+ - test/unit/models/portlet_test.rb
1529
+ - test/unit/models/section_node_test.rb
1429
1530
  - test/unit/models/sections_test.rb
1430
- - test/unit/models/category_test.rb
1531
+ - test/unit/models/site_test.rb
1532
+ - test/unit/models/task_test.rb
1533
+ - test/unit/models/user_test.rb
1431
1534
  - test/unit/schema_statements_test.rb
1432
- - test/unit/lib/acts_as_content_page_test.rb
1433
- - test/unit/lib/generators_test.rb
1434
- - test/unit/lib/routes_test.rb
1435
- - test/unit/lib/cms_domain_support_test.rb
1436
- - test/unit/lib/cms/authentication/controller_test.rb
1437
- - test/unit/lib/content_rendering_support_test.rb
1438
- - test/unit/lib/command_line_test.rb
1439
- - test/unit/lib/content_block_test.rb
1440
- - test/unit/helpers/menu_helper_test.rb
1441
- - test/unit/helpers/application_helper_test.rb
1442
- - test/unit/helpers/page_helper_test.rb
1443
- - test/unit/helpers/form_builder_test.rb
1444
- - test/unit/helpers/path_helper_test.rb
1445
- - test/custom_assertions.rb
1446
- - test/test_logging.rb
1447
- - test/factories.rb
1448
- - test/test_helper.rb