adding ability to change /cms-admin to something else... like /admin
Oleg
committed Nov 10, 2010
commit 5b7dcacf6d631efa5ca994a9fc397bcf6ac6890b
Showing 3
changed files with
11 additions
and 5 deletions
config/routes.rb
+2
-2
| @@ | @@ -1,7 +1,7 @@ |
| Rails.application.routes.draw do | |
| - | namespace :cms_admin, :path => 'cms-admin', :except => :show do |
| - | get '/' => redirect('/cms-admin/pages') |
| + | namespace :cms_admin, :path => ComfortableMexicanSofa.config.admin_route_prefix, :except => :show do |
| + | get '/' => redirect("/#{ComfortableMexicanSofa.config.admin_route_prefix}/pages") |
| resources :pages do | |
| member do | |
| match :form_blocks | |
comfortable_mexican_sofa/configuration.rb b/lib/comfortable_mexican_sofa/configuration.rb
+8
-3
| @@ | @@ -10,11 +10,16 @@ class ComfortableMexicanSofa::Configuration |
| # data from the database. Not active if not specified. | |
| attr_accessor :seed_data_path | |
| + | # Default url to access admin area is http://yourhost/cms-admin/ |
| + | # You can change 'cms-admin' to 'admin', for example. |
| + | attr_accessor :admin_route_prefix |
| + | |
| # Configuration defaults | |
| def initialize | |
| - | @cms_title = 'ComfortableMexicanSofa' |
| - | @authentication = 'ComfortableMexicanSofa::HttpAuth' |
| - | @seed_data_path = nil |
| + | @cms_title = 'ComfortableMexicanSofa' |
| + | @authentication = 'ComfortableMexicanSofa::HttpAuth' |
| + | @seed_data_path = nil |
| + | @admin_route_prefix = 'cms-admin' |
| end | |
| end | |
| \ No newline at end of file | |
test/unit/cms_configuration_test.rb
+1
-0
| @@ | @@ -7,6 +7,7 @@ class CmsConfigurationTest < ActiveSupport::TestCase |
| assert_equal 'ComfortableMexicanSofa', config.cms_title | |
| assert_equal 'ComfortableMexicanSofa::HttpAuth', config.authentication | |
| assert_equal nil, config.seed_data_path | |
| + | assert_equal 'cms-admin', config.admin_route_prefix |
| end | |
| def test_initialization_overrides | |