From b475cd51e7d9ec28d1873ac51491b46b4bdf4957 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 24 Nov 2014 18:23:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BD=9C=E4=B8=9A=E7=95=99?= =?UTF-8?q?=E8=A8=80=E5=AE=9E=E5=90=8D=E5=9B=9E=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/words_controller.rb | 1 + .../homework_attach/_journal_reply_items.html.erb | 10 ++++++++-- app/views/homework_attach/add_jour_reply.js.erb | 2 +- app/views/words/_journal_reply_items.html.erb | 4 ++-- app/views/words/_new_respond.html.erb | 4 ++-- app/views/words/create_reply.js.erb | 2 +- 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 89fa0e1dc..4e7768785 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -47,6 +47,7 @@ class WordsController < ApplicationController # 删除留言功能要调用destroy,也记得在destroy.js中修改 # deny api. api useless + @show_real_name = params[:show_real_name] || false parent_id = params[:reference_id] author_id = User.current.id reply_user_id = params[:reference_user_id] diff --git a/app/views/homework_attach/_journal_reply_items.html.erb b/app/views/homework_attach/_journal_reply_items.html.erb index 726efb0c1..dd09bd84f 100644 --- a/app/views/homework_attach/_journal_reply_items.html.erb +++ b/app/views/homework_attach/_journal_reply_items.html.erb @@ -1,3 +1,4 @@ +<% show_real_name ||= false %> <% reply_allow = JournalsForMessage.create_by_user? User.current %> <% ids_r = 'reply_respond_form_'+ reply.id.to_s %>
@@ -12,8 +13,13 @@ <% id = 'project_respond_form_'+ reply.id.to_s %> <%= link_to reply.user.name, user_path(reply.user) %> 回复 - <% if show_name %> - <%= link_to reply.at_user.name,user_path(reply.at_user) %> + <% parent_jour = JournalsForMessage.find reply.m_reply_id %> + <% if show_name && parent_jour %> + <% if show_real_name%> + <%= link_to parent_jour.user.lastname+parent_jour.user.firstname, user_path(parent_jour.user) %> + <% else %> + <%= link_to parent_jour.user.name, user_path(parent_jour.user) %> + <% end %> <% else %> <%= l(:label_anonymous) %> <% end %> diff --git a/app/views/homework_attach/add_jour_reply.js.erb b/app/views/homework_attach/add_jour_reply.js.erb index 564229d81..34cec1cca 100644 --- a/app/views/homework_attach/add_jour_reply.js.erb +++ b/app/views/homework_attach/add_jour_reply.js.erb @@ -1,7 +1,7 @@ <% if @save_succ %> var pre_append = $('<%= j( render :partial => "journal_reply_items", - :locals => {:reply => @jfm, :journal => @jfm.parent, :m_reply_id => @jfm} + :locals => {:reply => @jfm, :journal => @jfm.parent, :m_reply_id => @jfm, :show_real_name => true} ) %>').hide(); $('#journal_reply_ul_<%=@jfm.m_parent_id%>').append(pre_append); pre_append.fadeIn(600); diff --git a/app/views/words/_journal_reply_items.html.erb b/app/views/words/_journal_reply_items.html.erb index ebca999a6..76359794c 100644 --- a/app/views/words/_journal_reply_items.html.erb +++ b/app/views/words/_journal_reply_items.html.erb @@ -20,7 +20,7 @@ <% parent_jour = JournalsForMessage.find reply.m_reply_id %> <% if show_name && parent_jour %> <% if show_real_name%> - <%= link_to parent_jour.user.lastname+reply.user.firstname, user_path(parent_jour.user) %> + <%= link_to parent_jour.user.lastname+parent_jour.user.firstname, user_path(parent_jour.user) %> <% else %> <%= link_to parent_jour.user.name, user_path(parent_jour.user) %> <% end %> @@ -51,7 +51,7 @@
<% if reply_allow %> - <%= render :partial => "words/new_respond", :locals => {:journal => journal, :m_reply_id => m_reply_id,:show_name => show_name} %> + <%= render :partial => "words/new_respond", :locals => {:journal => journal, :m_reply_id => m_reply_id,:show_name => show_name, :show_real_name => show_real_name} %> <% end %>
diff --git a/app/views/words/_new_respond.html.erb b/app/views/words/_new_respond.html.erb index 5d615578d..a4cad1a38 100644 --- a/app/views/words/_new_respond.html.erb +++ b/app/views/words/_new_respond.html.erb @@ -1,5 +1,5 @@ - -<%= form_tag(words_create_reply_path, :remote => true) do %> +<% show_real_name ||= false%> +<%= form_tag(words_create_reply_path(:show_real_name=>show_real_name), :remote => true) do %> <%= text_area_tag 'user_notes', "", :class => 'noline', :style => "resize: none;", :rows => 4, :placeholder => l(:label_projects_feedback_respond_content), diff --git a/app/views/words/create_reply.js.erb b/app/views/words/create_reply.js.erb index eeb4e3ef6..04cbee26e 100644 --- a/app/views/words/create_reply.js.erb +++ b/app/views/words/create_reply.js.erb @@ -1,7 +1,7 @@ <% if @save_succ %> var pre_append = $('<%= j( render :partial => "words/journal_reply_items", - :locals => {:reply => @jfm, :journal => @jfm.parent, :m_reply_id => @jfm,:show_name => @show_name} + :locals => {:reply => @jfm, :journal => @jfm.parent, :m_reply_id => @jfm,:show_name => @show_name, :show_real_name=>@show_real_name} ) %>').hide(); $('#journal_reply_ul_<%=@jfm.m_parent_id%>').append(pre_append); pre_append.fadeIn(600);