From 24c78ad590eca967f4b0f28c66a9856d28abc176 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Fri, 4 May 2012 17:13:50 -0300 Subject: [PATCH] Remove "Disable CMS" feature --- app/models/environment.rb | 1 - app/views/cms/_tiny_mce_article.rhtml | 8 +------- app/views/content_viewer/_article_toolbar.rhtml | 50 +++++++++++++++++++++++--------------------------- app/views/profile_editor/index.rhtml | 2 +- test/functional/profile_editor_controller_test.rb | 9 --------- 5 files changed, 25 insertions(+), 45 deletions(-) diff --git a/app/models/environment.rb b/app/models/environment.rb index 00b32ac..ee313e9 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -94,7 +94,6 @@ 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'), 'disable_header_and_footer' => _('Disable header/footer editing by users'), 'disable_gender_icon' => _('Disable gender icon'), 'disable_categories_menu' => _('Disable the categories menu'), diff --git a/app/views/cms/_tiny_mce_article.rhtml b/app/views/cms/_tiny_mce_article.rhtml index e01c722..7a2d205 100644 --- a/app/views/cms/_tiny_mce_article.rhtml +++ b/app/views/cms/_tiny_mce_article.rhtml @@ -3,13 +3,7 @@ <%= render :file => 'shared/tiny_mce' %>
- <% if profile.enterprise? && environment.enabled?('disable_cms') && !@article.name.blank? %> -
- <%= _('Title') %>: <%= @article.name %> -
- <% else %> - <%= required labelled_form_field(_('Title'), text_field(:article, 'name', :size => '64')) %> - <% end %> + <%= required labelled_form_field(_('Title'), text_field(:article, 'name', :size => '64')) %> <%= render :partial => 'translatable' %> <%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true} %> diff --git a/app/views/content_viewer/_article_toolbar.rhtml b/app/views/content_viewer/_article_toolbar.rhtml index d94325c..3ce2224 100644 --- a/app/views/content_viewer/_article_toolbar.rhtml +++ b/app/views/content_viewer/_article_toolbar.rhtml @@ -5,36 +5,32 @@ <%= link_to content_tag( 'span', label_for_edit_article(@page) ), profile.admin_url.merge({ :controller => 'cms', :action => 'edit', :id => @page.id }), :class => 'button with-text icon-edit' %> - <% if !(profile.kind_of?(Enterprise) && environment.enabled?('disable_cms')) %> - <% if @page != profile.home_page && !@page.has_posts? %> - <%= link_to content_tag( 'span', _('Delete') ), - profile.admin_url.merge({ :controller => 'cms', :action => 'destroy', :id => @page}), - :method => :post, - :class => 'button with-text icon-delete', - :confirm => delete_article_message(@page) %> - <% end %> - <% if !environment.enabled?('disable_cms') && !@page.folder? %> - <% if profile.kind_of?(Person) %> - <%= link_to content_tag( 'span', _('Spread this') ), - profile.admin_url.merge({ :controller => 'cms', :action => 'publish', :id => @page }), - :class => 'button with-text icon-spread' %> - <% elsif profile.kind_of?(Community) && environment.portal_community %> - <%= link_to content_tag( 'span', _('Spread this') ), - profile.admin_url.merge({ :controller => 'cms', :action => 'publish_on_portal_community', :id => @page }), - :class => 'button with-text icon-spread' %> - <% end %> + <% if @page != profile.home_page && !@page.has_posts? %> + <%= link_to content_tag( 'span', _('Delete') ), + profile.admin_url.merge({ :controller => 'cms', :action => 'destroy', :id => @page}), + :method => :post, + :class => 'button with-text icon-delete', + :confirm => delete_article_message(@page) %> + <% end %> + <% if !@page.folder? %> + <% if profile.kind_of?(Person) %> + <%= link_to content_tag( 'span', _('Spread this') ), + profile.admin_url.merge({ :controller => 'cms', :action => 'publish', :id => @page }), + :class => 'button with-text icon-spread' %> + <% elsif profile.kind_of?(Community) && environment.portal_community %> + <%= link_to content_tag( 'span', _('Spread this') ), + profile.admin_url.merge({ :controller => 'cms', :action => 'publish_on_portal_community', :id => @page }), + :class => 'button with-text icon-spread' %> <% end %> <% end %> <% end %> - <% if !(profile.kind_of?(Enterprise) && environment.enabled?('disable_cms')) %> - <% if !@page.gallery? %> - <%= link_to _('Add translation'), - profile.admin_url.merge(:controller => 'cms', :action => 'new', - :parent_id => (@page.folder? ? @page : (@page.parent.nil? ? nil : @page.parent)), - :type => @page.type, :article => { :translation_of_id => @page.native_translation.id }), - :class => 'button with-text icon-locale' if @page.translatable? && !@page.native_translation.language.blank? %> - <%= lightbox_remote_button(:new, label_for_new_article(@page), profile.admin_url.merge(:controller => 'cms', :action => 'new', :parent_id => (@page.folder? ? @page : (@page.parent.nil? ? nil : @page.parent)))) %> - <% end %> + <% if !@page.gallery? %> + <%= link_to _('Add translation'), + profile.admin_url.merge(:controller => 'cms', :action => 'new', + :parent_id => (@page.folder? ? @page : (@page.parent.nil? ? nil : @page.parent)), + :type => @page.type, :article => { :translation_of_id => @page.native_translation.id }), + :class => 'button with-text icon-locale' if @page.translatable? && !@page.native_translation.language.blank? %> + <%= lightbox_remote_button(:new, label_for_new_article(@page), profile.admin_url.merge(:controller => 'cms', :action => 'new', :parent_id => (@page.folder? ? @page : (@page.parent.nil? ? nil : @page.parent)))) %> <% end %> <% if @page.accept_uploads? %> <%= button('upload-file', _('Upload files'), profile.admin_url.merge(:controller => 'cms', :action => 'upload_files', :parent_id => (@page.folder? ? @page : @page.parent))) %> diff --git a/app/views/profile_editor/index.rhtml b/app/views/profile_editor/index.rhtml index 96567ec..b48c7ab 100644 --- a/app/views/profile_editor/index.rhtml +++ b/app/views/profile_editor/index.rhtml @@ -26,7 +26,7 @@ <%= control_panel_button(_('Edit Header and Footer'), 'header-and-footer', :controller => 'profile_editor', :action => 'header_footer') unless profile.enterprise? && environment.enabled?('disable_header_and_footer') && !user.is_admin?(environment) %> - <%= control_panel_button(_('Manage Content'), 'cms', :controller => 'cms') if !environment.enabled?('disable_cms') || profile.community? %> + <%= control_panel_button(_('Manage Content'), 'cms', :controller => 'cms') %> <% unless profile.enterprise? %> <%= case profile.blogs.count diff --git a/test/functional/profile_editor_controller_test.rb b/test/functional/profile_editor_controller_test.rb index 5b6024a..d2750e4 100644 --- a/test/functional/profile_editor_controller_test.rb +++ b/test/functional/profile_editor_controller_test.rb @@ -601,15 +601,6 @@ class ProfileEditorControllerTest < ActionController::TestCase 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 => profile.identifier - - assert_no_tag :tag => 'a', :attributes => { :href => '/myprofile/default_user/cms' } - end - should 'offer to create blog in control panel' do get :index, :profile => profile.identifier assert_tag :tag => 'a', :attributes => { :href => "/myprofile/default_user/cms/new?type=Blog" } -- libgit2 0.21.2