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

View File

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