##// END OF EJS Templates
Fixed: Cannot create a new category on ticket creation/update page with 0.8.7 (#4400)....
Jean-Philippe Lang -
r3190:8bab5b4730b1
parent child
Show More
@@ -1,63 +1,63
1 <% if @issue.new_record? %>
1 <% if @issue.new_record? %>
2 <p><%= f.select :tracker_id, @project.trackers.collect {|t| [t.name, t.id]}, :required => true %></p>
2 <p><%= f.select :tracker_id, @project.trackers.collect {|t| [t.name, t.id]}, :required => true %></p>
3 <%= observe_field :issue_tracker_id, :url => { :action => :new },
3 <%= observe_field :issue_tracker_id, :url => { :action => :new },
4 :update => :content,
4 :update => :content,
5 :with => "Form.serialize('issue-form')" %>
5 :with => "Form.serialize('issue-form')" %>
6 <hr />
6 <hr />
7 <% end %>
7 <% end %>
8
8
9 <div id="issue_descr_fields" <%= 'style="display:none"' unless @issue.new_record? || @issue.errors.any? %>>
9 <div id="issue_descr_fields" <%= 'style="display:none"' unless @issue.new_record? || @issue.errors.any? %>>
10 <p><%= f.text_field :subject, :size => 80, :required => true %></p>
10 <p><%= f.text_field :subject, :size => 80, :required => true %></p>
11 <p><%= f.text_area :description,
11 <p><%= f.text_area :description,
12 :cols => 60,
12 :cols => 60,
13 :rows => (@issue.description.blank? ? 10 : [[10, @issue.description.length / 50].max, 100].min),
13 :rows => (@issue.description.blank? ? 10 : [[10, @issue.description.length / 50].max, 100].min),
14 :accesskey => accesskey(:edit),
14 :accesskey => accesskey(:edit),
15 :class => 'wiki-edit' %></p>
15 :class => 'wiki-edit' %></p>
16 </div>
16 </div>
17
17
18 <div class="splitcontentleft">
18 <div class="splitcontentleft">
19 <% if @issue.new_record? || @allowed_statuses.any? %>
19 <% if @issue.new_record? || @allowed_statuses.any? %>
20 <p><%= f.select :status_id, (@allowed_statuses.collect {|p| [p.name, p.id]}), :required => true %></p>
20 <p><%= f.select :status_id, (@allowed_statuses.collect {|p| [p.name, p.id]}), :required => true %></p>
21 <% else %>
21 <% else %>
22 <p><label><%= l(:field_status) %></label> <%= @issue.status.name %></p>
22 <p><label><%= l(:field_status) %></label> <%= @issue.status.name %></p>
23 <% end %>
23 <% end %>
24
24
25 <p><%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), :required => true %></p>
25 <p><%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), :required => true %></p>
26 <p><%= f.select :assigned_to_id, (@issue.assignable_users.collect {|m| [m.name, m.id]}), :include_blank => true %></p>
26 <p><%= f.select :assigned_to_id, (@issue.assignable_users.collect {|m| [m.name, m.id]}), :include_blank => true %></p>
27 <% unless @project.issue_categories.empty? %>
27 <% unless @project.issue_categories.empty? %>
28 <p><%= f.select :category_id, (@project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true %>
28 <p><%= f.select :category_id, (@project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true %>
29 <%= prompt_to_remote(l(:label_issue_category_new),
29 <%= prompt_to_remote(l(:label_issue_category_new),
30 l(:label_issue_category_new), 'category[name]',
30 l(:label_issue_category_new), 'category[name]',
31 {:controller => 'projects', :action => 'add_issue_category', :id => @project},
31 {:controller => 'projects', :action => 'add_issue_category', :id => @project, :authenticity_token => form_authenticity_token},
32 :class => 'small', :tabindex => 199) if authorize_for('projects', 'add_issue_category') %></p>
32 :class => 'small', :tabindex => 199) if authorize_for('projects', 'add_issue_category') %></p>
33 <% end %>
33 <% end %>
34 <%= content_tag('p', f.select(:fixed_version_id,
34 <%= content_tag('p', f.select(:fixed_version_id,
35 (@project.versions.sort.collect {|v| [v.name, v.id]}),
35 (@project.versions.sort.collect {|v| [v.name, v.id]}),
36 { :include_blank => true })) unless @project.versions.empty? %>
36 { :include_blank => true })) unless @project.versions.empty? %>
37 </div>
37 </div>
38
38
39 <div class="splitcontentright">
39 <div class="splitcontentright">
40 <p><%= f.text_field :start_date, :size => 10 %><%= calendar_for('issue_start_date') %></p>
40 <p><%= f.text_field :start_date, :size => 10 %><%= calendar_for('issue_start_date') %></p>
41 <p><%= f.text_field :due_date, :size => 10 %><%= calendar_for('issue_due_date') %></p>
41 <p><%= f.text_field :due_date, :size => 10 %><%= calendar_for('issue_due_date') %></p>
42 <p><%= f.text_field :estimated_hours, :size => 3 %> <%= l(:field_hours) %></p>
42 <p><%= f.text_field :estimated_hours, :size => 3 %> <%= l(:field_hours) %></p>
43 <p><%= f.select :done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %></p>
43 <p><%= f.select :done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %></p>
44 </div>
44 </div>
45
45
46 <div style="clear:both;"> </div>
46 <div style="clear:both;"> </div>
47 <%= render :partial => 'form_custom_fields' %>
47 <%= render :partial => 'form_custom_fields' %>
48
48
49 <% if @issue.new_record? %>
49 <% if @issue.new_record? %>
50 <p><label><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form' %></p>
50 <p><label><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form' %></p>
51 <% end %>
51 <% end %>
52
52
53 <% if @issue.new_record? && User.current.allowed_to?(:add_issue_watchers, @project) -%>
53 <% if @issue.new_record? && User.current.allowed_to?(:add_issue_watchers, @project) -%>
54 <p><label><%= l(:label_issue_watchers) %></label>
54 <p><label><%= l(:label_issue_watchers) %></label>
55 <% @issue.project.users.sort.each do |user| -%>
55 <% @issue.project.users.sort.each do |user| -%>
56 <label class="floating"><%= check_box_tag 'issue[watcher_user_ids][]', user.id, @issue.watcher_user_ids.include?(user.id) %> <%=h user %></label>
56 <label class="floating"><%= check_box_tag 'issue[watcher_user_ids][]', user.id, @issue.watcher_user_ids.include?(user.id) %> <%=h user %></label>
57 <% end -%>
57 <% end -%>
58 </p>
58 </p>
59 <% end %>
59 <% end %>
60
60
61 <%= call_hook(:view_issues_form_details_bottom, { :issue => @issue, :form => f }) %>
61 <%= call_hook(:view_issues_form_details_bottom, { :issue => @issue, :form => f }) %>
62
62
63 <%= wikitoolbar_for 'issue_description' %>
63 <%= wikitoolbar_for 'issue_description' %>
@@ -1,144 +1,145
1 /* redMine - project management software
1 /* redMine - project management software
2 Copyright (C) 2006-2008 Jean-Philippe Lang */
2 Copyright (C) 2006-2008 Jean-Philippe Lang */
3
3
4 function checkAll (id, checked) {
4 function checkAll (id, checked) {
5 var els = Element.descendants(id);
5 var els = Element.descendants(id);
6 for (var i = 0; i < els.length; i++) {
6 for (var i = 0; i < els.length; i++) {
7 if (els[i].disabled==false) {
7 if (els[i].disabled==false) {
8 els[i].checked = checked;
8 els[i].checked = checked;
9 }
9 }
10 }
10 }
11 }
11 }
12
12
13 function toggleCheckboxesBySelector(selector) {
13 function toggleCheckboxesBySelector(selector) {
14 boxes = $$(selector);
14 boxes = $$(selector);
15 var all_checked = true;
15 var all_checked = true;
16 for (i = 0; i < boxes.length; i++) { if (boxes[i].checked == false) { all_checked = false; } }
16 for (i = 0; i < boxes.length; i++) { if (boxes[i].checked == false) { all_checked = false; } }
17 for (i = 0; i < boxes.length; i++) { boxes[i].checked = !all_checked; }
17 for (i = 0; i < boxes.length; i++) { boxes[i].checked = !all_checked; }
18 }
18 }
19
19
20 function showAndScrollTo(id, focus) {
20 function showAndScrollTo(id, focus) {
21 Element.show(id);
21 Element.show(id);
22 if (focus!=null) { Form.Element.focus(focus); }
22 if (focus!=null) { Form.Element.focus(focus); }
23 Element.scrollTo(id);
23 Element.scrollTo(id);
24 }
24 }
25
25
26 var fileFieldCount = 1;
26 var fileFieldCount = 1;
27
27
28 function addFileField() {
28 function addFileField() {
29 if (fileFieldCount >= 10) return false
29 if (fileFieldCount >= 10) return false
30 fileFieldCount++;
30 fileFieldCount++;
31 var f = document.createElement("input");
31 var f = document.createElement("input");
32 f.type = "file";
32 f.type = "file";
33 f.name = "attachments[" + fileFieldCount + "][file]";
33 f.name = "attachments[" + fileFieldCount + "][file]";
34 f.size = 30;
34 f.size = 30;
35 var d = document.createElement("input");
35 var d = document.createElement("input");
36 d.type = "text";
36 d.type = "text";
37 d.name = "attachments[" + fileFieldCount + "][description]";
37 d.name = "attachments[" + fileFieldCount + "][description]";
38 d.size = 60;
38 d.size = 60;
39
39
40 p = document.getElementById("attachments_fields");
40 p = document.getElementById("attachments_fields");
41 p.appendChild(document.createElement("br"));
41 p.appendChild(document.createElement("br"));
42 p.appendChild(f);
42 p.appendChild(f);
43 p.appendChild(d);
43 p.appendChild(d);
44 }
44 }
45
45
46 function showTab(name) {
46 function showTab(name) {
47 var f = $$('div#content .tab-content');
47 var f = $$('div#content .tab-content');
48 for(var i=0; i<f.length; i++){
48 for(var i=0; i<f.length; i++){
49 Element.hide(f[i]);
49 Element.hide(f[i]);
50 }
50 }
51 var f = $$('div.tabs a');
51 var f = $$('div.tabs a');
52 for(var i=0; i<f.length; i++){
52 for(var i=0; i<f.length; i++){
53 Element.removeClassName(f[i], "selected");
53 Element.removeClassName(f[i], "selected");
54 }
54 }
55 Element.show('tab-content-' + name);
55 Element.show('tab-content-' + name);
56 Element.addClassName('tab-' + name, "selected");
56 Element.addClassName('tab-' + name, "selected");
57 return false;
57 return false;
58 }
58 }
59
59
60 function setPredecessorFieldsVisibility() {
60 function setPredecessorFieldsVisibility() {
61 relationType = $('relation_relation_type');
61 relationType = $('relation_relation_type');
62 if (relationType && relationType.value == "precedes") {
62 if (relationType && relationType.value == "precedes") {
63 Element.show('predecessor_fields');
63 Element.show('predecessor_fields');
64 } else {
64 } else {
65 Element.hide('predecessor_fields');
65 Element.hide('predecessor_fields');
66 }
66 }
67 }
67 }
68
68
69 function promptToRemote(text, param, url) {
69 function promptToRemote(text, param, url) {
70 value = prompt(text + ':');
70 value = prompt(text + ':');
71 if (value) {
71 if (value) {
72 new Ajax.Request(url + '?' + param + '=' + encodeURIComponent(value), {asynchronous:true, evalScripts:true});
72 var sep = (url.indexOf('?') < 0 ? '?' : '&' )
73 new Ajax.Request(url + sep + param + '=' + encodeURIComponent(value), {asynchronous:true, evalScripts:true});
73 return false;
74 return false;
74 }
75 }
75 }
76 }
76
77
77 function collapseScmEntry(id) {
78 function collapseScmEntry(id) {
78 var els = document.getElementsByClassName(id, 'browser');
79 var els = document.getElementsByClassName(id, 'browser');
79 for (var i = 0; i < els.length; i++) {
80 for (var i = 0; i < els.length; i++) {
80 if (els[i].hasClassName('open')) {
81 if (els[i].hasClassName('open')) {
81 collapseScmEntry(els[i].id);
82 collapseScmEntry(els[i].id);
82 }
83 }
83 Element.hide(els[i]);
84 Element.hide(els[i]);
84 }
85 }
85 $(id).removeClassName('open');
86 $(id).removeClassName('open');
86 }
87 }
87
88
88 function expandScmEntry(id) {
89 function expandScmEntry(id) {
89 var els = document.getElementsByClassName(id, 'browser');
90 var els = document.getElementsByClassName(id, 'browser');
90 for (var i = 0; i < els.length; i++) {
91 for (var i = 0; i < els.length; i++) {
91 Element.show(els[i]);
92 Element.show(els[i]);
92 if (els[i].hasClassName('loaded') && !els[i].hasClassName('collapsed')) {
93 if (els[i].hasClassName('loaded') && !els[i].hasClassName('collapsed')) {
93 expandScmEntry(els[i].id);
94 expandScmEntry(els[i].id);
94 }
95 }
95 }
96 }
96 $(id).addClassName('open');
97 $(id).addClassName('open');
97 }
98 }
98
99
99 function scmEntryClick(id) {
100 function scmEntryClick(id) {
100 el = $(id);
101 el = $(id);
101 if (el.hasClassName('open')) {
102 if (el.hasClassName('open')) {
102 collapseScmEntry(id);
103 collapseScmEntry(id);
103 el.addClassName('collapsed');
104 el.addClassName('collapsed');
104 return false;
105 return false;
105 } else if (el.hasClassName('loaded')) {
106 } else if (el.hasClassName('loaded')) {
106 expandScmEntry(id);
107 expandScmEntry(id);
107 el.removeClassName('collapsed');
108 el.removeClassName('collapsed');
108 return false;
109 return false;
109 }
110 }
110 if (el.hasClassName('loading')) {
111 if (el.hasClassName('loading')) {
111 return false;
112 return false;
112 }
113 }
113 el.addClassName('loading');
114 el.addClassName('loading');
114 return true;
115 return true;
115 }
116 }
116
117
117 function scmEntryLoaded(id) {
118 function scmEntryLoaded(id) {
118 Element.addClassName(id, 'open');
119 Element.addClassName(id, 'open');
119 Element.addClassName(id, 'loaded');
120 Element.addClassName(id, 'loaded');
120 Element.removeClassName(id, 'loading');
121 Element.removeClassName(id, 'loading');
121 }
122 }
122
123
123 function randomKey(size) {
124 function randomKey(size) {
124 var chars = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z');
125 var chars = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z');
125 var key = '';
126 var key = '';
126 for (i = 0; i < size; i++) {
127 for (i = 0; i < size; i++) {
127 key += chars[Math.floor(Math.random() * chars.length)];
128 key += chars[Math.floor(Math.random() * chars.length)];
128 }
129 }
129 return key;
130 return key;
130 }
131 }
131
132
132 /* shows and hides ajax indicator */
133 /* shows and hides ajax indicator */
133 Ajax.Responders.register({
134 Ajax.Responders.register({
134 onCreate: function(){
135 onCreate: function(){
135 if ($('ajax-indicator') && Ajax.activeRequestCount > 0) {
136 if ($('ajax-indicator') && Ajax.activeRequestCount > 0) {
136 Element.show('ajax-indicator');
137 Element.show('ajax-indicator');
137 }
138 }
138 },
139 },
139 onComplete: function(){
140 onComplete: function(){
140 if ($('ajax-indicator') && Ajax.activeRequestCount == 0) {
141 if ($('ajax-indicator') && Ajax.activeRequestCount == 0) {
141 Element.hide('ajax-indicator');
142 Element.hide('ajax-indicator');
142 }
143 }
143 }
144 }
144 });
145 });
General Comments 0
You need to be logged in to leave comments. Login now