From ee1bb54ab624e095919b6bf4251fdcafcc43758a Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 17 Jan 2009 08:46:23 +0000 Subject: [PATCH] CustomFieldsController#list moved to #index. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2274 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/custom_fields_controller.rb | 22 +++++++------------ .../custom_fields/{list.rhtml => index.rhtml} | 0 .../custom_fields_controller_test.rb | 4 ++-- 3 files changed, 10 insertions(+), 16 deletions(-) rename app/views/custom_fields/{list.rhtml => index.rhtml} (100%) diff --git a/app/controllers/custom_fields_controller.rb b/app/controllers/custom_fields_controller.rb index c9f798f5f..5a79e4b7b 100644 --- a/app/controllers/custom_fields_controller.rb +++ b/app/controllers/custom_fields_controller.rb @@ -1,5 +1,5 @@ -# redMine - project management software -# Copyright (C) 2006 Jean-Philippe Lang +# Redmine - project management software +# Copyright (C) 2006-2009 Jean-Philippe Lang # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -19,14 +19,8 @@ class CustomFieldsController < ApplicationController before_filter :require_admin def index - list - render :action => 'list' unless request.xhr? - end - - def list @custom_fields_by_type = CustomField.find(:all).group_by {|f| f.class.name } @tab = params[:tab] || 'IssueCustomField' - render :action => "list", :layout => false if request.xhr? end def new @@ -36,11 +30,11 @@ class CustomFieldsController < ApplicationController end rescue end - redirect_to(:action => 'list') and return unless @custom_field.is_a?(CustomField) + redirect_to(:action => 'index') and return unless @custom_field.is_a?(CustomField) if request.post? and @custom_field.save flash[:notice] = l(:notice_successful_create) - redirect_to :action => 'list', :tab => @custom_field.class.name + redirect_to :action => 'index', :tab => @custom_field.class.name end @trackers = Tracker.find(:all, :order => 'position') end @@ -49,7 +43,7 @@ class CustomFieldsController < ApplicationController @custom_field = CustomField.find(params[:id]) if request.post? and @custom_field.update_attributes(params[:custom_field]) flash[:notice] = l(:notice_successful_update) - redirect_to :action => 'list', :tab => @custom_field.class.name + redirect_to :action => 'index', :tab => @custom_field.class.name end @trackers = Tracker.find(:all, :order => 'position') end @@ -66,14 +60,14 @@ class CustomFieldsController < ApplicationController when 'lowest' @custom_field.move_to_bottom end if params[:position] - redirect_to :action => 'list', :tab => @custom_field.class.name + redirect_to :action => 'index', :tab => @custom_field.class.name end def destroy @custom_field = CustomField.find(params[:id]).destroy - redirect_to :action => 'list', :tab => @custom_field.class.name + redirect_to :action => 'index', :tab => @custom_field.class.name rescue flash[:error] = "Unable to delete custom field" - redirect_to :action => 'list' + redirect_to :action => 'index' end end diff --git a/app/views/custom_fields/list.rhtml b/app/views/custom_fields/index.rhtml similarity index 100% rename from app/views/custom_fields/list.rhtml rename to app/views/custom_fields/index.rhtml diff --git a/test/functional/custom_fields_controller_test.rb b/test/functional/custom_fields_controller_test.rb index c37368da2..42dedb3c1 100644 --- a/test/functional/custom_fields_controller_test.rb +++ b/test/functional/custom_fields_controller_test.rb @@ -47,7 +47,7 @@ class CustomFieldsControllerTest < Test::Unit::TestCase :field_format => "list", :tracker_ids => ["1", ""]} end - assert_redirected_to '/custom_fields/list' + assert_redirected_to '/custom_fields' field = IssueCustomField.find_by_name('test_post_new_list') assert_not_nil field assert_equal ["0.1", "0.2"], field.possible_values @@ -56,6 +56,6 @@ class CustomFieldsControllerTest < Test::Unit::TestCase def test_invalid_custom_field_class_should_redirect_to_list get :new, :type => 'UnknownCustomField' - assert_redirected_to '/custom_fields/list' + assert_redirected_to '/custom_fields' end end -- 2.39.5