完成项目讨论区的拉宽工作

This commit is contained in:
huang 2016-10-25 14:47:05 +08:00
parent 21d34bb4d4
commit a0ff6a0cb1
7 changed files with 41 additions and 20 deletions

View File

@ -73,29 +73,20 @@ class BoardsController < ApplicationController
def show
# 顶部导航
@project_menu_type = 3
# 讨论区消息状态更新(已读和未读)
@order, @b_sort,@type = params[:order] || 1, params[:sort] || 1, params[:type] || 1
@order, @b_sort,@type = params[:order] || 1, params[:sort] || 1, params[:type] || 1
#确定 sort_type 1升序 2 降序
if @order.to_i == @type.to_i
@b_sort = @b_sort.to_i == 1 ? 2 : 1
else
@b_sort = 2
end
sort_name = "updated_on"
sort_type = @b_sort == 1 ? "asc" : "desc"
# 讨论区消息状态更新(已读和未读)
if @project
ForgeMessage.where("user_id =? and project_id =? and viewed =?", User.current.id, @project.id, 0).update_all(:viewed => true)
# 更新@消息为已读
# 注释掉这句是因为和上面的方法代码重复,一个类型的消息,已经更新就不需要再更新
# @project.boards.each do |board|
# board.messages.each do |m|
# User.current.at_messages.unviewed('Message', m.id).each {|x| x.viewed!}
# end
# end
elsif @course
CourseMessage.where("user_id =? and course_id =? and viewed =?", User.current.id, @course.id, 0).update_all(:viewed => true)
end

View File

@ -37,6 +37,9 @@ class MessagesController < ApplicationController
# Show a topic and its replies
def show
# 顶部导航
@project_menu_type = 3
@isReply = true
# page = params[:page]
# # Find the page of the requested reply

View File

@ -0,0 +1,23 @@
<div class="ReplyToMessageContainer borderBottomNone" id="reply_to_message_<%= reply.id%>" style="width:895px;">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
<div class="ReplyToMessageInputContainer mb10" style="width:840px;">
<% if User.current.logged? %>
<div nhname='new_message_<%= reply.id%>'>
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :method => "post", :id => 'new_form' do |f| %>
<%= hidden_field_tag 'parent_id', params[:parent_id], :value => reply.id %>
<%= hidden_field_tag 'reply_id', params[:reply_id], :value => reply.author.id %>
<%= hidden_field_tag 'activity_id',params[:activity_id],:value =>@topic.id %>
<div nhname='toolbar_container_<%= reply.id%>'></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="content"></textarea>
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= reply.id%>'></p>
<% end%>
</div>
<% else %>
<%= render :partial => "users/show_unlogged" %>
<% end %>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>

View File

@ -10,7 +10,7 @@
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
</div>
<div class="reply-content ml15" onmouseover="$('#delete_reply_<%=reply.id %>').show();" onmouseout="$('#delete_reply_<%=reply.id %>').hide();">
<%= render :partial => 'users/message_contents', :locals => {:comment => reply}%>
<%= render :partial => 'projects/project_message_contents', :locals => {:comment => reply}%>
<div class="homepagePostReplyContent upload_img break_word table_maxWidth" id="reply_message_description_<%= reply.id %>">
<%= reply.content.html_safe%>
@ -24,7 +24,7 @@
<span style="position: relative" class="fr mr20">
<%= link_to(
l(:button_reply),
{:action => 'quote', :id => reply},
{:action => 'quote', :id => reply, :is_project => true},
:remote => true,
:method => 'get',
:title => l(:button_reply)) if !@topic.locked? && authorize_for('messages', 'reply') %>

View File

@ -1,7 +1,6 @@
<div class="ReplyToMessageContainer borderBottomNone" id="reply_to_message_<%= reply.id%>" style="width:895px;">
<div class="ReplyToMessageContainer borderBottomNone" id="reply_to_message_<%= reply.id%>">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
<div class="ReplyToMessageInputContainer mb10" style="width:840px;">
<div class="ReplyToMessageInputContainer mb10">
<% if User.current.logged? %>
<div nhname='new_message_<%= reply.id%>'>
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :method => "post", :id => 'new_form' do |f| %>

View File

@ -1,5 +1,10 @@
if($("#reply_message_<%= @message.id%>").length > 0) {
<% if params[:is_project] %>
$("#reply_message_<%= @message.id%>").replaceWith("<%= escape_javascript(render :partial => 'messages/project_rereply_message', :locals => {:reply => @message}) %>");
<% else %>
$("#reply_message_<%= @message.id%>").replaceWith("<%= escape_javascript(render :partial => 'reply_message', :locals => {:reply => @message}) %>");
<% end %>
$(function(){
/*$('#reply_subject').val("<%#= raw escape_javascript(@subject) %>");
$('#quote_quote').val("<%#= raw escape_javascript(@temp.content.html_safe) %>");*/

View File

@ -8,21 +8,21 @@
<% length = parents_rely.length %>
<div id="comment_reply_<%=comment.id %>">
<% if length <= 3 %>
<%=render :partial => 'projects/project_journal_comment_reply', :locals => {:comment => comment.parent} %>
<%=render :partial => 'users/journal_comment_reply', :locals => {:comment => comment.parent} %>
<% else %>
<div class="orig_cont clearfix">
<div class="orig_cont clearfix">
<div>
<%=render :partial => 'projects/project_journal_comment_reply', :locals => {:comment => parents_rely[length - 1]} %>
<%=render :partial => 'users/journal_comment_reply', :locals => {:comment => parents_rely[length - 1]} %>
</div>
<%=render :partial => 'projects/project_comment_reply_detail', :locals => {:comment => parents_rely[length - 2]} %>
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[length - 2]} %>
</div>
<div class="orig_cont_hide clearfix">
<span class="orig_icon" >&darr; </span>
<span class="orig_icon" style="display:none;" > &uarr;</span>
<%= link_to '点击展开隐藏楼层', show_all_replies_users_path(:comment => comment, :type => comment.class),:remote=>true %>
</div>
<%=render :partial => 'projects/project_comment_reply_detail', :locals => {:comment => parents_rely[0]} %>
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[0]} %>
</div>
<% end %>
</div>