@@ -101,12 +101,11 class IssuesController < ApplicationController | |||||
101 | end |
|
101 | end | |
102 |
|
102 | |||
103 | def add_attachment |
|
103 | def add_attachment | |
104 | # Save the attachment |
|
104 | # Save the attachments | |
105 |
|
|
105 | params[:attachments].each { |a| | |
106 |
@attachment = @issue.attachments.build( |
|
106 | @attachment = @issue.attachments.build(:file => a, :author => self.logged_in_user) unless a.size == 0 | |
107 | @attachment.author_id = self.logged_in_user.id if self.logged_in_user |
|
|||
108 | @attachment.save |
|
107 | @attachment.save | |
109 | end |
|
108 | } if params[:attachments] and params[:attachments].is_a? Array | |
110 | redirect_to :action => 'show', :id => @issue |
|
109 | redirect_to :action => 'show', :id => @issue | |
111 | end |
|
110 | end | |
112 |
|
111 |
@@ -187,11 +187,10 class ProjectsController < ApplicationController | |||||
187 | else |
|
187 | else | |
188 | @issue.attributes = params[:issue] |
|
188 | @issue.attributes = params[:issue] | |
189 | @issue.author_id = self.logged_in_user.id if self.logged_in_user |
|
189 | @issue.author_id = self.logged_in_user.id if self.logged_in_user | |
190 | # Create the document if a file was sent |
|
190 | # Multiple file upload | |
191 |
|
|
191 | params[:attachments].each { |a| | |
192 | @attachment = @issue.attachments.build(params[:attachment]) |
|
192 | @attachment = @issue.attachments.build(:file => a, :author => self.logged_in_user) unless a.size == 0 | |
193 | @attachment.author_id = self.logged_in_user.id if self.logged_in_user |
|
193 | } if params[:attachments] and params[:attachments].is_a? Array | |
194 | end |
|
|||
195 | @custom_values = @project.custom_fields_for_issues(@tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue, :value => params["custom_fields"][x.id.to_s]) } |
|
194 | @custom_values = @project.custom_fields_for_issues(@tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue, :value => params["custom_fields"][x.id.to_s]) } | |
196 | @issue.custom_values = @custom_values |
|
195 | @issue.custom_values = @custom_values | |
197 | if @issue.save |
|
196 | if @issue.save |
@@ -77,18 +77,6 end %> | |||||
77 | </p> |
|
77 | </p> | |
78 | </div> |
|
78 | </div> | |
79 |
|
79 | |||
80 | <% if authorize_for('issues', 'add_note') %> |
|
|||
81 | <div class="box"> |
|
|||
82 | <h3><%= l(:label_add_note) %></h3> |
|
|||
83 | <%= start_form_tag ({:controller => 'issues', :action => 'add_note', :id => @issue}, :class => "tabular" ) %> |
|
|||
84 | <p><label for="history_notes"><%=l(:field_notes)%></label> |
|
|||
85 | <%= text_area 'history', 'notes', :cols => 60, :rows => 10 %></p> |
|
|||
86 | <%= submit_tag l(:button_add) %> |
|
|||
87 | <%= end_form_tag %> |
|
|||
88 | </div> |
|
|||
89 | <% end %> |
|
|||
90 |
|
||||
91 | <div class="splitcontentleft"> |
|
|||
92 | <div class="box"> |
|
80 | <div class="box"> | |
93 | <h3><%=l(:label_history)%></h3> |
|
81 | <h3><%=l(:label_history)%></h3> | |
94 | <table width="100%"> |
|
82 | <table width="100%"> | |
@@ -104,9 +92,7 end %> | |||||
104 | <% end %> |
|
92 | <% end %> | |
105 | </table> |
|
93 | </table> | |
106 | </div> |
|
94 | </div> | |
107 | </div> |
|
|||
108 |
|
95 | |||
109 | <div class="splitcontentright"> |
|
|||
110 | <div class="box"> |
|
96 | <div class="box"> | |
111 | <h3><%=l(:label_attachment_plural)%></h3> |
|
97 | <h3><%=l(:label_attachment_plural)%></h3> | |
112 | <table width="100%"> |
|
98 | <table width="100%"> | |
@@ -127,11 +113,22 end %> | |||||
127 | </table> |
|
113 | </table> | |
128 | <br /> |
|
114 | <br /> | |
129 | <% if authorize_for('issues', 'add_attachment') %> |
|
115 | <% if authorize_for('issues', 'add_attachment') %> | |
130 | <%= start_form_tag ({ :controller => 'issues', :action => 'add_attachment', :id => @issue }, :multipart => true) %> |
|
116 | <%= start_form_tag ({ :controller => 'issues', :action => 'add_attachment', :id => @issue }, :multipart => true, :class => "tabular") %> | |
131 | <%=l(:label_attachment_new)%>: <%= file_field 'attachment', 'file' %> |
|
117 | <p id="attachments_p"><label><%=l(:label_attachment_new)%> | |
|
118 | <%= link_to_function image_tag('add', :align => "top"), "addFileField()" %></label> | |||
|
119 | <%= file_field_tag 'attachments[]', :size => 30 %></p> | |||
132 | <%= submit_tag l(:button_add) %> |
|
120 | <%= submit_tag l(:button_add) %> | |
133 | <%= end_form_tag %> |
|
121 | <%= end_form_tag %> | |
134 | <% end %> |
|
122 | <% end %> | |
135 | </div> |
|
123 | </div> | |
136 | </div> |
|
|||
137 |
|
124 | |||
|
125 | <% if authorize_for('issues', 'add_note') %> | |||
|
126 | <div class="box"> | |||
|
127 | <h3><%= l(:label_add_note) %></h3> | |||
|
128 | <%= start_form_tag ({:controller => 'issues', :action => 'add_note', :id => @issue}, :class => "tabular" ) %> | |||
|
129 | <p><label for="history_notes"><%=l(:field_notes)%></label> | |||
|
130 | <%= text_area 'history', 'notes', :cols => 60, :rows => 10 %></p> | |||
|
131 | <%= submit_tag l(:button_add) %> | |||
|
132 | <%= end_form_tag %> | |||
|
133 | </div> | |||
|
134 | <% end %> |
@@ -17,8 +17,9 | |||||
17 | <p><%= custom_field_tag_with_label @custom_value %></p> |
|
17 | <p><%= custom_field_tag_with_label @custom_value %></p> | |
18 | <% end %> |
|
18 | <% end %> | |
19 |
|
19 | |||
20 |
<p><label for="attachment_file"><%=l(:label_attachment)%> |
|
20 | <p id="attachments_p"><label for="attachment_file"><%=l(:label_attachment)%> | |
21 | <%= file_field 'attachment', 'file' %></p> |
|
21 | <%= link_to_function image_tag('add', :align => "top"), "addFileField()" %></label> | |
|
22 | <%= file_field_tag 'attachments[]', :size => 30 %></p> | |||
22 | <!--[eoform:issue]--> |
|
23 | <!--[eoform:issue]--> | |
23 | </div> |
|
24 | </div> | |
24 |
|
25 |
@@ -5,4 +5,15 function checkAll (id, checked) { | |||||
5 | el.elements[i].checked = checked; |
|
5 | el.elements[i].checked = checked; | |
6 | } |
|
6 | } | |
7 | } |
|
7 | } | |
|
8 | } | |||
|
9 | ||||
|
10 | function addFileField() { | |||
|
11 | var f = document.createElement("input"); | |||
|
12 | f.type = "file"; | |||
|
13 | f.name = "attachments[]"; | |||
|
14 | f.size = 30; | |||
|
15 | ||||
|
16 | p = document.getElementById("attachments_p"); | |||
|
17 | p.appendChild(document.createElement("br")); | |||
|
18 | p.appendChild(f); | |||
8 | } No newline at end of file |
|
19 | } |
General Comments 0
You need to be logged in to leave comments.
Login now