diff --git a/app/models/environment.rb b/app/models/environment.rb index 04cb677..482bb15 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -30,6 +30,7 @@ class Environment < ActiveRecord::Base 'disable_asset_events' => _('Disable search for events'), 'disable_products_for_enterprises' => _('Disable products for enterprises'), 'disable_categories' => _('Disable categories'), + 'disable_cms' => _('Disable CMS'), } end diff --git a/app/views/profile_editor/index.rhtml b/app/views/profile_editor/index.rhtml index f2ef89f..70274e3 100644 --- a/app/views/profile_editor/index.rhtml +++ b/app/views/profile_editor/index.rhtml @@ -20,7 +20,7 @@ <%= file_manager_button(_('Edit Header and Footer'), 'icons-app/header-and-footer.png', :controller => 'profile_editor', :action => 'header_footer') %> - <%= file_manager_button(_('Manage Content'), 'icons-app/cms.png', :controller => 'cms') %> + <%= file_manager_button(_('Manage Content'), 'icons-app/cms.png', :controller => 'cms') unless environment.enabled?('disable_cms')%> <%= file_manager_button(_('Change Password'), 'icons-app/change-password.png', :controller => 'account', :action => 'change_password') if profile.person? %> diff --git a/test/functional/profile_editor_controller_test.rb b/test/functional/profile_editor_controller_test.rb index c241514..9f80269 100644 --- a/test/functional/profile_editor_controller_test.rb +++ b/test/functional/profile_editor_controller_test.rb @@ -523,4 +523,18 @@ class ProfileEditorControllerTest < Test::Unit::TestCase assert_tag :tag => 'input', :attributes => {:name => 'profile_data[enable_contact_us]', :type => 'checkbox'} end + should 'display link to CMS' do + get :index, :profile => 'default_user' + assert_tag :tag => 'a', :attributes => { :href => '/myprofile/default_user/cms' } + end + + should 'not display link to CMS if disabled' do + env = Environment.default + env.enable('disable_cms') + env.save! + get :index, :profile => 'default_user' + + assert_no_tag :tag => 'a', :attributes => { :href => '/myprofile/default_user/cms' } + end + end -- libgit2 0.21.2