Signed-off-by: alan <547533434@qq.com>

This commit is contained in:
alan 2015-05-11 17:23:53 +08:00
parent 79c0c6f551
commit 8e61136d7f
2 changed files with 52 additions and 18 deletions

View File

@ -93,7 +93,15 @@ class MessagesController < ApplicationController
end
call_hook(:controller_messages_new_after_save, { :params => params, :message => @message})
render_attachment_warning_if_needed(@message)
redirect_to board_message_url(@board, @message)
if params[:is_board]
if @project
redirect_to project_boards_path(@project)
elsif @course
redirect_to course_boards_path(@course)
end
else
redirect_to board_message_url(@board, @message)
end
else
layout_file = @project ? 'base_projects' : 'base_courses'
render :action => 'new', :layout => layout_file
@ -132,7 +140,15 @@ class MessagesController < ApplicationController
else
#render file: 'messages#show', layout: 'base_courses'
end
redirect_to board_message_url(@board, @topic, :r => @reply)
if params[:is_board]
if @project
redirect_to project_boards_path(@project)
elsif @course
redirect_to course_boards_path(@course)
end
else
redirect_to board_message_url(@board, @topic, :r => @reply)
end
end
@ -150,7 +166,15 @@ class MessagesController < ApplicationController
render_attachment_warning_if_needed(@message)
flash[:notice] = l(:notice_successful_update)
@message.reload
redirect_to board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id))
if params[:is_board]
if @project
redirect_to project_boards_path(@project)
elsif @course
redirect_to course_boards_path(@course)
end
else
redirect_to board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id))
end
elsif request.get?
respond_to do |format|
format.html {
@ -172,16 +196,20 @@ class MessagesController < ApplicationController
@message.destroy
# modify by nwb
if @project
if @message.parent
redirect_to board_message_url(@board, @message.parent, :r => r)
else
if params[:is_board]
redirect_to project_boards_url(@project)
else
redirect_to board_message_url(@board, @topic, :r => @reply)
end
elsif @course
if @message.parent
redirect_to board_message_url(@board, @message.parent, :r => r)
if params[:is_board]
redirect_to course_boards_url(@course)
else
redirect_to course_board_url(@course, @board)
if @message.parent
redirect_to board_message_url(@board, @message.parent, :r => r)
else
redirect_to course_board_url(@course, @board)
end
end
end
end

View File

@ -38,7 +38,7 @@
<% author = topic.author.to_s + "" %>
<%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %>
<p class="talkmain_tit fl fb">&nbsp;&nbsp;<%= h(topic.subject) %></p>
<p class="talkmain_tit fl fb break_word">&nbsp;&nbsp;<%= h(topic.subject) %></p>
<% if topic.course_editable_by?(User.current) %>
<a href="javascript:void(0)" onclick="show_newtalk1('#about_newtalk<%= topic.id%>');" style="color: #426e9a;float: left;
margin-left: 20px;"><%= l(:button_edit) %></a>
@ -56,24 +56,30 @@
) if topic.destroyable_by?(User.current) %>
<br/>
<% if topic.content.size > 300 %>
<p>
<div id="contentmessage<%=topic.id %>" class="project_board_content">
<div class="cl"></div>
<p id="contentmessage<%=topic.id %>" class="project_board_content break_word">
<%= topic.content %>
</div>
<label id="expend_more_information<%= topic.id%>" onclick="show_more_reply('#contentmessage<%=topic.id %>','#expend_more_information<%= topic.id%>','#arrow<%=topic.id%>');" value="show_more">[展开]</label>
</p>
<% if topic.content.size > 300 %>
<p>
<label id="expend_more_information<%= topic.id%>" onclick="show_more_reply('#contentmessage<%=topic.id %>','#expend_more_information<%= topic.id%>','#arrow<%=topic.id%>');" value="show_more">[展开]</label>
<span class="g-arr-down">
<img id="arrow<%=topic.id%>" src="/images/jiantou.jpg" width="12" height="6" />
</span>
</p>
<% end %>
</p>
<% end %>
<%= link_to_attachments_course topic, :author => false %>
<%= l(:label_activity_time)%>&nbsp;&nbsp;<%= format_time topic.created_on %>
</div>
<%= toggle_link l(:button_reply), "reply" + topic.id.to_s, :focus => 'message_content',:class => ' c_dblue fr' %>
<div class="cl"></div>
</div><!--讨论主类容 end-->
<div class="talk_new ml15 mb10" id="about_newtalk<%=topic.id%>" style="display: none">
<ul>