|
@@
-1,5
+1,5
|
|
1
|
# redMine - project management software
|
|
1
|
# Redmine - project management software
|
|
2
|
# Copyright (C) 2006 Jean-Philippe Lang
|
|
2
|
# Copyright (C) 2006-2009 Jean-Philippe Lang
|
|
3
|
#
|
|
3
|
#
|
|
4
|
# This program is free software; you can redistribute it and/or
|
|
4
|
# This program is free software; you can redistribute it and/or
|
|
5
|
# modify it under the terms of the GNU General Public License
|
|
5
|
# modify it under the terms of the GNU General Public License
|
|
@@
-19,14
+19,8
class CustomFieldsController < ApplicationController
|
|
19
|
before_filter :require_admin
|
|
19
|
before_filter :require_admin
|
|
20
|
|
|
20
|
|
|
21
|
def index
|
|
21
|
def index
|
|
22
|
list
|
|
|
|
|
23
|
render :action => 'list' unless request.xhr?
|
|
|
|
|
24
|
end
|
|
|
|
|
25
|
|
|
|
|
|
26
|
def list
|
|
|
|
|
27
|
@custom_fields_by_type = CustomField.find(:all).group_by {|f| f.class.name }
|
|
22
|
@custom_fields_by_type = CustomField.find(:all).group_by {|f| f.class.name }
|
|
28
|
@tab = params[:tab] || 'IssueCustomField'
|
|
23
|
@tab = params[:tab] || 'IssueCustomField'
|
|
29
|
render :action => "list", :layout => false if request.xhr?
|
|
|
|
|
30
|
end
|
|
24
|
end
|
|
31
|
|
|
25
|
|
|
32
|
def new
|
|
26
|
def new
|
|
@@
-36,11
+30,11
class CustomFieldsController < ApplicationController
|
|
36
|
end
|
|
30
|
end
|
|
37
|
rescue
|
|
31
|
rescue
|
|
38
|
end
|
|
32
|
end
|
|
39
|
redirect_to(:action => 'list') and return unless @custom_field.is_a?(CustomField)
|
|
33
|
redirect_to(:action => 'index') and return unless @custom_field.is_a?(CustomField)
|
|
40
|
|
|
34
|
|
|
41
|
if request.post? and @custom_field.save
|
|
35
|
if request.post? and @custom_field.save
|
|
42
|
flash[:notice] = l(:notice_successful_create)
|
|
36
|
flash[:notice] = l(:notice_successful_create)
|
|
43
|
redirect_to :action => 'list', :tab => @custom_field.class.name
|
|
37
|
redirect_to :action => 'index', :tab => @custom_field.class.name
|
|
44
|
end
|
|
38
|
end
|
|
45
|
@trackers = Tracker.find(:all, :order => 'position')
|
|
39
|
@trackers = Tracker.find(:all, :order => 'position')
|
|
46
|
end
|
|
40
|
end
|
|
@@
-49,7
+43,7
class CustomFieldsController < ApplicationController
|
|
49
|
@custom_field = CustomField.find(params[:id])
|
|
43
|
@custom_field = CustomField.find(params[:id])
|
|
50
|
if request.post? and @custom_field.update_attributes(params[:custom_field])
|
|
44
|
if request.post? and @custom_field.update_attributes(params[:custom_field])
|
|
51
|
flash[:notice] = l(:notice_successful_update)
|
|
45
|
flash[:notice] = l(:notice_successful_update)
|
|
52
|
redirect_to :action => 'list', :tab => @custom_field.class.name
|
|
46
|
redirect_to :action => 'index', :tab => @custom_field.class.name
|
|
53
|
end
|
|
47
|
end
|
|
54
|
@trackers = Tracker.find(:all, :order => 'position')
|
|
48
|
@trackers = Tracker.find(:all, :order => 'position')
|
|
55
|
end
|
|
49
|
end
|
|
@@
-66,14
+60,14
class CustomFieldsController < ApplicationController
|
|
66
|
when 'lowest'
|
|
60
|
when 'lowest'
|
|
67
|
@custom_field.move_to_bottom
|
|
61
|
@custom_field.move_to_bottom
|
|
68
|
end if params[:position]
|
|
62
|
end if params[:position]
|
|
69
|
redirect_to :action => 'list', :tab => @custom_field.class.name
|
|
63
|
redirect_to :action => 'index', :tab => @custom_field.class.name
|
|
70
|
end
|
|
64
|
end
|
|
71
|
|
|
65
|
|
|
72
|
def destroy
|
|
66
|
def destroy
|
|
73
|
@custom_field = CustomField.find(params[:id]).destroy
|
|
67
|
@custom_field = CustomField.find(params[:id]).destroy
|
|
74
|
redirect_to :action => 'list', :tab => @custom_field.class.name
|
|
68
|
redirect_to :action => 'index', :tab => @custom_field.class.name
|
|
75
|
rescue
|
|
69
|
rescue
|
|
76
|
flash[:error] = "Unable to delete custom field"
|
|
70
|
flash[:error] = "Unable to delete custom field"
|
|
77
|
redirect_to :action => 'list'
|
|
71
|
redirect_to :action => 'index'
|
|
78
|
end
|
|
72
|
end
|
|
79
|
end
|
|
73
|
end
|