Skip to content
This repository
Browse code

[#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...
commit 6098699fed2e3dbd65815ac3a5ce0dd6acc103d2 1 parent 83a237b
peakpg authored

Showing 231 changed files with 2,323 additions and 8,362 deletions. Show diff stats Hide diff stats

  1. 2  .gitignore
  2. 4  Gemfile
  3. 21  Gemfile.lock
  4. 73  Rakefile
  5. 0  test/dummy/log/production.log → app/assets/images/browsercms/.gitkeep
  6. 9  app/assets/javascripts/browsercms/application.js
  7. 7  app/assets/stylesheets/browsercms/application.css
  8. 4  app/controllers/browsercms/application_controller.rb
  9. 8  app/controllers/cms/content_block_controller.rb
  10. 8  app/controllers/cms/dynamic_views_controller.rb
  11. 8  app/controllers/cms/home_controller.rb
  12. 4  app/controllers/cms/links_controller.rb
  13. 10  app/controllers/cms/page_routes_controller.rb
  14. 14  app/controllers/cms/pages_controller.rb
  15. 6  app/controllers/cms/portlets_controller.rb
  16. 4  app/controllers/cms/resource_controller.rb
  17. 2  app/controllers/cms/routes_controller.rb
  18. 14  app/controllers/cms/sections_controller.rb
  19. 2  app/controllers/cms/sessions_controller.rb
  20. 4  app/controllers/cms/tasks_controller.rb
  21. 6  app/controllers/cms/users_controller.rb
  22. 4  app/helpers/browsercms/application_helper.rb
  23. 9  app/helpers/cms/application_helper.rb
  24. 9  app/helpers/cms/page_helper.rb
  25. 20  app/helpers/cms/path_helper.rb
  26. 2  app/helpers/cms/template_support.rb
  27. 4  app/models/cms/content_type.rb
  28. 9  app/models/cms/dynamic_view.rb
  29. 7  app/models/cms/group.rb
  30. 8  app/models/cms/page.rb
  31. 5  app/models/cms/page_partial.rb
  32. 11  app/models/cms/page_route.rb
  33. 4  app/models/cms/page_template.rb
  34. 2  app/views/cms/cache/show.html.erb
  35. 2  app/views/cms/categories/_form.html.erb
  36. 4  app/views/cms/connectors/new.html.erb
  37. 2  app/views/cms/dashboard/_page_drafts.html.erb
  38. 2  app/views/cms/dashboard/_tasks.html.erb
  39. 2  app/views/cms/dynamic_views/index.html.erb
  40. 2  app/views/cms/dynamic_views/new.html.erb
  41. 4  app/views/cms/file_blocks/_form.html.erb
  42. 2  app/views/cms/groups/_form.html.erb
  43. 8  app/views/cms/groups/_permissions.html.erb
  44. 4  app/views/cms/groups/_sections.html.erb
  45. 6  app/views/cms/groups/index.html.erb
  46. 2  app/views/cms/links/edit.html.erb
  47. 2  app/views/cms/links/new.html.erb
  48. 2  app/views/cms/page_routes/edit.html.erb
  49. 4  app/views/cms/page_routes/index.html.erb
  50. 2  app/views/cms/page_routes/new.html.erb
  51. 8  app/views/cms/page_routes/show.html.erb
  52. 6  app/views/cms/pages/_edit_connector.html.erb
  53. 4  app/views/cms/pages/_edit_container.html.erb
  54. 2  app/views/cms/pages/edit.html.erb
  55. 10  app/views/cms/pages/new.html.erb
  56. 2  app/views/cms/redirects/index.html.erb
  57. 2  app/views/cms/redirects/new.html.erb
  58. 2  app/views/cms/routes/index.html.erb
  59. 8  app/views/cms/sections/_form.html.erb
  60. 2  app/views/cms/sections/edit.html.erb
  61. 6  app/views/cms/sections/new.html.erb
  62. 2  app/views/cms/sessions/new.html.erb
  63. 16  app/views/cms/shared/_admin_sidebar.html.erb
  64. 2  app/views/cms/users/_toolbar.html.erb
  65. 4  app/views/cms/users/change_password.html.erb
  66. 2  app/views/cms/users/edit.html.erb
  67. 4  app/views/cms/users/index.html.erb
  68. 2  app/views/cms/users/new.html.erb
  69. 2  app/views/cms/users/show.html.erb
  70. 12  app/views/layouts/_cms_toolbar.html.erb
  71. 12  app/views/layouts/_page_toolbar.html.erb
  72. 14  app/views/layouts/browsercms/application.html.erb
  73. 4  app/views/portlets/login/render.html.erb
  74. 2  app/views/portlets/portlets/_form.html.erb
  75. 0  assets/.gitkeep b/test/dummy/lib/assets/.gitkeep
  76. 2  bin/bcms
  77. 2  bin/bcms-upgrade
  78. 4  config.ru
  79. 44  config/application.rb
  80. 13  config/boot.rb
  81. 6  config/environment.rb
  82. 34  config/environments/development.rb
  83. 49  config/environments/production.rb
  84. 44  config/environments/test.rb
  85. 4  config/initializers/cms.rb
  86. 11  config/initializers/inflections.rb
  87. 9  config/initializers/secret_token.rb
  88. 10  config/initializers/session_store.rb
  89. 123  config/routes.rb
  90. 36  features/acts_as_content_page.feature
  91. 13  features/caching.feature
  92. 5  features/ckeditor.feature
  93. 12  features/{serving_pages.feature → content_files.feature}
  94. 21  features/content_pages.feature
  95. 15  features/create_pages.feature
  96. 33  features/manage_groups.feature
  97. 10  features/manage_html_blocks.feature
  98. 72  features/manage_page_routes.feature
  99. 20  features/manage_redirects.feature
  100. 12  features/manage_sections.feature
  101. 25  features/page_templates.feature
  102. 59  features/portlets.feature
  103. 14  features/sitemap.feature
  104. 3  features/step_definitions/acts_as_content_page_steps.rb.rb
  105. 9  features/step_definitions/ckeditor_steps.rb
  106. 76  features/step_definitions/content_pages_steps.rb
  107. 6  features/step_definitions/data_steps.rb
  108. 1  features/step_definitions/html_blocks_steps.rb
  109. 18  features/step_definitions/manage_sections_steps.rb
  110. 65  features/step_definitions/page_route_steps.rb
  111. 5  features/step_definitions/page_template_steps.rb
  112. 13  features/step_definitions/permissions_steps.rb
  113. 57  features/step_definitions/portlets_steps.rb
  114. 12  features/step_definitions/redirect_steps.rb
  115. 18  features/step_definitions/sitemap_steps.rb
  116. 4  features/support/debugging.rb
  117. 13  features/support/env.rb
  118. 2  features/support/paths.rb
  119. 2  lib/browsercms.rb
  120. 2  lib/cms/authentication/controller.rb
  121. 2  lib/cms/authoring.rb
  122. 3  lib/cms/engine.rb
  123. 60  lib/cms/route_extensions.rb
  124. 152  lib/cms/routes.rb
  125. 1  lib/tasks/cms.rake
  126. 9  lib/tasks/namespaced.rake
  127. 2  rails/init.rb
  128. 6  script/rails
  129. 2  test/dummy/README.txt
  130. 3  test/dummy/Rakefile
  131. 9  test/dummy/app/assets/javascripts/application.js
  132. 7  test/dummy/app/assets/stylesheets/application.css
  133. 3  test/dummy/app/controllers/cms/sample_blocks_controller.rb
  134. 0  test/dummy/{log/server.log → app/mailers/.gitkeep}
  135. 0  test/dummy/{log/test.log → app/models/.gitkeep}
  136. 22  test/dummy/app/models/cms/sample_block.rb
  137. 6  test/dummy/app/views/layouts/application.html.erb
  138. 17  test/dummy/app/views/layouts/templates/default.html.erb
  139. 16  test/dummy/config/application.rb
  140. 21  test/dummy/config/database.yml
  141. 12  test/dummy/config/environments/development.rb
  142. 35  test/dummy/config/environments/production.rb
  143. 13  test/dummy/config/environments/test.rb
  144. 7  test/dummy/config/initializers/backtrace_silencers.rb
  145. 4  test/dummy/config/initializers/browsercms.rb
  146. 10  test/dummy/config/initializers/inflections.rb
  147. 5  test/dummy/config/initializers/mime_types.rb
  148. 2  test/dummy/config/initializers/secret_token.rb
  149. 2  test/dummy/config/initializers/session_store.rb
  150. 14  test/dummy/config/initializers/wrap_parameters.rb
  151. 2  test/dummy/config/locales/en.yml
  152. 17  test/dummy/config/routes.rb
  153. 97  test/dummy/db/demo/data.rb
  154. 6  test/dummy/db/demo/page_partials/_footer.html.erb
  155. 24  test/dummy/db/demo/page_partials/_header.html.erb
  156. 49  test/dummy/db/demo/page_templates/home_page.html.erb
  157. 37  test/dummy/db/demo/page_templates/sub_page.html.erb
  158. 274  test/dummy/db/migrate/20080815014337_browsercms_3_0_0.rb
  159. 9  test/dummy/db/migrate/20091109175123_browsercms_3_0_5.rb
  160. 79  test/dummy/db/schema.rb
  161. 59  test/dummy/db/seeds.rb
  162. 1  test/dummy/db/test.sqlite3
  163. 11  test/dummy/lib/demo_site.rake
  164. 5,171  test/dummy/log/development.log
  165. 26  test/dummy/public/404.html
  166. 26  test/dummy/public/422.html
  167. 26  test/dummy/public/500.html
  168. 0  test/dummy/public/favicon.ico
  169. 1  test/dummy/public/site/customconfig.js
  170. 40  test/factories.rb
  171. 97  test/fixtures/cms/cms_connectors.yml
  172. 13  test/fixtures/cms/cms_content_type_groups.yml
  173. 50  test/fixtures/cms/cms_content_types.yml
  174. 16  test/fixtures/cms/cms_group_permissions.yml
  175. 31  test/fixtures/cms/cms_group_sections.yml
  176. 11  test/fixtures/cms/cms_group_type_permissions.yml
  177. 25  test/fixtures/cms/cms_group_types.yml
  178. 25  test/fixtures/cms/cms_groups.yml
  179. 67  test/fixtures/cms/cms_html_block_versions.yml
  180. 63  test/fixtures/cms/cms_html_blocks.yml
  181. 265  test/fixtures/cms/cms_page_versions.yml
  182. 85  test/fixtures/cms/cms_pages.yml
  183. 26  test/fixtures/cms/cms_permissions.yml
  184. 46  test/fixtures/cms/cms_section_nodes.yml
  185. 19  test/fixtures/cms/cms_sections.yml
  186. 9  test/fixtures/cms/cms_sites.yml
  187. 11  test/fixtures/cms/cms_user_group_memberships.yml
  188. 15  test/fixtures/cms/cms_users.yml
  189. 1  test/functional/cms/categories_controller_test.rb
  190. 2  test/functional/cms/connectors_controller_test.rb
  191. 13  test/functional/cms/content_block_controller_test.rb
  192. 110  test/functional/cms/content_controller_test.rb
  193. 58  test/functional/cms/dynamic_views_controller_test.rb
  194. 1  test/functional/cms/file_blocks_controller_test.rb
  195. 52  test/functional/cms/groups_controller_test.rb
  196. 13  test/functional/cms/html_blocks_controller_test.rb
  197. 6  test/functional/cms/image_blocks_controller_test.rb
  198. 5  test/functional/cms/links_controller_test.rb
  199. 394  test/functional/cms/pages_controller_test.rb
  200. 37  test/functional/cms/section_nodes_controller_test.rb
  201. 21  test/functional/cms/sections_controller_test.rb
  202. 132  test/functional/cms/sessions_controller_test.rb
  203. 11  test/functional/cms/tasks_controller_test.rb
  204. 18  test/functional/cms/toolbar_controller_test.rb
  205. 439  test/functional/cms/users_controller_test.rb
  206. 22  test/functional/tests/pretend_controller_test.rb
  207. 20  test/integration/cms/ckeditor_test.rb
  208. 5  test/integration/cms/password_management_test.rb
  209. 14  test/integration/login_test.rb
  210. 34  test/support/engine_controller_hacks.rb
  211. 45  test/support/factory_helpers.rb
  212. 70  test/support/rails_3_1_routes_hack.rb
  213. 122  test/test_helper.rb
  214. 26  test/unit/behaviors/attaching_test.rb
  215. 11  test/unit/factories_test.rb
  216. 8  test/unit/helpers/menu_helper_test.rb
  217. 45  test/unit/helpers/path_helper_test.rb
  218. 2  test/unit/lib/routes_test.rb
  219. 4  test/{ → unit}/mock_file_test.rb
  220. 14  test/unit/models/content_type_test.rb
  221. 5  test/unit/models/dynamic_views_test.rb
  222. 8  test/unit/models/email_page_portlet_test.rb
  223. 18  test/unit/models/group_test.rb
  224. 18  test/unit/models/page_partial_test.rb
  225. 19  test/unit/models/page_route_test.rb
  226. 22  test/unit/models/page_template_test.rb
  227. 4  test/unit/models/page_test.rb
  228. 3  test/unit/models/sections_test.rb
  229. 6  test/unit/models/site_test.rb
  230. 32  test/unit/models/user_test.rb
  231. 29  upgrading_to_3_1.md
2  .gitignore
@@ -17,7 +17,9 @@ public/cache
17 17
 patches
18 18
 rerun.txt
19 19
 test/dummy/log/*
  20
+test/dummy/tmp/*
20 21
 doc/api
21 22
 .yardoc/*
22 23
 .rvmrc
23 24
 
  25
+
4  Gemfile
@@ -4,7 +4,7 @@ source 'http://rubygems.org'
4 4
 gemspec
5 5
 
6 6
 gem 'jquery-rails'
7  
-
  7
+gem 'rack', '1.3.3' # At least until 1.3.5 is out. Avoids warnings about already defined constants.
8 8
 gem "mysql2"
9 9
 
10 10
 
@@ -24,5 +24,5 @@ group :test do
24 24
   gem 'cucumber-rails'
25 25
   gem 'cucumber'
26 26
   gem 'launchy'
27  
-
  27
+  gem 'ruby-prof'
28 28
 end
21  Gemfile.lock
@@ -52,15 +52,15 @@ GEM
52 52
       xpath (~> 0.1.4)
53 53
     childprocess (0.2.2)
54 54
       ffi (~> 1.0.6)
55  
-    cucumber (1.0.6)
  55
+    cucumber (1.1.0)
56 56
       builder (>= 2.1.2)
57 57
       diff-lcs (>= 1.1.2)
58  
-      gherkin (~> 2.4.18)
  58
+      gherkin (~> 2.5.0)
59 59
       json (>= 1.4.6)
60 60
       term-ansicolor (>= 1.0.6)
61  
-    cucumber-rails (1.0.5)
  61
+    cucumber-rails (1.1.1)
62 62
       capybara (>= 1.1.1)
63  
-      cucumber (~> 1.0.6)
  63
+      cucumber (>= 1.1.0)
64 64
       nokogiri (>= 1.5.0)
65 65
     database_cleaner (0.6.7)
66 66
     diff-lcs (1.1.3)
@@ -70,15 +70,15 @@ GEM
70 70
       factory_girl (~> 1.3)
71 71
       railties (>= 3.0.0)
72 72
     ffi (1.0.9)
73  
-    gherkin (2.4.18)
  73
+    gherkin (2.5.1)
74 74
       json (>= 1.4.6)
75 75
     hike (1.2.1)
76 76
     i18n (0.6.0)
77 77
     jquery-rails (1.0.14)
78 78
       railties (~> 3.0)
79 79
       thor (~> 0.14)
80  
-    json (1.6.0)
81  
-    json_pure (1.6.0)
  80
+    json (1.6.1)
  81
+    json_pure (1.6.1)
82 82
     launchy (2.0.5)
83 83
       addressable (~> 2.2.6)
84 84
     mail (2.3.0)
@@ -92,7 +92,7 @@ GEM
92 92
     mysql2 (0.3.7)
93 93
     nokogiri (1.5.0)
94 94
     polyglot (0.3.2)
95  
-    rack (1.3.2)
  95
+    rack (1.3.3)
96 96
     rack-cache (1.0.3)
97 97
       rack (>= 0.4)
98 98
     rack-mount (0.8.3)
@@ -118,8 +118,9 @@ GEM
118 118
       thor (~> 0.14.6)
119 119
     rake (0.9.2)
120 120
     rdoc (3.9.4)
  121
+    ruby-prof (0.10.8)
121 122
     rubyzip (0.9.4)
122  
-    selenium-webdriver (2.6.0)
  123
+    selenium-webdriver (2.8.0)
123 124
       childprocess (>= 0.2.1)
124 125
       ffi (>= 1.0.7)
125 126
       json_pure
@@ -158,6 +159,8 @@ DEPENDENCIES
158 159
   launchy
159 160
   mocha (= 0.9.8)
160 161
   mysql2
  162
+  rack (= 1.3.3)
  163
+  ruby-prof
161 164
   sqlite3-ruby
162 165
   test-unit (= 2.1.1)
163 166
   yard
73  Rakefile
... ...
@@ -1,13 +1,72 @@
1  
-# Add your own tasks in files placed in lib/tasks ending in .rake,
2  
-# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
  1
+#!/usr/bin/env rake
  2
+begin
  3
+  require 'bundler/setup'
  4
+rescue LoadError
  5
+  puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
  6
+end
  7
+begin
  8
+  require 'rdoc/task'
  9
+rescue LoadError
  10
+  require 'rdoc/rdoc'
  11
+  require 'rake/rdoctask'
  12
+  RDoc::Task = Rake::RDocTask
  13
+end
3 14
 
4  
-require File.expand_path('../config/application', __FILE__)
  15
+APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
  16
+load 'rails/tasks/engine.rake'
  17
+
  18
+
  19
+Bundler::GemHelper.install_tasks
5 20
 
6  
-require 'rake'
7 21
 require 'rake/testtask'
8 22
 
9  
-Browsercms::Application.load_tasks
  23
+Rake::TestTask.new('test:units') do |t|
  24
+  t.libs << 'lib'
  25
+  t.libs << 'test'
  26
+  t.pattern = 'test/unit/**/*_test.rb'
  27
+  t.verbose = false
  28
+end
10 29
 
11  
-require 'bundler'
12  
-Bundler::GemHelper.install_tasks
  30
+Rake::TestTask.new('test:functionals') do |t|
  31
+  t.libs << 'lib'
  32
+  t.libs << 'test'
  33
+  t.pattern = 'test/functional/**/*_test.rb'
  34
+  t.verbose = false
  35
+
  36
+end
  37
+
  38
+Rake::TestTask.new('test:integration') do |t|
  39
+  t.libs << 'lib'
  40
+  t.libs << 'test'
  41
+  t.pattern = 'test/integration/**/*_test.rb'
  42
+  t.verbose = false
  43
+end
  44
+
  45
+require 'cucumber'
  46
+require 'cucumber/rake/task'
  47
+
  48
+Cucumber::Rake::Task.new(:features) do |t|
  49
+  t.cucumber_opts = "features --format progress"
  50
+end
  51
+
  52
+desc 'Runs all the tests'
  53
+task :test do
  54
+  tests_to_run = ENV['TEST'] ? ["test:single"] : %w(test:units test:functionals test:integration features)
  55
+  errors = tests_to_run.collect do |task|
  56
+    begin
  57
+      Rake::Task[task].invoke
  58
+      nil
  59
+    rescue => e
  60
+      { :task => task, :exception => e }
  61
+    end
  62
+  end.compact
  63
+
  64
+  if errors.any?
  65
+    puts errors.map { |e| "Errors running #{e[:task]}! #{e[:exception].inspect}" }.join("\n")
  66
+    abort
  67
+  end
  68
+end
  69
+
  70
+#task :test => ['test:units', 'test:functionals', 'test:integration', 'features']
13 71
 
  72
+task :default => :test
0  test/dummy/log/production.log → app/assets/images/browsercms/.gitkeep
File renamed without changes
9  app/assets/javascripts/browsercms/application.js
... ...
@@ -0,0 +1,9 @@
  1
+// This is a manifest file that'll be compiled into including all the files listed below.
  2
+// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
  3
+// be included in the compiled file accessible from http://example.com/assets/application.js
  4
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
  5
+// the compiled file.
  6
+//
  7
+//= require jquery
  8
+//= require jquery_ujs
  9
+//= require_tree .
7  app/assets/stylesheets/browsercms/application.css
... ...
@@ -0,0 +1,7 @@
  1
+/*
  2
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
  3
+ * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
  4
+ * the top of the compiled file, but it's generally better to create a new file per style scope.
  5
+ *= require_self
  6
+ *= require_tree . 
  7
+*/
4  app/controllers/browsercms/application_controller.rb
... ...
@@ -0,0 +1,4 @@
  1
+module Browsercms
  2
+  class ApplicationController < ActionController::Base
  3
+  end
  4
+end
8  app/controllers/cms/content_block_controller.rb
@@ -114,8 +114,8 @@ def model_class
114 114
       content_type.model_class
115 115
     end
116 116
   
117  
-    def model_name
118  
-      ActiveModel::Naming.singular(model_class)
  117
+    def model_form_name
  118
+      content_type.model_class_form_name
119 119
     end
120 120
   
121 121
     # methods for loading one or a collection of blocks
@@ -168,7 +168,7 @@ def block_form
168 168
     # new related methods
169 169
   
170 170
     def build_block
171  
-      @block = model_class.new(params[model_name])
  171
+      @block = model_class.new(params[model_form_name])
172 172
       check_permissions
173 173
     end
174 174
 
@@ -207,7 +207,7 @@ def after_create_on_error
207 207
     # update related methods
208 208
     def update_block
209 209
       load_block
210  
-      @block.update_attributes(params[model_name])
  210
+      @block.update_attributes(params[model_form_name])
211 211
     end
212 212
 
213 213
     def after_update_on_success
8  app/controllers/cms/dynamic_views_controller.rb
@@ -18,10 +18,10 @@ def new
18 18
     end
19 19
 
20 20
     def create
21  
-      @view = dynamic_view_type.new(params[ActionController::RecordIdentifier.singular_class_name(dynamic_view_type)])
  21
+      @view = dynamic_view_type.new(params[dynamic_view_type.resource_collection_name])
22 22
       if @view.save
23 23
         flash[:notice] = "#{dynamic_view_type} '#{@view.name}' was created"
24  
-        redirect_to cms_index_path_for(dynamic_view_type.name.underscore.pluralize)
  24
+        redirect_to cms_index_path_for(dynamic_view_type)
25 25
       else
26 26
         render :action => "new"
27 27
       end
@@ -49,8 +49,8 @@ def destroy
49 49
     protected
50 50
     def dynamic_view_type
51 51
       @dynamic_view_type ||= begin
52  
-        uri = request.request_uri.sub(/\?.*/, '')
53  
-        type_name = uri.split('/')[2].classify
  52
+        url = request.path.sub(/\?.*/, '')
  53
+        type_name = url.split('/')[2].classify
54 54
         begin
55 55
           type = "Cms::#{type_name}".constantize
56 56
         rescue NameError
8  app/controllers/cms/home_controller.rb
... ...
@@ -1,7 +1,7 @@
1 1
 module Cms
2  
-class HomeController < Cms::BaseController
3  
-  def index
4  
-    redirect_to '/'
  2
+  class HomeController < Cms::BaseController
  3
+    def index
  4
+      redirect_to '/'
  5
+    end
5 6
   end
6  
-end
7 7
 end
4  app/controllers/cms/links_controller.rb
@@ -34,11 +34,11 @@ def destroy
10  app/controllers/cms/page_routes_controller.rb
@@ -13,19 +13,19 @@ def new
13 13
   end
14 14
   
15 15
   def create
16  
-    @page_route = PageRoute.new(params[:cms_page_route])
  16
+    @page_route = PageRoute.new(params[:page_route])
17 17
     if @page_route.save
18 18
       flash[:notice] = "Page Route Created"
19  
-      redirect_to cms_page_route_url(@page_route)
  19
+      redirect_to page_route_url(@page_route)
20 20
     else
21 21
       render :action => "new"
22 22
     end
23 23
   end
24 24
   
25 25
   def update
26  
-    if @page_route.update_attributes(params[:cms_page_route])
  26
+    if @page_route.update_attributes(params[:page_route])
27 27
       flash[:notice] = "Page Route Updated"
28  
-      redirect_to cms_page_route_url(@page_route)
  28
+      redirect_to page_route_url(@page_route)
29 29
     else
30 30
       render :action => "new"
31 31
     end
@@ -35,7 +35,7 @@ def update
35 35
   def destroy
36 36
     @page_route.destroy
37 37
     flash[:notice] = "Page Route Deleted"
38  
-    redirect_to cms_page_routes_url
  38
+    redirect_to page_routes_url
39 39
   end
40 40
   
41 41
   protected
14  app/controllers/cms/pages_controller.rb
@@ -23,7 +23,7 @@ def show
23 23
   end
24 24
  
25 25
   def create
26  
-    @page = Page.new(params[:cms_page])
  26
+    @page = Page.new(params[:page])
27 27
     @page.section = @section
28 28
     if @page.save
29 29
       flash[:notice] = "Page was '#{@page.name}' created."
@@ -34,7 +34,7 @@ def create
34 34
   end
35 35
 
36 36
   def update
37  
-    if @page.update_attributes(params[:cms_page])
  37
+    if @page.update_attributes(params[:page])
38 38
       flash[:notice] = "Page was '#{@page.name}' updated."
39 39
       redirect_to @page
40 40
     else
@@ -49,11 +49,11 @@ def destroy
49 49
     respond_to do |format|
50 50
       if @page.destroy
51 51
         message = "Page '#{@page.name}' was deleted."
52  
-        format.html { flash[:notice] = message; redirect_to(cms_sitemap_url) }
  52
+        format.html { flash[:notice] = message; redirect_to(sitemap_url) }
53 53
         format.json { render :json => {:success => true, :message => message } }
54 54
       else
55 55
         message = "Page '#{@page.name}' could not be deleted"
56  
-        format.html { flash[:error] = message; redirect_to(cms_sitemap_url) }
  56
+        format.html { flash[:error] = message; redirect_to(sitemap_url) }
57 57
         format.json { render :json => {:success => false, :message => message } }
58 58
       end
59 59
     end
@@ -67,7 +67,7 @@ def destroy
67 67
         raise Cms::Errors::AccessDenied unless @pages.all? { |page| current_user.able_to_edit?(page) }
68 68
         @pages.each { |page| page.send(status) }
69 69
         flash[:notice] = "#{params[:page_ids].size} pages #{verb}"
70  
-        redirect_to cms_dashboard_url
  70
+        redirect_to dashboard_url
71 71
       else
72 72
         load_page
73 73
         if @page.send(status)
@@ -101,8 +101,8 @@ def revert_to
101 101
   private
102 102
     def strip_publish_params
103 103
       unless current_user.able_to?(:publish_content)
104  
-        params[:cms_page].delete :hidden
105  
-        params[:cms_page].delete :archived
  104
+        params[:page].delete :hidden
  105
+        params[:page].delete :archived
106 106
       end
107 107
     end
108 108
 
6  app/controllers/cms/portlets_controller.rb
@@ -28,15 +28,15 @@ def block_form
28 28
     end
29 29
     
30 30
     def new_block_path
31  
-      new_cms_portlet_path
  31
+      new_portlet_path
32 32
     end
33 33
   
34 34
     def block_path(action=nil)
35  
-      send("#{action ? "#{action}_" : ""}cms_portlet_path", @block)
  35
+      send("#{action ? "#{action}_" : ""}portlet_path", @block)
36 36
     end
37 37
 
38 38
     def blocks_path
39  
-      cms_portlets_path
  39
+      portlets_path
40 40
     end
41 41
 end
42 42
 end
4  app/controllers/cms/resource_controller.rb
@@ -12,7 +12,7 @@ def new
12 12
   end
13 13
 
14 14
   def create
15  
-    @object = build_object(params["cms_#{variable_name}"])
  15
+    @object = build_object(params[variable_name])
16 16
     if @object.save
17 17
       flash[:notice] = "#{resource_name.singularize.titleize} '#{object_name}' was created"
18 18
       redirect_to after_create_url
@@ -84,7 +84,7 @@ def object_name
84 84
   end
85 85
 
86 86
   def index_url
87  
-    cms_index_url_for("cms_#{resource_name}")
  87
+    cms_index_url_for(resource_name)
88 88
   end
89 89
 
90 90
   def after_create_url
2  app/controllers/cms/routes_controller.rb
@@ -8,7 +8,7 @@ def index
8 8
     
9 9
     unless params[:path].blank?
10 10
       @path = params[:path]
11  
-      @route = ActionController::Routing::Routes.recognize_path(@path)
  11
+      @route = Rails.application.routes.recognize_path(@path)
12 12
     end
13 13
     
14 14
     @routes = Rails.application.routes.routes.collect do |route|
14  app/controllers/cms/sections_controller.rb
@@ -8,11 +8,11 @@ class Cms::SectionsController < Cms::BaseController
8 8
   helper_method :cms_groups
9 9
 
10 10
   def index
11  
-    redirect_to cms_sitemap_path
  11
+    redirect_to cms.sitemap_path
12 12
   end
13 13
 
14 14
   def show
15  
-    redirect_to cms_sitemap_path
  15
+    redirect_to cms.sitemap_path
16 16
   end
17 17
   
18 18
   def new
@@ -21,7 +21,7 @@ def new
21 21
   end
22 22
   
23 23
   def create
24  
-    @section = Cms::Section.new(params[:cms_section])
  24
+    @section = Cms::Section.new(params[:section])
25 25
     @section.parent = @parent
26 26
     @section.groups = @section.parent.groups unless current_user.able_to?(:administrate)
27 27
     if @section.save
@@ -36,8 +36,8 @@ def edit
36 36
   end
37 37
   
38 38
   def update
39  
-    params[:cms_section].delete('group_ids') if params[:cms_section] &&  !current_user.able_to?(:administrate)
40  
-    @section.attributes = params[:cms_section]
  39
+    params[:section].delete('group_ids') if params[:section] &&  !current_user.able_to?(:administrate)
  40
+    @section.attributes = params[:section]
41 41
     if @section.save
42 42
       flash[:notice] = "Section '#{@section.name}' was updated"
43 43
       redirect_to @section
@@ -50,11 +50,11 @@ def destroy
50 50
     respond_to do |format|
51 51
       if @section.deletable? && @section.destroy
52 52
         message = "Section '#{@section.name}' was deleted."
53  
-        format.html { flash[:notice] = message; redirect_to(cms_sitemap_url) }
  53
+        format.html { flash[:notice] = message; redirect_to(sitemap_url) }
54 54
         format.json { render :json => {:success => true, :message => message } }
55 55
       else
56 56
         message = "Section '#{@section.name}' could not be deleted"
57  
-        format.html { flash[:error] = message; redirect_to(cms_sitemap_url) }
  57
+        format.html { flash[:error] = message; redirect_to(sitemap_url) }
58 58
         format.json { render :json => {:success => false, :message => message } }
59 59
       end
60 60
     end
2  app/controllers/cms/sessions_controller.rb
@@ -25,7 +25,7 @@ def create
25 25
         redirect_to((!params[:success_url].blank? && params[:success_url]) || session[:return_to] || "/")
26 26
         session[:return_to] = nil
27 27
       else
28  
-        redirect_back_or_default(cms_home_url)
  28
+        redirect_back_or_default(cms.home_url)
29 29
       end
30 30
     else
31 31
       note_failed_signin
4  app/controllers/cms/tasks_controller.rb
@@ -27,7 +27,7 @@ def complete
27 27
         end
28 28
       end
29 29
       flash[:notice] = "Tasks marked as complete"
30  
-      redirect_to cms_dashboard_path
  30
+      redirect_to dashboard_path
31 31
     else
32 32
       @task = Task.find(params[:id])
33 33
       if @task.assigned_to == current_user
@@ -41,7 +41,7 @@ def complete
41 41
     end
42 42
   rescue ActiveRecord::RecordNotFound
43 43
     flash[:error] = "No tasks were marked for completion"
44  
-    redirect_to cms_dashboard_path
  44
+    redirect_to dashboard_path
45 45
   end
46 46
   
47 47
   private
6  app/controllers/cms/users_controller.rb
@@ -43,7 +43,7 @@ def change_password
43 43
   def update_password
44 44
     if user.update_attributes(params[:cms_user])
45 45
       flash[:notice] = "Password for '#{user.login}' was changed"
46  
-      redirect_to(current_user.able_to?(:administrate) ? cms_users_path : cms_user_path(user))
  46
+      redirect_to(current_user.able_to?(:administrate) ? users_path : user_path(user))
47 47
     else
48 48
       render :action => 'change_password'
49 49
     end
@@ -56,12 +56,12 @@ def disable
56 56
     rescue Exception => e
57 57
       flash[:error] = e.message
58 58
     end
59  
-    redirect_to cms_users_path
  59
+    redirect_to users_path
60 60
   end
61 61
   
62 62
   def enable
63 63
     user.enable!
64  
-    redirect_to cms_users_path
  64
+    redirect_to users_path
65 65
   end
66 66
 
67 67
   protected
4  app/helpers/browsercms/application_helper.rb
... ...
@@ -0,0 +1,4 @@
  1
+module Browsercms
  2
+  module ApplicationHelper
  3
+  end
  4
+end
9  app/helpers/cms/application_helper.rb
@@ -2,13 +2,6 @@
2 2
 module Cms
3 3
   module ApplicationHelper
4 4
 
5  
-    # Return the JS file to load the configured default WYSIWYG editor
6  
-    #
7  
-    # Ideally, this could be improved if sprockets allows for dynamically determining which js library to use.
8  
-    def cms_content_editor
9  
-      "bcms/#{Cms.content_editor}"
10  
-    end
11  
-
12 5
     def searchable_sections(selected = nil)
13 6
       root    = Section.root.first
14 7
       options = [['All sections', 'all'], [root.name, root.id]]
@@ -47,7 +40,7 @@ def link_to_usages(block)
47 40
       count = block.connected_pages.count
48 41
       if count > 0
49 42
         # Would love a cleaner solution to this problem, see http://stackoverflow.com/questions/702728
50  
-        path = Portlet === block ? usages_cms_portlet_path(block) : [:usages, block]
  43
+        path = Portlet === block ? usages_portlet_path(block) : [:usages, block]
51 44
         link_to count, path, :id => block.id, :block_type => block.content_block_type
52 45
       else
53 46
         count
9  app/helpers/cms/page_helper.rb
... ...
@@ -1,6 +1,13 @@
1 1
 module Cms
2 2
   module PageHelper
3 3
 
  4
+    # Return the JS file to load the configured default WYSIWYG editor
  5
+    #
  6
+    # Ideally, this could be improved if sprockets allows for dynamically determining which js library to use.
  7
+    def cms_content_editor
  8
+      "bcms/#{Cms.content_editor}"
  9
+    end
  10
+
4 11
     # Outputs the title for this page. Used by both internal CMS pages, as well as page templates. If not explicitily set,
5 12
     #   returns the title of the page.
6 13
     #
@@ -56,7 +63,7 @@ def container_has_block?(name, &block)
56 63
     # Add the code to render the CMS toolbar.
57 64
     def cms_toolbar
58 65
       toolbar = <<HTML
59  
-<iframe src="#{cms_toolbar_path(:page_id => @page.id, :page_version => @page.version, :mode => @mode, :page_toolbar => @show_page_toolbar ? 1 : 0) }" width="100%" height="#{@show_page_toolbar ? 159 : 100 }px" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" name="cms_toolbar"></iframe>
  66
+<iframe src="#{cms.toolbar_path(:page_id => @page.id, :page_version => @page.version, :mode => @mode, :page_toolbar => @show_page_toolbar ? 1 : 0) }" width="100%" height="#{@show_page_toolbar ? 159 : 100 }px" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" name="cms_toolbar"></iframe>
60 67
 HTML
61 68
       toolbar.html_safe if @show_toolbar
62 69
     end
20  app/helpers/cms/path_helper.rb
... ...
@@ -1,4 +1,8 @@
1 1
 module Cms
  2
+
  3
+  # @todo All methods really need to be renamed to match conventions for Engines.
  4
+    # In CMS::Engine, shouldn't have cms_ in method name.
  5
+    # From app, should be cms.xyz_path
2 6
   module PathHelper
3 7
     def cms_index_path_for(resource, options={})
4 8
       send("#{resource_collection_name(resource).underscore.pluralize.gsub('/','_')}_path", options)
@@ -18,17 +22,20 @@ def cms_new_url_for(resource, options={})
18 22
     
19 23
     def cms_connectable_path(connectable, options={})
20 24
       if Portlet === connectable
21  
-        cms_portlet_path(connectable)
  25
+        cms.portlet_path(connectable)
22 26
       else
23 27
         connectable
24 28
       end
25 29
     end
26  
-    
  30
+
  31
+    # @todo Really needs to be renamed to match conventions for Engines.
  32
+    # In CMS::Engine, should be edit_connectable_path
  33
+    # From app, should be cms.edit_connectable_path
27 34
     def edit_cms_connectable_path(connectable, options={})
28 35
       if Portlet === connectable
29  
-        edit_cms_portlet_path(connectable, options)
  36
+        edit_portlet_path(connectable, options)
30 37
       else
31  
-        polymorphic_path([:edit, connectable], options)        
  38
+        polymorphic_path([:edit, connectable], options)
32 39
       end
33 40
     end
34 41
     
@@ -37,9 +44,12 @@ def edit_cms_connectable_path(connectable, options={})
37 44
       # the resource can be a ContentType, ActiveRecord::Base instance
38 45
       # or just a string or symbol
39 46
       def resource_collection_name(resource)
  47
+        if resource.respond_to?(:resource_collection_name)
  48
+          return resource.resource_collection_name
  49
+        end
40 50
         collection_name = case resource
41 51
           when ContentType then resource.model_class_form_name
42  
-          when ActiveRecord::Base then ActiveModel::Naming.singular(resource)
  52
+          when ActiveRecord::Base then resource.class.model_name.demodulize
43 53
           else resource.to_s
44 54
         end
45 55
       end
2  app/helpers/cms/template_support.rb
@@ -13,7 +13,7 @@ def self.included(controller)
13 13
         helper do
14 14
           def cms_toolbar
15 15
             if current_user.able_to?(:administrate, :edit_content, :publish_content)
16  
-              %Q{<iframe src="#{cms_toolbar_path(:page_toolbar => 0)}" width="100%" height="100px" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" name="cms_toolbar"></iframe>}
  16
+              %Q{<iframe src="#{cms.toolbar_path(:page_toolbar => 0)}" width="100%" height="100px" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" name="cms_toolbar"></iframe>}
17 17
             end
18 18
           end
19 19
         end
4  app/models/cms/content_type.rb
@@ -57,8 +57,10 @@ def model_class
57 57
       name.constantize
58 58
     end
59 59
 
  60
+    # Cms::HtmlBlock -> html_block
  61
+    # ThingBlock -> thing_block
60 62
     def model_class_form_name
61  
-      ActiveModel::Naming.singular(model_class)
  63
+      model_class.model_name.element
62 64
     end
63 65
 
64 66
     # Allows models to show additional columns when being shown in a list.
9  app/models/cms/dynamic_view.rb
@@ -83,9 +83,14 @@ def set_publish_on_save
83 83
     end
84 84
 
85 85
     # Get the plural symbol for a particular resource.
86  
-    # i.e. Cms::PageTemplate -> :cms_page_templates
  86
+    # i.e. Cms::PageTemplate -> :page_templates
87 87
     def self.resource_name
88  
-      ActiveModel::Naming.plural(self).to_sym
  88
+      resource_collection_name.pluralize
  89
+    end
  90
+
  91
+    # Default implementation
  92
+    def self.resource_collection_name
  93
+      model_name.underscore
89 94
     end
90 95
   end
91 96
 end
7  app/models/cms/group.rb
@@ -39,4 +39,11 @@ def self.guest
39 39
     with_code(GUEST_CODE).first
40 40
   end
41 41
 
  42
+
  43
+  def has_permission?(permission)
  44
+    permissions.any? do |p|
  45
+      return true if permission.to_sym == p.name.to_sym
  46
+    end
  47
+    false
  48
+  end
42 49
 end
8  app/models/cms/page.rb
@@ -137,9 +137,9 @@ def copy_connectors(options={})
137 137
   end
138 138
 
139 139
   # Adds a Content block to this page.
140  
-  #
141  
-  #
142  
-  def create_connector(connectable, container=:main)
  140
+  # @param [ContentBlock] connectable The content block to be added
  141
+  # @param [Symbol] container The container to add it in (default :main)
  142
+  def add_content(connectable, container=:main)
143 143
     transaction do
144 144
       raise "Connectable is nil" unless connectable
145 145
       raise "Container is required" if container.blank?
@@ -157,7 +157,7 @@ def create_connector(connectable, container=:main)
157 157
     end
158 158
   end
159 159
 
160  
-  alias_method :add_content, :create_connector
  160
+  alias_method :create_connector, :add_content
161 161
 
162 162
   def move_connector(connector, direction)
163 163
     transaction do
5  app/models/cms/page_partial.rb
@@ -14,6 +14,11 @@ def self.display_name(file_name)
14 14
       "#{name.sub(/^_/, '').titleize} (#{format}/#{handler})"
15 15
     end
16 16
 
  17
+    def self.resource_collection_name
  18
+      "page_partial"
  19
+    end
  20
+
  21
+
17 22
     def prepend_underscore
18 23
       if !name.blank? && name[0, 1] != '_'
19 24
         self.name = "_#{name}"
11  app/models/cms/page_route.rb
@@ -73,6 +73,17 @@ def to
73 73
     "cms/content#show_page_route"
74 74
   end
75 75
 
  76
+  # @param [Symbol | Array] method A method name (like :get) or array of names (ie. [:get :post]) to constraint this route.
  77
+  def via=(method)
  78
+    if method.respond_to?(:each)
  79
+      method.each do |m|
  80
+        add_condition(:method, m)
  81
+      end
  82
+    else
  83
+      add_condition(:method, method)
  84
+    end
  85
+  end
  86
+
76 87
   # Returns which methods this route can be via. Defaults to [:get, :post] if not specified.
77 88
   def via
78 89
     found = conditions.collect() { |condition|
4  app/models/cms/page_template.rb
@@ -20,6 +20,10 @@ def self.display_name(file_name)
20 20
       "#{name.titleize} (#{format}/#{handler})"
21 21
     end
22 22
 
  23
+    def self.resource_collection_name
  24
+      "page_template"
  25
+    end
  26
+
23 27
     # This is a combination of file system page templates
24 28
     # and database page templates
25 29
     def self.options
2  app/views/cms/cache/show.html.erb
@@ -5,7 +5,7 @@
5 5
 <% end %>
6 6
 
7 7
 <%= content_for :functions do %>
8  
-  <%= link_to(span_tag("Clear Page Cache"), cms_cache_path, 
  8
+  <%= link_to(span_tag("Clear Page Cache"), cache_path,
9 9
     :class => "button http_delete") %>
10 10
 <% end %>
11 11
 
2  app/views/cms/categories/_form.html.erb
@@ -32,5 +32,5 @@
32 32
       })
33 33
     </script>
34 34
   <% end %>
35  
-  <p>Before you can create a category, you must <%= link_to "create a category type", new_cms_category_type_path %>.  Each category must have a category type.  For example, if you plan to categorize your news releases, you might create a "News Release" category type.</p>
  35
+  <p>Before you can create a category, you must <%= link_to "create a category type", new_category_type_path %>.  Each category must have a category type.  For example, if you plan to categorize your news releases, you might create a "News Release" category type.</p>
36 36
 <% end %>
4  app/views/cms/connectors/new.html.erb
@@ -31,7 +31,7 @@
31 31
   <h1><%=h @toolbar_title %></h1>
32 32
   <%= link_to span_tag("Add to Page"), "#", :id => "add_button", :class => "button disabled" %>
33 33
   <%= link_to span_tag("View Content"), "#", :id => "view_button", :class => "button disabled" %>
34  
-  <%= form_tag cms_connectors_path, :id => 'connect_form' do %>
  34
+  <%= form_tag connectors_path, :id => 'connect_form' do %>
35 35
     <%= hidden_field_tag :page_id, @page.to_param %>
36 36
     <%= hidden_field_tag :container,  @container %>
37 37
     <%= hidden_field_tag :connectable_type, '' %>
@@ -40,7 +40,7 @@
40 40
   <br clear="all" />
41 41
 <% end %>
42 42
 
43  
-<%= form_tag new_cms_connector_path, :method => :get do %>
  43
+<%= form_tag new_connector_path, :method => :get do %>
44 44
   <%= hidden_field_tag :page_id, @page.to_param %>
45 45
   <%= hidden_field_tag :container, @container %>
46 46
   <div style="margin: 20px 2px;">
2  app/views/cms/dashboard/_page_drafts.html.erb
... ...
@@ -1,7 +1,7 @@
1 1
 <div class="dashboard_unit" id="page_drafts">
2 2
   <h2 class="left">Page Drafts</h2>
3 3
 
4  
-  <%= form_tag publish_cms_pages_path, :method => :put do %>
  4
+  <%= form_tag cms.publish_pages_path, :method => :put do %>
5 5
     <div class="roundedcorners" style="position: relative">
6 6
       <table class="data">
7 7
         <thead>
2  app/views/cms/dashboard/_tasks.html.erb
... ...
@@ -1,7 +1,7 @@
1 1
 <div class="dashboard_unit" id="tasks">
2 2
   <h2 class="left">Tasks</h2>
3 3
 
4  
-  <%= form_tag complete_cms_tasks_path, :method => :put do %>
  4
+  <%= form_tag cms.complete_tasks_path, :method => :put do %>
5 5
     <div class="roundedcorners" style="position: relative">
6 6
       <table class="data">
7 7
         <thead>
2  app/views/cms/dynamic_views/index.html.erb
@@ -20,7 +20,7 @@
20 20
 <% end %>
21 21
 
22 22
 <%= content_for :functions do %>
23  
-    <%= add_button cms_new_path_for(dynamic_view_type.name.underscore) %>
  23
+    <%= add_button cms_new_path_for(dynamic_view_type) %>
24 24
     <%= edit_button  %>
25 25
     <%= delete_button :title => "Are you sure you want to delete this #{dynamic_view_type.name.demodulize.underscore.titleize}?" %>
26 26
 <% end %>
2  app/views/cms/dynamic_views/new.html.erb
... ...
@@ -1,3 +1,3 @@
1 1
 <% @page_title = @toolbar_title = "New #{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' %>
4  app/views/cms/file_blocks/_form.html.erb
@@ -12,8 +12,8 @@
12 12
     jQuery(function($) {
13 13
       <% if @block.new_record? %>
14 14
         var sectionIdPathMap = <%= @sections.inject({}){|map, sec| map[sec.id.to_s] = sec.path.sub(/\/$/,''); map}.to_json.html_safe %>
15  
-        $('#cms_file_block_attachment_file, #cms_file_block_attachment_section_id').change(function(){
16  
-            $('#cms_file_block_attachment_file_path').val(sectionIdPathMap[$('#cms_file_block_attachment_section_id').val()]+'/'+$.cms.sanitizeFileName($('#cms_file_block_attachment_file').val()))
  15
+        $('#file_block_attachment_file, #file_block_attachment_section_id').change(function(){
  16
+            $('#file_block_attachment_file_path').val(sectionIdPathMap[$('#file_block_attachment_section_id').val()]+'/'+$.cms.sanitizeFileName($('#file_block_attachment_file').val()))
17 17
         })
18 18
       <% end %>      
19 19
     });    
2  app/views/cms/groups/_form.html.erb
@@ -13,7 +13,7 @@
13 13
 <% end %>
14 14
 
15 15
 <%= content_for :functions do %>
16  
-  <%= link_to(span_tag("List All"), cms_groups_path, 
  16
+  <%= link_to(span_tag("List All"), groups_path,
17 17
     :id => "list_all_button", 
18 18
     :class => "button") %>
19 19
 <% end %>
8  app/views/cms/groups/_permissions.html.erb
... ...
@@ -1,9 +1,9 @@
1 1
 <%= content_for :html_head do %>
2 2
   <%= javascript_tag do %>
3 3
     jQuery(function($){
4  
-      var cms_access_group_ids = <%= Cms::GroupType.cms_access.all.map{|e| e.id.to_s}.to_json %>
5  
-      $('#cms_group_group_type_id').change(function() {
6  
-        if ($.inArray($('#cms_group_group_type_id')[0].value, cms_access_group_ids) < 0) {
  4
+      var cms_access_group_ids = <%= Cms::GroupType.cms_access.all.map{|e| e.id.to_s}.to_json.html_safe %>
  5
+      $('#group_group_type_id').change(function() {
  6
+        if ($.inArray($('#group_group_type_id')[0].value, cms_access_group_ids) < 0) {
7 7
           $('#permissions').hide()
8 8
           $('#section-action').text('view')
9 9
         } else {
@@ -22,7 +22,7 @@
22 22
     <div class="checkboxes">
23 23
     <% Cms::Permission.all(:order => "name").each do |p| %>
24 24
       <div class="checkbox_fields">
25  
-          <%= check_box_tag "cms_group[permission_ids][]", p.id, @group.permissions.include?(p), :id => "permission_ids_#{p.id}", :class => "permission_ids" %>
  25
+          <%= check_box_tag "group[permission_ids][]", p.id, @group.permissions.include?(p), :id => "permission_ids_#{p.id}", :class => "permission_ids" %>
26 26
           <label for="permission_ids_<%= p.id %>" style="width: 400px;#padding-top: 6px;"><%=h p.full_name %></label>
27 27
       </div>
28 28
       <div class="instructions"><%=h p.description %></div>
4  app/views/cms/groups/_sections.html.erb
... ...
@@ -1,10 +1,10 @@
1 1
 <div class="checkbox_group fields">
2 2
   <label>Section Permissions</label>
3  
-  <%= hidden_field_tag "cms_group[section_ids][]", "" %>
  3
+  <%= hidden_field_tag "group[section_ids][]", "" %>
4 4
   <div class="checkboxes">
5 5
   <% Cms::Section.all(:order => "path").each do |s|%>
6 6
   <div class="checkbox_fields">
7  
-    <%= check_box_tag "cms_group[section_ids][]", s.id, @group.sections.include?(s), :id => "section_ids_#{s.id}", :class => "section_ids" %>
  7
+    <%= check_box_tag "group[section_ids][]", s.id, @group.sections.include?(s), :id => "section_ids_#{s.id}", :class => "section_ids" %>
8 8
     <label for= "section_ids_<%= s.id %>" style="width: 400px; padding-top: 0; #padding-top: 4px;"><%=h s.name %><span style="padding-top: 0; font-weight: lighter; display: inline; float: none;">(Path: <%=h s.path %>)</span></label>
9 9
   </div>
10 10
   <% end %>
6  app/views/cms/groups/index.html.erb
@@ -2,7 +2,7 @@
2 2
 <% @toolbar_title = "List Groups" %>
3 3
 
4 4
 <%= content_for :functions do %>
5  
-  <%= link_to(span_tag("Add Group"), new_cms_group_path, 
  5
+  <%= link_to(span_tag("Add Group"), new_group_path,
6 6
     :id => "new_group_button", :class => "button") %>
7 7
 <% end %>
8 8
 
@@ -12,12 +12,12 @@
12 12
       <tr>
13 13
         <th colspan="2" class="first">
14 14
           <div class="dividers">
15  
-            <%= link_to "Name", cms_groups_path(:order => determine_order(params[:order], "#{Cms::Group.table_name}.name")) %>
  15
+            <%= link_to "Name", groups_path(:order => determine_order(params[:order], "#{Cms::Group.table_name}.name")) %>
16 16
           </div>
17 17
         </th>
18 18
         <th>
19 19
           <div class="dividers">
20  
-            <%= link_to "Type", cms_groups_path(:order => determine_order(params[:order], "#{Cms::GroupType.table_name}.name")) %>
  20
+            <%= link_to "Type", groups_path(:order => determine_order(params[:order], "#{Cms::GroupType.table_name}.name")) %>
21 21
           </div>
22 22
         </th>
23 23
         <th colspan="2" class="last"><div class="dividers">Permissions</div></th>
2  app/views/cms/links/edit.html.erb
... ...
@@ -1,7 +1,7 @@
2  app/views/cms/links/new.html.erb
... ...
@@ -1,7 +1,7 @@
2  app/views/cms/page_routes/edit.html.erb
... ...
@@ -1,3 +1,3 @@
1 1
 <% @toolbar_title = page_title "Edit Page Route" %>
2  
-<%= content_for :functions, link_to(span_tag("List All"), cms_page_routes_path, :class => "button") %>
  2
+<%= content_for :functions, link_to(span_tag("List All"), page_routes_path, :class => "button") %>
3 3
 <%= render :partial => 'form' %>
4  app/views/cms/page_routes/index.html.erb
@@ -20,11 +20,11 @@
20 20
 <% end %>
21 21
 
22 22
 <%= content_for :functions do %>
23  
-  <%= add_button new_cms_page_route_path %>
  23
+  <%= add_button new_page_route_path %>
24 24
   <%= edit_button %>
25 25
   <%= delete_button :title => "Are you sure you want to delete this Page Route?" %>
26 26
   <%= link_to(span_tag("View"), "#", :id => 'view_button', :class => "button") %>
27  
-  <%= link_to(span_tag("View Rails Routes"), cms_routes_path, :class => "button") %>
  27
+  <%= link_to(span_tag("View Rails Routes"), routes_path, :class => "button") %>
28 28
 <% end %>
29 29
 
30 30
 <div class="roundedcorners">
2  app/views/cms/page_routes/new.html.erb
... ...
@@ -1,3 +1,3 @@
1 1
 <% @toolbar_title = page_title "New Page Route" %>
2  
-<%= content_for :functions, link_to(span_tag("List All"), cms_page_routes_path, :class => "button") %>
  2
+<%= content_for :functions, link_to(span_tag("List All"), page_routes_path, :class => "button") %>
3 3
 <%= render :partial => 'form' %>
8  app/views/cms/page_routes/show.html.erb
... ...
@@ -1,10 +1,10 @@
1 1