diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 738077fd7..8e7e883ff 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -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 diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index f93599ee5..0c7eb570f 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -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 diff --git a/app/views/messages/_project_rereply_message.html.erb b/app/views/messages/_project_rereply_message.html.erb new file mode 100644 index 000000000..d4bb74e4c --- /dev/null +++ b/app/views/messages/_project_rereply_message.html.erb @@ -0,0 +1,23 @@ +
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
+
+ <% if User.current.logged? %> +
+ <%= 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 %> +
+ + +
+

+ <% end%> +
+ <% else %> + <%= render :partial => "users/show_unlogged" %> + <% end %> +
+
+
+
\ No newline at end of file diff --git a/app/views/messages/_project_show_replies.html.erb b/app/views/messages/_project_show_replies.html.erb index 4bd5c2dc7..8a4b615da 100644 --- a/app/views/messages/_project_show_replies.html.erb +++ b/app/views/messages/_project_show_replies.html.erb @@ -10,7 +10,7 @@ <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
- <%= render :partial => 'users/message_contents', :locals => {:comment => reply}%> + <%= render :partial => 'projects/project_message_contents', :locals => {:comment => reply}%>
<%= reply.content.html_safe%> @@ -24,7 +24,7 @@ <%= 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') %> diff --git a/app/views/messages/_reply_message.html.erb b/app/views/messages/_reply_message.html.erb index 0ab0be50f..ccdad974f 100644 --- a/app/views/messages/_reply_message.html.erb +++ b/app/views/messages/_reply_message.html.erb @@ -1,7 +1,6 @@ - -
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
-
+
<% if User.current.logged? %>
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :method => "post", :id => 'new_form' do |f| %> diff --git a/app/views/messages/quote.js.erb b/app/views/messages/quote.js.erb index 9bd723157..aa429201d 100644 --- a/app/views/messages/quote.js.erb +++ b/app/views/messages/quote.js.erb @@ -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) %>");*/ diff --git a/app/views/users/_message_contents.html.erb b/app/views/users/_message_contents.html.erb index a4584f825..365914908 100644 --- a/app/views/users/_message_contents.html.erb +++ b/app/views/users/_message_contents.html.erb @@ -8,21 +8,21 @@ <% length = parents_rely.length %>
<% 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 %>
- <%=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]} %>
- <%=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]} %>
<%= link_to '点击展开隐藏楼层', show_all_replies_users_path(:comment => comment, :type => comment.class),:remote=>true %>
- <%=render :partial => 'projects/project_comment_reply_detail', :locals => {:comment => parents_rely[0]} %> + <%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[0]} %>
<% end %>