CustomFieldsController#list moved to #index.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2274 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2009-01-17 08:46:23 +00:00
parent 48295a6c4b
commit ee1bb54ab6
3 changed files with 10 additions and 16 deletions

View File

@ -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

View File

@ -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