Commit 4c4f843c180ef9253317e5fc29b3a17d86cf22bf

Authored by Antonio Terceiro
1 parent 0efbcaf3

ActionItem867: making it possible to disable CMS

app/models/environment.rb
... ... @@ -30,6 +30,7 @@ class Environment < ActiveRecord::Base
30 30 'disable_asset_events' => _('Disable search for events'),
31 31 'disable_products_for_enterprises' => _('Disable products for enterprises'),
32 32 'disable_categories' => _('Disable categories'),
  33 + 'disable_cms' => _('Disable CMS'),
33 34 }
34 35 end
35 36  
... ...
app/views/profile_editor/index.rhtml
... ... @@ -20,7 +20,7 @@
20 20  
21 21 <%= file_manager_button(_('Edit Header and Footer'), 'icons-app/header-and-footer.png', :controller => 'profile_editor', :action => 'header_footer') %>
22 22  
23   - <%= file_manager_button(_('Manage Content'), 'icons-app/cms.png', :controller => 'cms') %>
  23 + <%= file_manager_button(_('Manage Content'), 'icons-app/cms.png', :controller => 'cms') unless environment.enabled?('disable_cms')%>
24 24  
25 25 <%= file_manager_button(_('Change Password'), 'icons-app/change-password.png', :controller => 'account', :action => 'change_password') if profile.person? %>
26 26  
... ...
test/functional/profile_editor_controller_test.rb
... ... @@ -523,4 +523,18 @@ class ProfileEditorControllerTest &lt; Test::Unit::TestCase
523 523 assert_tag :tag => 'input', :attributes => {:name => 'profile_data[enable_contact_us]', :type => 'checkbox'}
524 524 end
525 525  
  526 + should 'display link to CMS' do
  527 + get :index, :profile => 'default_user'
  528 + assert_tag :tag => 'a', :attributes => { :href => '/myprofile/default_user/cms' }
  529 + end
  530 +
  531 + should 'not display link to CMS if disabled' do
  532 + env = Environment.default
  533 + env.enable('disable_cms')
  534 + env.save!
  535 + get :index, :profile => 'default_user'
  536 +
  537 + assert_no_tag :tag => 'a', :attributes => { :href => '/myprofile/default_user/cms' }
  538 + end
  539 +
526 540 end
... ...