讨论区修改bug

Signed-off-by: alan <547533434@qq.com>
This commit is contained in:
alan 2015-05-08 13:04:25 +08:00
parent 07ca42b24d
commit 23ef975c23
5 changed files with 91 additions and 17 deletions

View File

@ -165,7 +165,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 {

View File

@ -29,17 +29,28 @@
<hr/>
</div>
<% end %>
<p class="c_dark mb5">讨论区共有<span class="c_orange"><%= @topic_count %></span>个帖子</p>
<% if @topics.any? %>
<% @topics.each do |topic| %>
<div class="talkmain_box" style="border:none; margin-bottom:0;">
<div class="talkmain_box" style="border:none; margin-bottom:0; border-bottom: 1px dashed #d9d9d9;">
<%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %>
<div class="talkmain_txt fl mt5">
<% author = topic.author.to_s + "" %>
<%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %>
<% if topic.course_editable_by?(User.current) %>
<a href="javascript:void(0)" onclick="show_newtalk1('#about_newtalk<%= topic.id%>');" style="color: #426e9a;
margin-left: 60px;"><%= l(:button_edit) %></a>
<% end %>
<%= link_to(
l(:button_delete),
{:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:class => 'talk_edit fr'
) if topic.destroyable_by?(User.current) %>
<p class="talkmain_tit fl fb">&nbsp;&nbsp;<%= h(topic.subject) %></p>
<% if topic.sticky? %>
<a href="javascript:void(0)" class="talk_up fr c_red"><%= l(:label_board_sticky)%></a>
<a href="javascript:void(0)" class="talk_up fr c_red" style="margin-right: 10px;"><%= l(:label_board_sticky)%></a>
<% end %>
@ -59,6 +70,11 @@
<div class="cl"></div>
</div><!--讨论主类容 end-->
<div class="talk_new ml15 mb10" id="about_newtalk<%=topic.id%>" style="display:<%= !@flag.nil? && @flag=='true' ? 'block' : 'none' %>;">
<ul>
<%= render :partial => 'edit',locals: {:topic => topic} %>
</ul>
</div>
<div class="talkWrapBox">
<% reply = Message.new(:subject => "RE: #{@message.subject}")%>
<% if !topic.locked? && authorize_for('messages', 'reply') %>

View File

@ -0,0 +1,42 @@
<% if topic.project %>
<%#= board_breadcrumb(@message) %>
<!--<h3><%#= avatar(@topic.author, :size => "24") %><span style = "width:100%;word-break:break-all;word-wrap: break-word;"><%#=h @topic.subject %></span></h3>-->
<div class="talk_new ml15">
<ul>
<%= form_for topic, { :as => :message,
:url => {:controller => 'messages',:action => 'edit', :is_board => 'true',:id => topic.id, :board_id => topic.board_id},
:html => {:multipart => true,
:id => 'message-form' + topic.id.to_s,
:method => :post}
} do |f| %>
<%= render :partial => 'form_project',
:locals => {:f => f, :replying => !topic.parent.nil?} %>
<a href="#" onclick="$('#message-form<%= topic.id%>').submit();"class="blue_btn fl c_white" ><%= l(:button_submit)%></a>
<%= link_to l(:button_cancel), board_message_url(topic.board, topic.root, :r => (topic.parent_id && topic.id)), :class => "blue_btn grey_btn fl c_white" %>
</ul>
</div>
<% end %>
<% elsif topic.course %>
<%#= course_board_breadcrumb(@message) %>
<div class="talk_new ml15">
<ul>
<%= form_for topic, {
:as => :message,
:url => {:controller => 'messages',:action => 'edit', :is_board => 'true',:id => topic.id, :board_id => topic.board_id},
:html => {:multipart => true,
:id => 'message-form' + topic.id.to_s,
:method => :post}
} do |f| %>
<%= render :partial => 'form_course',
:locals => {:f => f, :replying => !topic.parent.nil?} %>
<a href="javascript:void(0)" onclick="$('#message-form<%= topic.id%>').submit();"class="blue_btn fl c_white"><%= l(:button_submit)%></a>
<%= link_to l(:button_cancel), board_message_url(topic.board,topic.root, :r => (topic.parent_id &&topic.id)), :class => "blue_btn grey_btn fl c_white" %>
<% end %>
</ul>
</div>
<% end %>
<div id="preview" class="wiki"></div>

View File

@ -29,29 +29,28 @@
</div><!--talknew end-->
<!-- 帖子内容显示 -->
<p class="c_dark mb5">讨论区共有<span class="c_orange"><%= @topic_count %></span>个帖子</p>
<% if @topics.any? %>
<% @topics.each do |topic| %>
<div class="talkmain_box" style="border:none; margin-bottom:0;">
<div class="talkmain_box" style="border:none; margin-bottom:0; border-bottom: 1px dashed #d9d9d9;">
<%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %>
<div class="talkmain_txt fl mt5">
<% author = topic.author.to_s + "" %>
<%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %>
<%= link_to(
l(:button_edit),
{:action => 'edit', :id => topic},
:class => 'talk_edit fr'
) if @message.editable_by?(User.current) %>
<%= link_to(
<% if topic.editable_by?(User.current) %>
<a href="javascript:void(0)" onclick="show_newtalk1('#about_newtalk<%= topic.id%>');" style="color: #426e9a;
margin-left: 60px;"><%= l(:button_edit) %></a>
<% end %>
<%= link_to(
l(:button_delete),
{:action => 'destroy', :id => topic},
{:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:class => 'talk_edit fr'
) if @message.destroyable_by?(User.current) %>
) if topic.destroyable_by?(User.current) %>
<p class="talkmain_tit fl fb break_word">&nbsp;&nbsp;<%= h(topic.subject) %></p>
<% if topic.sticky? %>
<a href="javascript:void(0)" class="talk_up fr c_red"><%= l(:label_board_sticky)%></a>
<a href="javascript:void(0)" class="talk_up fr c_red" style="margin-right: 10px;"><%= l(:label_board_sticky)%></a>
<% end %>
<div class="cl"></div>
@ -74,6 +73,12 @@
<div class="cl"></div>
</div><!--讨论主类容 end-->
<div class="talk_new ml15 mb10" id="about_newtalk<%=topic.id%>" style="display:<%= !@flag.nil? && @flag=='true' ? 'block' : 'none' %>;">
<ul>
<%= render :partial => 'edit',locals: {:topic => topic} %>
</ul>
</div>
<div class="talkWrapBox">
<% reply = Message.new(:subject => "RE: #{@message.subject}")%>
<% if !topic.locked? && authorize_for('messages', 'reply') %>
@ -157,7 +162,7 @@
</ul>
</div>
<%if replies_all.first %>
<div class="talkWrapMsg"><a class=" ml258" id="showgithelp<%= topic.id%>" value="show_help" onclick ="showhelpAndScrollToMessage('talkWrapMsg<%= topic.id %>','#showgithelp<%= topic.id%>','<%=topic.replies_count%>'); " class="c_dblue lh23">展开回复(<%= topic.replies_count.to_s%>)</a></div>
<div class="talkWrapMsg"><a class=" c_blue ml258" id="showgithelp<%= topic.id%>" value="show_help" onclick ="showhelpAndScrollToMessage('talkWrapMsg<%= topic.id %>','#showgithelp<%= topic.id%>','<%=topic.replies_count%>'); " class="c_dblue lh23">展开回复(<%= topic.replies_count.to_s%>)</a></div>
<% end %>
<% end %>
</div>

View File

@ -31,7 +31,10 @@ function show_newtalk()
$("#about_newtalk").toggle();
}
function show_newtalk1(id)
{
$(id).toggle();
}
</script>
<% if @project %>
<%= render :partial => 'project_show', locals: {project: @project} %>