diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 645aadf1c..9352c4af4 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -35,8 +35,7 @@ class MessagesController < ApplicationController @message.board = @board if request.post? && @message.save params[:attachments].each { |file| - next unless file.size > 0 - Attachment.create(:container => @message, :file => file, :author => User.current) + Attachment.create(:container => @message, :file => file, :author => User.current) if file.size > 0 } if params[:attachments] and params[:attachments].is_a? Array redirect_to :action => 'show', :id => @message end @@ -47,6 +46,11 @@ class MessagesController < ApplicationController @reply.author = User.current @reply.board = @board @message.children << @reply + if !@reply.new_record? + params[:attachments].each { |file| + Attachment.create(:container => @reply, :file => file, :author => User.current) if file.size > 0 + } if params[:attachments] and params[:attachments].is_a? Array + end redirect_to :action => 'show', :id => @message end diff --git a/app/views/messages/_form.rhtml b/app/views/messages/_form.rhtml index e484baf2f..25d88cd44 100644 --- a/app/views/messages/_form.rhtml +++ b/app/views/messages/_form.rhtml @@ -5,10 +5,11 @@
<%= f.text_field :subject, :required => true, :size => 120 %>
<%= f.text_area :content, :required => true, :cols => 80, :rows => 15, :class => 'wiki-edit' %>
+<%= f.text_area :content, :required => true, :cols => 80, :rows => 15, :class => 'wiki-edit', :id => 'message_content' %>
<%= wikitoolbar_for 'message_content' %> <%= render :partial => 'attachments/form' %> + diff --git a/app/views/messages/show.rhtml b/app/views/messages/show.rhtml index 772f0653e..e39c09d50 100644 --- a/app/views/messages/show.rhtml +++ b/app/views/messages/show.rhtml @@ -1,27 +1,30 @@<%= toggle_link l(:button_reply), "reply", :focus => "reply_content" %>
+<%= toggle_link l(:button_reply), "reply", :focus => 'message_content' %>
<% end %>