7 |
7 |
# #
|
8 |
8 |
# History: 04-Jan-2008 (ADH): Created. #
|
9 |
9 |
# Feb 2009 (SJS): Hacked into plugin for redmine #
|
|
10 |
# Apr 2010 (XE): Updated category management #
|
10 |
11 |
########################################################################
|
11 |
12 |
|
12 |
13 |
module LoaderHelper
|
... | ... | |
50 |
51 |
# First populate the selection box with all the existing categories from this project
|
51 |
52 |
existingCategoryList = IssueCategory.find :all, :conditions => { :project_id => project }
|
52 |
53 |
|
53 |
|
output = "<select id=\"" + fieldId + "\" name=\"" + fieldId + "\"><optgroup label=\"Existing Categories\"> "
|
54 |
|
|
|
54 |
output = "<select id=\"" + fieldId + "\" name=\"" + fieldId + "\"> "
|
|
55 |
# Empty entry
|
|
56 |
output << "<option value=\"\"></option>"
|
|
57 |
output << "<optgroup label=\"Existing Categories\"> "
|
55 |
58 |
existingCategoryList.each do | category_info |
|
56 |
59 |
if ( category_info.to_s == requestedCategory )
|
57 |
60 |
output << "<option value=\"" + category_info.to_s + "\" selected=\"selected\">" + category_info.to_s + "</option>"
|
... | ... | |
62 |
65 |
|
63 |
66 |
output << "</optgroup>"
|
64 |
67 |
|
|
68 |
#
|
|
69 |
# We comment those lines because we dont want new categories based on imported tasks
|
|
70 |
|
65 |
71 |
# Now add any new categories that we found in the project file
|
66 |
|
output << "<optgroup label=\"New Categories\"> "
|
|
72 |
#output << "<optgroup label=\"New Categories\"> "
|
67 |
73 |
|
68 |
|
allNewCategories.each do | category_name |
|
69 |
|
if ( not existingCategoryList.include?(category_name) )
|
70 |
|
if ( category_name == requestedCategory )
|
71 |
|
output << "<option value=\"" + category_name + "\" selected=\"selected\">" + category_name + "</option>"
|
72 |
|
else
|
73 |
|
output << "<option value=\"" + category_name + "\">" + category_name + "</option>"
|
74 |
|
end
|
75 |
|
end
|
76 |
|
end
|
|
74 |
#allNewCategories.each do | category_name |
|
|
75 |
# if ( not existingCategoryList.include?(category_name) )
|
|
76 |
# if ( category_name == requestedCategory )
|
|
77 |
# output << "<option value=\"" + category_name + "\" selected=\"selected\">" + category_name + "</option>"
|
|
78 |
# else
|
|
79 |
# output << "<option value=\"" + category_name + "\">" + category_name + "</option>"
|
|
80 |
# end
|
|
81 |
# end
|
|
82 |
#end
|
77 |
83 |
|
78 |
|
output << "</optgroup>"
|
|
84 |
#output << "</optgroup>"
|
79 |
85 |
|
80 |
86 |
output << "</select>"
|
81 |
87 |
|
... | ... | |
115 |
121 |
|
116 |
122 |
end
|
117 |
123 |
|
118 |
|
end
|
|
124 |
end
|