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:
parent
48295a6c4b
commit
ee1bb54ab6
|
@ -1,5 +1,5 @@
|
||||||
# redMine - project management software
|
# Redmine - project management software
|
||||||
# Copyright (C) 2006 Jean-Philippe Lang
|
# Copyright (C) 2006-2009 Jean-Philippe Lang
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or
|
# This program is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU General Public License
|
# modify it under the terms of the GNU General Public License
|
||||||
|
@ -19,14 +19,8 @@ class CustomFieldsController < ApplicationController
|
||||||
before_filter :require_admin
|
before_filter :require_admin
|
||||||
|
|
||||||
def index
|
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 }
|
@custom_fields_by_type = CustomField.find(:all).group_by {|f| f.class.name }
|
||||||
@tab = params[:tab] || 'IssueCustomField'
|
@tab = params[:tab] || 'IssueCustomField'
|
||||||
render :action => "list", :layout => false if request.xhr?
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
|
@ -36,11 +30,11 @@ class CustomFieldsController < ApplicationController
|
||||||
end
|
end
|
||||||
rescue
|
rescue
|
||||||
end
|
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
|
if request.post? and @custom_field.save
|
||||||
flash[:notice] = l(:notice_successful_create)
|
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
|
end
|
||||||
@trackers = Tracker.find(:all, :order => 'position')
|
@trackers = Tracker.find(:all, :order => 'position')
|
||||||
end
|
end
|
||||||
|
@ -49,7 +43,7 @@ class CustomFieldsController < ApplicationController
|
||||||
@custom_field = CustomField.find(params[:id])
|
@custom_field = CustomField.find(params[:id])
|
||||||
if request.post? and @custom_field.update_attributes(params[:custom_field])
|
if request.post? and @custom_field.update_attributes(params[:custom_field])
|
||||||
flash[:notice] = l(:notice_successful_update)
|
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
|
end
|
||||||
@trackers = Tracker.find(:all, :order => 'position')
|
@trackers = Tracker.find(:all, :order => 'position')
|
||||||
end
|
end
|
||||||
|
@ -66,14 +60,14 @@ class CustomFieldsController < ApplicationController
|
||||||
when 'lowest'
|
when 'lowest'
|
||||||
@custom_field.move_to_bottom
|
@custom_field.move_to_bottom
|
||||||
end if params[:position]
|
end if params[:position]
|
||||||
redirect_to :action => 'list', :tab => @custom_field.class.name
|
redirect_to :action => 'index', :tab => @custom_field.class.name
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@custom_field = CustomField.find(params[:id]).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
|
rescue
|
||||||
flash[:error] = "Unable to delete custom field"
|
flash[:error] = "Unable to delete custom field"
|
||||||
redirect_to :action => 'list'
|
redirect_to :action => 'index'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -47,7 +47,7 @@ class CustomFieldsControllerTest < Test::Unit::TestCase
|
||||||
:field_format => "list",
|
:field_format => "list",
|
||||||
:tracker_ids => ["1", ""]}
|
:tracker_ids => ["1", ""]}
|
||||||
end
|
end
|
||||||
assert_redirected_to '/custom_fields/list'
|
assert_redirected_to '/custom_fields'
|
||||||
field = IssueCustomField.find_by_name('test_post_new_list')
|
field = IssueCustomField.find_by_name('test_post_new_list')
|
||||||
assert_not_nil field
|
assert_not_nil field
|
||||||
assert_equal ["0.1", "0.2"], field.possible_values
|
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
|
def test_invalid_custom_field_class_should_redirect_to_list
|
||||||
get :new, :type => 'UnknownCustomField'
|
get :new, :type => 'UnknownCustomField'
|
||||||
assert_redirected_to '/custom_fields/list'
|
assert_redirected_to '/custom_fields'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue