Permalink
Browse files

[#448] Make BrowserCMS a Mountable Engine

Reworked the entire project so it works as an isolated mountable engine. Rather than using paths like cms_dashboard_path, within the engine users can call _dashboard_ and from outside they can call cms.dashboard_path.

Includes the following updates:

* Regenerated project files to use a test/dummy application, like a typical engine would.
* Changed most of the paths so they aren't namespaced via convention (i.e. no more cms_dashboard_path)
* Completely removed all fixtures in favor of FactoryGirl
* Updated unit/functional tests to use new path patterns as well as factories.
* Started the process of replacing functional and integration with Cucumber features (both for improved documentation and fixing brittle tests)
* Improve cucumber coverage of more areas of the admin site.
* Moving config (like initializers) and other testing code (like sample controllers) may help solve [#416] which should allow bcms to be specified in a Gemfile using :git=> syntax
* Removed the namespacing of attributes on forms (i.e params[:html_block] rather than params[:cms_html_block])
* Added new method for adding the bcms routes to a project (mount_browsercms rather than routes_for_browser_cms). Old method is deprecated, and new projects will be generated with the new syntax.
  • Loading branch information...
peakpg committed Sep 27, 2011
1 parent 83a237b commit 6098699fed2e3dbd65815ac3a5ce0dd6acc103d2
Showing with 2,323 additions and 8,362 deletions.
  1. +2 −0 .gitignore
  2. +2 −2 Gemfile
  3. +12 −9 Gemfile.lock
  4. +66 −7 Rakefile
  5. 0 test/dummy/log/production.log → app/assets/images/browsercms/.gitkeep
  6. +9 −0 app/assets/javascripts/browsercms/application.js
  7. +7 −0 app/assets/stylesheets/browsercms/application.css
  8. +4 −0 app/controllers/browsercms/application_controller.rb
  9. +4 −4 app/controllers/cms/content_block_controller.rb
  10. +4 −4 app/controllers/cms/dynamic_views_controller.rb
  11. +4 −4 app/controllers/cms/home_controller.rb
  12. +2 −2 app/controllers/cms/links_controller.rb
  13. +5 −5 app/controllers/cms/page_routes_controller.rb
  14. +7 −7 app/controllers/cms/pages_controller.rb
  15. +3 −3 app/controllers/cms/portlets_controller.rb
  16. +2 −2 app/controllers/cms/resource_controller.rb
  17. +1 −1 app/controllers/cms/routes_controller.rb
  18. +7 −7 app/controllers/cms/sections_controller.rb
  19. +1 −1 app/controllers/cms/sessions_controller.rb
  20. +2 −2 app/controllers/cms/tasks_controller.rb
  21. +3 −3 app/controllers/cms/users_controller.rb
  22. +4 −0 app/helpers/browsercms/application_helper.rb
  23. +1 −8 app/helpers/cms/application_helper.rb
  24. +8 −1 app/helpers/cms/page_helper.rb
  25. +15 −5 app/helpers/cms/path_helper.rb
  26. +1 −1 app/helpers/cms/template_support.rb
  27. +3 −1 app/models/cms/content_type.rb
  28. +7 −2 app/models/cms/dynamic_view.rb
  29. +7 −0 app/models/cms/group.rb
  30. +4 −4 app/models/cms/page.rb
  31. +5 −0 app/models/cms/page_partial.rb
  32. +11 −0 app/models/cms/page_route.rb
  33. +4 −0 app/models/cms/page_template.rb
  34. +1 −1 app/views/cms/cache/show.html.erb
  35. +1 −1 app/views/cms/categories/_form.html.erb
  36. +2 −2 app/views/cms/connectors/new.html.erb
  37. +1 −1 app/views/cms/dashboard/_page_drafts.html.erb
  38. +1 −1 app/views/cms/dashboard/_tasks.html.erb
  39. +1 −1 app/views/cms/dynamic_views/index.html.erb
  40. +1 −1 app/views/cms/dynamic_views/new.html.erb
  41. +2 −2 app/views/cms/file_blocks/_form.html.erb
  42. +1 −1 app/views/cms/groups/_form.html.erb
  43. +4 −4 app/views/cms/groups/_permissions.html.erb
  44. +2 −2 app/views/cms/groups/_sections.html.erb
  45. +3 −3 app/views/cms/groups/index.html.erb
  46. +1 −1 app/views/cms/links/edit.html.erb
  47. +1 −1 app/views/cms/links/new.html.erb
  48. +1 −1 app/views/cms/page_routes/edit.html.erb
  49. +2 −2 app/views/cms/page_routes/index.html.erb
  50. +1 −1 app/views/cms/page_routes/new.html.erb
  51. +4 −4 app/views/cms/page_routes/show.html.erb
  52. +3 −3 app/views/cms/pages/_edit_connector.html.erb
  53. +2 −2 app/views/cms/pages/_edit_container.html.erb
  54. +1 −1 app/views/cms/pages/edit.html.erb
  55. +5 −5 app/views/cms/pages/new.html.erb
  56. +1 −1 app/views/cms/redirects/index.html.erb
  57. +1 −1 app/views/cms/redirects/new.html.erb
  58. +1 −1 app/views/cms/routes/index.html.erb
  59. +4 −4 app/views/cms/sections/_form.html.erb
  60. +1 −1 app/views/cms/sections/edit.html.erb
  61. +3 −3 app/views/cms/sections/new.html.erb
  62. +1 −1 app/views/cms/sessions/new.html.erb
  63. +8 −8 app/views/cms/shared/_admin_sidebar.html.erb
  64. +1 −1 app/views/cms/users/_toolbar.html.erb
  65. +2 −2 app/views/cms/users/change_password.html.erb
  66. +1 −1 app/views/cms/users/edit.html.erb
  67. +2 −2 app/views/cms/users/index.html.erb
  68. +1 −1 app/views/cms/users/new.html.erb
  69. +1 −1 app/views/cms/users/show.html.erb
  70. +6 −6 app/views/layouts/_cms_toolbar.html.erb
  71. +6 −6 app/views/layouts/_page_toolbar.html.erb
  72. +14 −0 app/views/layouts/browsercms/application.html.erb
  73. +2 −2 app/views/portlets/login/render.html.erb
  74. +1 −1 app/views/portlets/portlets/_form.html.erb
  75. +1 −1 bin/bcms
  76. +1 −1 bin/bcms-upgrade
  77. +0 −4 config.ru
  78. +0 −44 config/application.rb
  79. +0 −13 config/boot.rb
  80. +0 −6 config/environment.rb
  81. +0 −34 config/environments/development.rb
  82. +0 −49 config/environments/production.rb
  83. +0 −44 config/environments/test.rb
  84. +0 −4 config/initializers/cms.rb
  85. +0 −11 config/initializers/inflections.rb
  86. +0 −9 config/initializers/secret_token.rb
  87. +0 −10 config/initializers/session_store.rb
  88. +87 −36 config/routes.rb
  89. +36 −0 features/acts_as_content_page.feature
  90. +13 −0 features/caching.feature
  91. +3 −2 features/ckeditor.feature
  92. +6 −6 features/{serving_pages.feature → content_files.feature}
  93. +21 −0 features/content_pages.feature
  94. +15 −0 features/create_pages.feature
  95. +33 −0 features/manage_groups.feature
  96. +10 −0 features/manage_html_blocks.feature
  97. +72 −0 features/manage_page_routes.feature
  98. +20 −0 features/manage_redirects.feature
  99. +12 −0 features/manage_sections.feature
  100. +25 −0 features/page_templates.feature
  101. +44 −15 features/portlets.feature
  102. +14 −0 features/sitemap.feature
  103. +3 −0 features/step_definitions/acts_as_content_page_steps.rb.rb
  104. +9 −0 features/step_definitions/ckeditor_steps.rb
  105. +73 −3 features/step_definitions/content_pages_steps.rb
  106. +6 −0 features/step_definitions/data_steps.rb
  107. +1 −0 features/step_definitions/html_blocks_steps.rb
  108. +18 −0 features/step_definitions/manage_sections_steps.rb
  109. +65 −0 features/step_definitions/page_route_steps.rb
  110. +5 −0 features/step_definitions/page_template_steps.rb
  111. +13 −0 features/step_definitions/permissions_steps.rb
  112. +55 −2 features/step_definitions/portlets_steps.rb
  113. +12 −0 features/step_definitions/redirect_steps.rb
  114. +18 −0 features/step_definitions/sitemap_steps.rb
  115. +2 −2 features/support/debugging.rb
  116. +13 −0 features/support/env.rb
  117. +0 −2 features/support/paths.rb
  118. +1 −1 lib/browsercms.rb
  119. +1 −1 lib/cms/authentication/controller.rb
  120. +2 −0 lib/cms/authoring.rb
  121. +2 −1 lib/cms/engine.rb
  122. +60 −0 lib/cms/route_extensions.rb
  123. +0 −152 lib/cms/routes.rb
  124. +1 −0 lib/tasks/cms.rake
  125. +0 −9 lib/tasks/namespaced.rake
  126. +0 −2 rails/init.rb
  127. +3 −3 script/rails
  128. +0 −2 test/dummy/README.txt
  129. +1 −2 test/dummy/Rakefile
  130. +9 −0 test/dummy/app/assets/javascripts/application.js
  131. +7 −0 test/dummy/app/assets/stylesheets/application.css
  132. +3 −0 test/dummy/app/controllers/cms/sample_blocks_controller.rb
  133. 0 test/dummy/{log/server.log → app/mailers/.gitkeep}
  134. 0 test/dummy/{log/test.log → app/models/.gitkeep}
  135. +22 −0 test/dummy/app/models/cms/sample_block.rb
  136. +3 −3 test/dummy/app/views/layouts/application.html.erb
  137. +0 −17 test/dummy/app/views/layouts/templates/default.html.erb
  138. +8 −8 test/dummy/config/application.rb
  139. +13 −8 test/dummy/config/database.yml
  140. +9 −3 test/dummy/config/environments/development.rb
  141. +23 −12 test/dummy/config/environments/production.rb
  142. +12 −1 test/dummy/config/environments/test.rb
  143. +7 −0 test/dummy/config/initializers/backtrace_silencers.rb
  144. +4 −0 test/dummy/config/initializers/browsercms.rb
  145. +10 −0 test/dummy/config/initializers/inflections.rb
  146. +5 −0 test/dummy/config/initializers/mime_types.rb
  147. +1 −1 test/dummy/config/initializers/secret_token.rb
  148. +1 −1 test/dummy/config/initializers/session_store.rb
  149. +14 −0 test/dummy/config/initializers/wrap_parameters.rb
  150. +1 −1 test/dummy/config/locales/en.yml
  151. +15 −2 test/dummy/config/routes.rb
  152. +0 −97 test/dummy/db/demo/data.rb
  153. +0 −6 test/dummy/db/demo/page_partials/_footer.html.erb
  154. +0 −24 test/dummy/db/demo/page_partials/_header.html.erb
  155. +0 −49 test/dummy/db/demo/page_templates/home_page.html.erb
  156. +0 −37 test/dummy/db/demo/page_templates/sub_page.html.erb
  157. +0 −274 test/dummy/db/migrate/20080815014337_browsercms_3_0_0.rb
  158. +0 −9 test/dummy/db/migrate/20091109175123_browsercms_3_0_5.rb
  159. +40 −39 test/dummy/db/schema.rb
  160. +1 −58 test/dummy/db/seeds.rb
  161. +0 −1 test/dummy/db/test.sqlite3
  162. 0 test/dummy/lib/assets/.gitkeep
  163. +0 −11 test/dummy/lib/demo_site.rake
  164. +0 −5,171 test/dummy/log/development.log
  165. +26 −0 test/dummy/public/404.html
  166. +26 −0 test/dummy/public/422.html
  167. +26 −0 test/dummy/public/500.html
  168. 0 test/dummy/public/favicon.ico
  169. +0 −1 test/dummy/public/site/customconfig.js
  170. +28 −12 test/factories.rb
  171. +0 −97 test/fixtures/cms/cms_connectors.yml
  172. +0 −13 test/fixtures/cms/cms_content_type_groups.yml
  173. +0 −50 test/fixtures/cms/cms_content_types.yml
  174. +0 −16 test/fixtures/cms/cms_group_permissions.yml
  175. +0 −31 test/fixtures/cms/cms_group_sections.yml
  176. +0 −11 test/fixtures/cms/cms_group_type_permissions.yml
  177. +0 −25 test/fixtures/cms/cms_group_types.yml
  178. +0 −25 test/fixtures/cms/cms_groups.yml
  179. +0 −67 test/fixtures/cms/cms_html_block_versions.yml
  180. +0 −63 test/fixtures/cms/cms_html_blocks.yml
  181. +0 −265 test/fixtures/cms/cms_page_versions.yml
  182. +0 −85 test/fixtures/cms/cms_pages.yml
  183. +0 −26 test/fixtures/cms/cms_permissions.yml
  184. +0 −46 test/fixtures/cms/cms_section_nodes.yml
  185. +0 −19 test/fixtures/cms/cms_sections.yml
  186. +0 −9 test/fixtures/cms/cms_sites.yml
  187. +0 −11 test/fixtures/cms/cms_user_group_memberships.yml
  188. +0 −15 test/fixtures/cms/cms_users.yml
  189. +1 −0 test/functional/cms/categories_controller_test.rb
  190. +2 −0 test/functional/cms/connectors_controller_test.rb
  191. +9 −4 test/functional/cms/content_block_controller_test.rb
  192. +17 −93 test/functional/cms/content_controller_test.rb
  193. +0 −58 test/functional/cms/dynamic_views_controller_test.rb
  194. +1 −0 test/functional/cms/file_blocks_controller_test.rb
  195. +0 −52 test/functional/cms/groups_controller_test.rb
  196. +7 −6 test/functional/cms/html_blocks_controller_test.rb
  197. +4 −2 test/functional/cms/image_blocks_controller_test.rb
  198. +3 −2 test/functional/cms/links_controller_test.rb
  199. +199 −195 test/functional/cms/pages_controller_test.rb
  200. +0 −37 test/functional/cms/section_nodes_controller_test.rb
  201. +13 −8 test/functional/cms/sections_controller_test.rb
  202. +67 −65 test/functional/cms/sessions_controller_test.rb
  203. +8 −3 test/functional/cms/tasks_controller_test.rb
  204. +14 −4 test/functional/cms/toolbar_controller_test.rb
  205. +224 −215 test/functional/cms/users_controller_test.rb
  206. +0 −22 test/functional/tests/pretend_controller_test.rb
  207. +0 −20 test/integration/cms/ckeditor_test.rb
  208. +4 −1 test/integration/cms/password_management_test.rb
  209. +0 −14 test/integration/login_test.rb
  210. +34 −0 test/support/engine_controller_hacks.rb
  211. +45 −0 test/support/factory_helpers.rb
  212. +70 −0 test/support/rails_3_1_routes_hack.rb
  213. +27 −95 test/test_helper.rb
  214. +9 −17 test/unit/behaviors/attaching_test.rb
  215. +11 −0 test/unit/factories_test.rb
  216. +4 −4 test/unit/helpers/menu_helper_test.rb
  217. +23 −22 test/unit/helpers/path_helper_test.rb
  218. +1 −1 test/unit/lib/routes_test.rb
  219. +2 −2 test/{ → unit}/mock_file_test.rb
  220. +14 −0 test/unit/models/content_type_test.rb
  221. +1 −4 test/unit/models/dynamic_views_test.rb
  222. +7 −1 test/unit/models/email_page_portlet_test.rb
  223. +17 −1 test/unit/models/group_test.rb
  224. +13 −5 test/unit/models/page_partial_test.rb
  225. +17 −2 test/unit/models/page_route_test.rb
  226. +16 −6 test/unit/models/page_template_test.rb
  227. +2 −2 test/unit/models/page_test.rb
  228. +2 −1 test/unit/models/sections_test.rb
  229. +3 −3 test/unit/models/site_test.rb
  230. +15 −17 test/unit/models/user_test.rb
  231. +11 −18 upgrading_to_3_1.md
View
@@ -17,7 +17,9 @@ public/cache
patches
rerun.txt
test/dummy/log/*
+test/dummy/tmp/*
doc/api
.yardoc/*
.rvmrc
+
View
@@ -4,7 +4,7 @@ source 'http://rubygems.org'
gemspec
gem 'jquery-rails'
-
+gem 'rack', '1.3.3' # At least until 1.3.5 is out. Avoids warnings about already defined constants.
gem "mysql2"
@@ -24,5 +24,5 @@ group :test do
gem 'cucumber-rails'
gem 'cucumber'
gem 'launchy'
-
+ gem 'ruby-prof'
end
View
@@ -52,15 +52,15 @@ GEM
xpath (~> 0.1.4)
childprocess (0.2.2)
ffi (~> 1.0.6)
- cucumber (1.0.6)
+ cucumber (1.1.0)
builder (>= 2.1.2)
diff-lcs (>= 1.1.2)
- gherkin (~> 2.4.18)
+ gherkin (~> 2.5.0)
json (>= 1.4.6)
term-ansicolor (>= 1.0.6)
- cucumber-rails (1.0.5)
+ cucumber-rails (1.1.1)
capybara (>= 1.1.1)
- cucumber (~> 1.0.6)
+ cucumber (>= 1.1.0)
nokogiri (>= 1.5.0)
database_cleaner (0.6.7)
diff-lcs (1.1.3)
@@ -70,15 +70,15 @@ GEM
factory_girl (~> 1.3)
railties (>= 3.0.0)
ffi (1.0.9)
- gherkin (2.4.18)
+ gherkin (2.5.1)
json (>= 1.4.6)
hike (1.2.1)
i18n (0.6.0)
jquery-rails (1.0.14)
railties (~> 3.0)
thor (~> 0.14)
- json (1.6.0)
- json_pure (1.6.0)
+ json (1.6.1)
+ json_pure (1.6.1)
launchy (2.0.5)
addressable (~> 2.2.6)
mail (2.3.0)
@@ -92,7 +92,7 @@ GEM
mysql2 (0.3.7)
nokogiri (1.5.0)
polyglot (0.3.2)
- rack (1.3.2)
+ rack (1.3.3)
rack-cache (1.0.3)
rack (>= 0.4)
rack-mount (0.8.3)
@@ -118,8 +118,9 @@ GEM
thor (~> 0.14.6)
rake (0.9.2)
rdoc (3.9.4)
+ ruby-prof (0.10.8)
rubyzip (0.9.4)
- selenium-webdriver (2.6.0)
+ selenium-webdriver (2.8.0)
childprocess (>= 0.2.1)
ffi (>= 1.0.7)
json_pure
@@ -158,6 +159,8 @@ DEPENDENCIES
launchy
mocha (= 0.9.8)
mysql2
+ rack (= 1.3.3)
+ ruby-prof
sqlite3-ruby
test-unit (= 2.1.1)
yard
View
@@ -1,13 +1,72 @@
-# Add your own tasks in files placed in lib/tasks ending in .rake,
-# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+#!/usr/bin/env rake
+begin
+ require 'bundler/setup'
+rescue LoadError
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
+end
+begin
+ require 'rdoc/task'
+rescue LoadError
+ require 'rdoc/rdoc'
+ require 'rake/rdoctask'
+ RDoc::Task = Rake::RDocTask
+end
-require File.expand_path('../config/application', __FILE__)
+APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
+load 'rails/tasks/engine.rake'
+
+
+Bundler::GemHelper.install_tasks
-require 'rake'
require 'rake/testtask'
-Browsercms::Application.load_tasks
+Rake::TestTask.new('test:units') do |t|
+ t.libs << 'lib'
+ t.libs << 'test'
+ t.pattern = 'test/unit/**/*_test.rb'
+ t.verbose = false
+end
-require 'bundler'
-Bundler::GemHelper.install_tasks
+Rake::TestTask.new('test:functionals') do |t|
+ t.libs << 'lib'
+ t.libs << 'test'
+ t.pattern = 'test/functional/**/*_test.rb'
+ t.verbose = false
+
+end
+
+Rake::TestTask.new('test:integration') do |t|
+ t.libs << 'lib'
+ t.libs << 'test'
+ t.pattern = 'test/integration/**/*_test.rb'
+ t.verbose = false
+end
+
+require 'cucumber'
+require 'cucumber/rake/task'
+
+Cucumber::Rake::Task.new(:features) do |t|
+ t.cucumber_opts = "features --format progress"
+end
+
+desc 'Runs all the tests'
+task :test do
+ tests_to_run = ENV['TEST'] ? ["test:single"] : %w(test:units test:functionals test:integration features)
+ errors = tests_to_run.collect do |task|
+ begin
+ Rake::Task[task].invoke
+ nil
+ rescue => e
+ { :task => task, :exception => e }
+ end
+ end.compact
+
+ if errors.any?
+ puts errors.map { |e| "Errors running #{e[:task]}! #{e[:exception].inspect}" }.join("\n")
+ abort
+ end
+end
+
+#task :test => ['test:units', 'test:functionals', 'test:integration', 'features']
+task :default => :test
@@ -0,0 +1,9 @@
+// This is a manifest file that'll be compiled into including all the files listed below.
+// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
+// be included in the compiled file accessible from http://example.com/assets/application.js
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+// the compiled file.
+//
+//= require jquery
+//= require jquery_ujs
+//= require_tree .
@@ -0,0 +1,7 @@
+/*
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
+ * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
+ * the top of the compiled file, but it's generally better to create a new file per style scope.
+ *= require_self
+ *= require_tree .
+*/
@@ -0,0 +1,4 @@
+module Browsercms
+ class ApplicationController < ActionController::Base
+ end
+end
@@ -114,8 +114,8 @@ def model_class
content_type.model_class
end
- def model_name
- ActiveModel::Naming.singular(model_class)
+ def model_form_name
+ content_type.model_class_form_name
end
# methods for loading one or a collection of blocks
@@ -168,7 +168,7 @@ def block_form
# new related methods
def build_block
- @block = model_class.new(params[model_name])
+ @block = model_class.new(params[model_form_name])
check_permissions
end
@@ -207,7 +207,7 @@ def after_create_on_error
# update related methods
def update_block
load_block
- @block.update_attributes(params[model_name])
+ @block.update_attributes(params[model_form_name])
end
def after_update_on_success
@@ -18,10 +18,10 @@ def new
end
def create
- @view = dynamic_view_type.new(params[ActionController::RecordIdentifier.singular_class_name(dynamic_view_type)])
+ @view = dynamic_view_type.new(params[dynamic_view_type.resource_collection_name])
if @view.save
flash[:notice] = "#{dynamic_view_type} '#{@view.name}' was created"
- redirect_to cms_index_path_for(dynamic_view_type.name.underscore.pluralize)
+ redirect_to cms_index_path_for(dynamic_view_type)
else
render :action => "new"
end
@@ -49,8 +49,8 @@ def destroy
protected
def dynamic_view_type
@dynamic_view_type ||= begin
- uri = request.request_uri.sub(/\?.*/, '')
- type_name = uri.split('/')[2].classify
+ url = request.path.sub(/\?.*/, '')
+ type_name = url.split('/')[2].classify
begin
type = "Cms::#{type_name}".constantize
rescue NameError
@@ -1,7 +1,7 @@
module Cms
-class HomeController < Cms::BaseController
- def index
- redirect_to '/'
+ class HomeController < Cms::BaseController
+ def index
+ redirect_to '/'
+ end
end
-end
end
@@ -34,11 +34,11 @@ def destroy
respond_to do |format|
if @link.destroy
message = "Link '#{@link.name}' was deleted."
- format.html { flash[:notice] = message; redirect_to(cms_sitemap_url) }
+ format.html { flash[:notice] = message; redirect_to(sitemap_url) }
format.json { render :json => {:success => true, :message => message } }
else
message = "Link '#{@link.name}' could not be deleted"
- format.html { flash[:error] = message; redirect_to(cms_sitemap_url) }
+ format.html { flash[:error] = message; redirect_to(sitemap_url) }
format.json { render :json => {:success => false, :message => message } }
end
end
@@ -13,19 +13,19 @@ def new
end
def create
- @page_route = PageRoute.new(params[:cms_page_route])
+ @page_route = PageRoute.new(params[:page_route])
if @page_route.save
flash[:notice] = "Page Route Created"
- redirect_to cms_page_route_url(@page_route)
+ redirect_to page_route_url(@page_route)
else
render :action => "new"
end
end
def update
- if @page_route.update_attributes(params[:cms_page_route])
+ if @page_route.update_attributes(params[:page_route])
flash[:notice] = "Page Route Updated"
- redirect_to cms_page_route_url(@page_route)
+ redirect_to page_route_url(@page_route)
else
render :action => "new"
end
@@ -35,7 +35,7 @@ def update
def destroy
@page_route.destroy
flash[:notice] = "Page Route Deleted"
- redirect_to cms_page_routes_url
+ redirect_to page_routes_url
end
protected
@@ -23,7 +23,7 @@ def show
end
def create
- @page = Page.new(params[:cms_page])
+ @page = Page.new(params[:page])
@page.section = @section
if @page.save
flash[:notice] = "Page was '#{@page.name}' created."
@@ -34,7 +34,7 @@ def create
end
def update
- if @page.update_attributes(params[:cms_page])
+ if @page.update_attributes(params[:page])
flash[:notice] = "Page was '#{@page.name}' updated."
redirect_to @page
else
@@ -49,11 +49,11 @@ def destroy
respond_to do |format|
if @page.destroy
message = "Page '#{@page.name}' was deleted."
- format.html { flash[:notice] = message; redirect_to(cms_sitemap_url) }
+ format.html { flash[:notice] = message; redirect_to(sitemap_url) }
format.json { render :json => {:success => true, :message => message } }
else
message = "Page '#{@page.name}' could not be deleted"
- format.html { flash[:error] = message; redirect_to(cms_sitemap_url) }
+ format.html { flash[:error] = message; redirect_to(sitemap_url) }
format.json { render :json => {:success => false, :message => message } }
end
end
@@ -67,7 +67,7 @@ def destroy
raise Cms::Errors::AccessDenied unless @pages.all? { |page| current_user.able_to_edit?(page) }
@pages.each { |page| page.send(status) }
flash[:notice] = "#{params[:page_ids].size} pages #{verb}"
- redirect_to cms_dashboard_url
+ redirect_to dashboard_url
else
load_page
if @page.send(status)
@@ -101,8 +101,8 @@ def revert_to
private
def strip_publish_params
unless current_user.able_to?(:publish_content)
- params[:cms_page].delete :hidden
- params[:cms_page].delete :archived
+ params[:page].delete :hidden
+ params[:page].delete :archived
end
end
@@ -28,15 +28,15 @@ def block_form
end
def new_block_path
- new_cms_portlet_path
+ new_portlet_path
end
def block_path(action=nil)
- send("#{action ? "#{action}_" : ""}cms_portlet_path", @block)
+ send("#{action ? "#{action}_" : ""}portlet_path", @block)
end
def blocks_path
- cms_portlets_path
+ portlets_path
end
end
end
Oops, something went wrong.

0 comments on commit 6098699

Please sign in to comment.