##// END OF EJS Templates
Forums: attachments can now be added to replies....
Jean-Philippe Lang -
r910:7704e2d9191d
parent child
Show More
@@ -35,8 +35,7 class MessagesController < ApplicationController
35 35 @message.board = @board
36 36 if request.post? && @message.save
37 37 params[:attachments].each { |file|
38 next unless file.size > 0
39 Attachment.create(:container => @message, :file => file, :author => User.current)
38 Attachment.create(:container => @message, :file => file, :author => User.current) if file.size > 0
40 39 } if params[:attachments] and params[:attachments].is_a? Array
41 40 redirect_to :action => 'show', :id => @message
42 41 end
@@ -47,6 +46,11 class MessagesController < ApplicationController
47 46 @reply.author = User.current
48 47 @reply.board = @board
49 48 @message.children << @reply
49 if !@reply.new_record?
50 params[:attachments].each { |file|
51 Attachment.create(:container => @reply, :file => file, :author => User.current) if file.size > 0
52 } if params[:attachments] and params[:attachments].is_a? Array
53 end
50 54 redirect_to :action => 'show', :id => @message
51 55 end
52 56
@@ -5,10 +5,11
5 5 <p><label><%= l(:field_subject) %></label><br />
6 6 <%= f.text_field :subject, :required => true, :size => 120 %></p>
7 7
8 <p><%= f.text_area :content, :required => true, :cols => 80, :rows => 15, :class => 'wiki-edit' %></p>
8 <p><%= f.text_area :content, :required => true, :cols => 80, :rows => 15, :class => 'wiki-edit', :id => 'message_content' %></p>
9 9 <%= wikitoolbar_for 'message_content' %>
10 10 <!--[eoform:message]-->
11 11
12 12 <span class="tabular">
13 13 <%= render :partial => 'attachments/form' %>
14 </span>
14 15 </div>
@@ -1,27 +1,30
1 1 <h2><%= link_to h(@board.name), :controller => 'boards', :action => 'show', :project_id => @project, :id => @board %> &#187; <%=h @message.subject %></h2>
2 2
3 <div class="message">
3 4 <p><span class="author"><%= authoring @message.created_on, @message.author %></span></p>
4 5 <div class="wiki">
5 6 <%= textilizable(@message.content, :attachments => @message.attachments) %>
6 7 </div>
7 8 <%= link_to_attachments @message.attachments, :no_author => true %>
9 </div>
8 10 <br />
9 11
12 <div class="message reply">
10 13 <h3 class="icon22 icon22-comment"><%= l(:label_reply_plural) %></h3>
11 14 <% @message.children.each do |message| %>
12 15 <a name="<%= "message-#{message.id}" %>"></a>
13 <h4><%=h message.subject %> - <%= message.author.name %>, <%= format_time(message.created_on) %></h4>
16 <h4><%=h message.subject %> - <%= authoring message.created_on, message.author %></h4>
14 17 <div class="wiki"><%= textilizable message.content %></div>
18 <%= link_to_attachments message.attachments, :no_author => true %>
15 19 <% end %>
20 </div>
16 21
17 22 <% if authorize_for('messages', 'reply') %>
18 <p><%= toggle_link l(:button_reply), "reply", :focus => "reply_content" %></p>
23 <p><%= toggle_link l(:button_reply), "reply", :focus => 'message_content' %></p>
19 24 <div id="reply" style="display:none;">
20 <%= error_messages_for 'message' %>
21 <% form_for :reply, @reply, :url => {:action => 'reply', :id => @message} do |f| %>
22 <p><%= f.text_field :subject, :required => true, :size => 60 %></p>
23 <p><%= f.text_area :content, :required => true, :cols => 80, :rows => 10 %></p>
24 <p><%= submit_tag l(:button_submit) %></p>
25 <% form_for :reply, @reply, :url => {:action => 'reply', :id => @message}, :html => {:multipart => true} do |f| %>
26 <%= render :partial => 'form', :locals => {:f => f} %>
27 <%= submit_tag l(:button_submit) %>
25 28 <% end %>
26 29 </div>
27 30 <% end %>
General Comments 0
You need to be logged in to leave comments. Login now