Permalink
Browse files

Misc fixes in support of modules

* Fix issues with attr_accessible for seed data
* Add helper for blocks that render themselves.
* Fix bug with EmailPage portlet.
* Remove unit tests for FCKeditor file browser.
  • Loading branch information...
1 parent d0e98bc commit 5e3b182660cb24caed7dae213109f575cd51afd9 @peakpg peakpg committed May 30, 2012
@@ -7,6 +7,8 @@ class Category < ActiveRecord::Base
include DefaultAccessible
+ attr_accessible :category_type
+
validates_presence_of :category_type_id, :name
validates_uniqueness_of :name, :scope => :category_type_id
@@ -1,10 +1,11 @@
module Cms
class Connector < ActiveRecord::Base
- include DefaultAccessible
belongs_to :page, :class_name => 'Cms::Page'
belongs_to :connectable, :polymorphic => true
- attr_accessible :connectable
+
+ include DefaultAccessible
+ attr_accessible :connectable, :page_version, :connectable_version, :container # Need to be explicit due to seed data loading
acts_as_list :scope => "#{Connector.table_name}.page_id = \#{page_id} and #{Cms::Connector.table_name}.page_version = \#{page_version} and #{Cms::Connector.table_name}.container = '\#{container}'"
alias :move_up :move_higher
@@ -1,7 +1,7 @@
module Cms
class ContentType < ActiveRecord::Base
- attr_accessible :name, :group_name
+ attr_accessible :name, :group_name, :content_type_group
attr_accessor :group_name
belongs_to :content_type_group, :class_name => 'Cms::ContentTypeGroup'
@@ -17,6 +17,7 @@ def actual_path
has_many :tasks
include Cms::DefaultAccessible
+ attr_accessible :name, :path, :template_file_name, :hidden, :cacheable # Needs to be explicit so seed data will work.
scope :named, lambda { |name| {:conditions => ["#{table_name}.name = ?", name]} }
scope :with_path, lambda { |path| {:conditions => ["#{table_name}.path = ?", path]} }
@@ -43,6 +43,10 @@ def content_for(name, content=nil, &block)
@controller.instance_variable_get("@template").content_for(name, content, &block)
end
+ # Returns the routes for the Cms::Engine for view that need to access them.
+ def cms
+ Cms::Engine.routes.url_helpers
+ end
end
@@ -1,5 +1,5 @@
<div class="email-page-portlet">
- <%= form_for @email_message, :url => handler_path(@portlet, "deliver") do |f| %>
+ <%= form_for @email_message, :url => cms.portlet_handler_path(@portlet, "deliver"), :method=>'post' do |f| %>
<%= hidden_field_tag :email_page_portlet_url, @email_page_portlet_url %>
<%= f.cms_error_messages %>
<p>
View
@@ -65,7 +65,7 @@
match '/content_library', :to=>'html_blocks#index', :as=>'content_library'
content_blocks :html_blocks
content_blocks :portlets
- post '/portlet/:id/:handler', :to=>"portlet#execute_handler", :as=>"handler"
+ post '/portlet/:id/:handler', :to=>"portlet#execute_handler", :as=>"portlet_handler"
content_blocks :file_blocks
content_blocks :image_blocks
@@ -39,59 +39,6 @@ def test_update
end
-class SectionFileBrowserControllerTest < ActionController::TestCase
- tests Cms::SectionsController
- include Cms::ControllerTestHelper
-
- def setup
- given_a_site_exists
- login_as_cms_admin
- given_there_is_a_sitemap
- end
-
- def test_root_section
- @foo = create(:section, :parent => root_section, :name => "Foo", :path => '/foo')
- @bar = create(:section, :parent => root_section, :name => "Bar", :path => '/bar')
- @home = create(:page, :section => root_section, :name => "Home", :path => '/home')
-
- get :file_browser, :format => "xml", "CurrentFolder" => "/", "Command" => "GetFilesAndFolders", "Type" => "Page"
-
- assert_response :success
- assert_equal "application/xml", @response.content_type
- assert_select "Connector[command=?][resourceType=?]", "GetFilesAndFolders", "Page" do
- assert_select "CurrentFolder[path=?][url=?]", "/", "/"
- assert_select "Folders" do
- assert_select "Folder[name=?]", "Foo"
- assert_select "Folder[name=?]", "Bar"
- end
- assert_select "Files" do
- assert_select "File[name=?][url=?][size=?]", "Home", "/home", "?"
- end
- end
- end
-
- def test_sub_section
- @foo = create(:section, :parent => root_section, :name => "Foo", :path => '/foo')
- @bar = create(:section, :parent => @foo, :name => "Bar", :path => '/foo/bar')
- @foo_page = create(:page, :section => @foo, :name => "Foo Page", :path => '/foo/page')
- @home = create(:page, :section => root_section, :name => "Home", :path => '/home')
- get :file_browser, :format => "xml", "CurrentFolder" => "/Foo/", "Command" => "GetFilesAndFolders", "Type" => "Page"
-
- assert_response :success
- assert_equal "application/xml", @response.content_type
- assert_select "Connector[command=?][resourceType=?]", "GetFilesAndFolders", "Page" do
- assert_select "CurrentFolder[path=?][url=?]", "/Foo/", "/Foo/"
- assert_select "Folders" do
- assert_select "Folder[name=?]", "Bar"
- end
- assert_select "Files" do
- assert_select "File[name=?][url=?][size=?]", "Foo Page", "/foo/page", "?"
- end
- end
- end
-
-end
-
class SectionsControllerPermissionsTest < ActionController::TestCase
tests Cms::SectionsController
include Cms::ControllerTestHelper

0 comments on commit 5e3b182

Please sign in to comment.