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