1、回复匿名评论时显示出了名字bug。2、样式调整

This commit is contained in:
z9hang 2014-11-04 14:49:36 +08:00
parent 316c407a87
commit b506a961a1
10 changed files with 56 additions and 17 deletions

View File

@ -496,6 +496,26 @@ class HomeworkAttachController < ApplicationController
@totle_score = score_for_homework @homework
@teaher_score = teacher_score_for_homework @homework
stars_reates = @homework. rates(:quality)
is_student = is_cur_course_student @homework.bid.courses.first
is_teacher = is_course_teacher User.current,@homework.bid.courses.first
@has_evaluation = stars_reates.where("rater_id = ?",User.current).count > 0
@is_anonymous_comments = @homework.bid.comment_status == 1 #是否开启了匿评
if !User.current.member_of_course?(@homework.bid.courses.first)
@is_comprehensive_evaluation = 3 #留言
elsif is_student && @is_anonymous_comments && !@has_evaluation#是学生且开启了匿评且未进行评分
@is_comprehensive_evaluation = 2 #匿评
elsif is_student && @is_anonymous_comments && @has_evaluation #是学生且开启了匿评,但已评分
@is_comprehensive_evaluation = 3 #留言
elsif is_student && !@is_anonymous_comments #是学生未开启匿评
@is_comprehensive_evaluation = 3 #留言
elsif is_teacher
@is_comprehensive_evaluation = 1 #教师评论
else
@is_comprehensive_evaluation = 3
end
respond_to do |format|
format.js
end

View File

@ -56,6 +56,7 @@ class WordsController < ApplicationController
reply_user_id = params[:reference_user_id]
reply_id = params[:reference_message_id] # 暂时不实现
content = params[:user_notes]
@show_name = params[:show_name] == "true"
options = {:user_id => author_id,
:status => true,
:m_parent_id => parent_id,

View File

@ -62,12 +62,12 @@
<% ids = 'project_respond_form_'+ journal.id.to_s%>
<% if reply_allow %>
<div id='<%= ids %>' class="respond-form">
<%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal} %>
<%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal,:show_name => true} %>
</div>
<% end %>
<div style="clear: both;"></div>
<div>
<%= render :partial => "words/journal_reply", :locals => {:journal => journal } %>
<%= render :partial => "words/journal_reply", :locals => {:journal => journal,:show_name => true } %>
</div>
</li>
<% end %>

View File

@ -5,13 +5,18 @@
<%= link_to image_tag(url_to_avatar(jour.user)) , user_path(jour.user), :target =>"_blank" %>
<% else %>
<a><%= image_tag(url_to_avatar(nil))%></a>
<a><%= l(:label_anonymous) %></a>
<% end %>
</div>
<div class="ping_discon">
<div class="ping_distop">
<span><%= link_to jour.user, user_path(jour.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%></span>
<span style="color:#a6a6a6; margin-right:40px; margin-left:30px;"><%= format_time(jour.created_on) %></span>
<span>
<% if show_name %>
<%= link_to jour.user, user_path(jour.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%>
<% else%>
<span style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;"><%= l(:label_anonymous) %></span>
<% end %>
</span>
<span style="color:#a6a6a6; margin-right:20px; margin-left:30px;"><%= format_time(jour.created_on) %></span>
<span style="font-weight:bold; color:#a6a6a6; ">
<% if show_score %>
<%= l(:label_work_rating) %>
@ -24,22 +29,22 @@
<div class="ping_disfoot">
<% ids = 'project_respond_form_'+ jour.id.to_s%>
<span>
<% if jour.user==User.current|| User.current.admin? %>
<% if (jour.user==User.current|| User.current.admin?) && show_name %>
<%= link_to(l(:label_bid_respond_delete), {:controller => 'homework_attach', :action => 'destroy_jour', :object_id => jour, :user_id => jour.user,:jour_id =>@homework.id },
:remote => true, :confirm => l(:text_are_you_sure), :title => l(:button_delete)) %>
<% end %>
<%= link_to l(:label_projects_feedback_respond),'',
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), '#{l(:label_reply_plural)} #{jour.user.name}: '); $('##{ids} textarea') ;return false;"}
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), ''); $('##{ids} textarea') ;return false;"} ##{l(:label_reply_plural)} #{jour.user.name}:
%>
</span>
</div>
<div id='<%= ids %>' class="respond-form">
<%= render :partial => 'words/new_respond', :locals => {:journal => jour, :m_reply_id => jour} %>
<%= render :partial => 'words/new_respond', :locals => {:journal => jour, :m_reply_id => jour,:show_name=> show_name} %>
</div>
<div style="clear: both;"></div>
<div>
<%= render :partial => "words/journal_reply", :locals => {:journal => jour } %>
<%= render :partial => "words/journal_reply", :locals => {:journal => jour,:show_name=> show_name } %>
</div>
</div>
<div class="cl"></div>

View File

@ -69,7 +69,9 @@
:homework => @homework} %>
</div>
<div class="cl"></div>
<%= render :partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0, :is_comprehensive_evaluation => @is_comprehensive_evaluation} %>
<div id="add_jour">
<%= render :partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0, :is_comprehensive_evaluation => @is_comprehensive_evaluation} %>
</div>
<div class="cl"></div>
</div><!---ping_con end--->

View File

@ -9,6 +9,7 @@
<% elsif @add_jour.is_comprehensive_evaluation == 2 %>
// $('#message').html('<#%= escape_javascript(render(:partial => 'showjour', :locals => {:jour =>@jour, :state => false,:homework => @homework} )) %>');
// $('#pre_show').html('<#%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>');
$('#add_jour').html('<%= escape_javascript(render(:partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0, :is_comprehensive_evaluation => @is_comprehensive_evaluation})) %>')
HoverLi(5);
$('#jour_count_5').html('<%= @anonymous_comments.count %>')
$('#tbc_05').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @anonymous_comments,:show_score => true,:show_name => false,:is_jour => false})) %>')

View File

@ -2,6 +2,6 @@
<% id = "journal_reply_ul_" + journal.id.to_s%>
<div id = '<%= id %>' >
<% fetch_user_leaveWord_reply(journal).each do |reply|%>
<%= render :partial => "words/journal_reply_items", :locals => {:reply => reply, :journal => journal, :m_reply_id => reply} %>
<%= render :partial => "words/journal_reply_items", :locals => {:reply => reply, :journal => journal, :m_reply_id => reply,:show_name=> show_name} %>
<% end %>
</div>

View File

@ -2,13 +2,22 @@
<% ids_r = 'reply_respond_form_'+ reply.id.to_s %>
<div class="recall" id='word_li_<%=reply.id.to_s%>' onmouseover="$('#<%= ids_r %>').show()" onmouseout="$('#<%= ids_r %>').hide()">
<div class="recall_head">
<% if show_name %>
<%= image_tag url_to_avatar(reply.user) %>
<% else %>
<%= image_tag url_to_avatar(nil) %>
<% end %>
</div>
<div class="recall_con">
<% id = 'project_respond_form_'+ reply.id.to_s %>
<%= link_to reply.user.name, user_path(reply.user) %>
回复
<%= link_to reply.at_user.name,user_path(reply.at_user) %>
回复
<% if show_name %>
<%= link_to reply.at_user.name,user_path(reply.at_user) %>
<% else %>
<%= l(:label_anonymous) %>
<% end %>
<p>
<span class="message-notes">
<%= reply.notes %>
@ -25,14 +34,14 @@
<% end %>
<% if reply_allow %>
<%= link_to l(:label_projects_feedback_respond),'',
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{id}'), $('##{id} textarea'), '#{l(:label_reply_plural)} #{m_reply_id.user.name}: '); return false;"} %>
<% end %>
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{id}'), $('##{id} textarea'), ''); return false;"} %>
<% end %> <!-- #{l(:label_reply_plural)} #{m_reply_id.user.name}: -->
</span>
</p>
</div>
<div id='<%=id%>' class="respond-form">
<% if reply_allow %>
<%= render :partial => "words/new_respond", :locals => {:journal => journal, :m_reply_id => m_reply_id} %>
<%= render :partial => "words/new_respond", :locals => {:journal => journal, :m_reply_id => m_reply_id,:show_name => show_name} %>
<% end %>
</div>
<div style="clear: both;"></div>

View File

@ -8,6 +8,7 @@
<%= hidden_field_tag 'reference_id', params[:reference_id], :value => journal.id %>
<%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => m_reply_id.user.id %>
<%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => m_reply_id.id %>
<%= hidden_field_tag 'show_name',params[:show_name],:value => show_name.nil? ? true : show_name %>
<%= submit_tag l(:button_projects_feedback_respond), :name => nil ,
:class => "enterprise",
:style => "float: right; margin-top: 1px; margin-right: 4px;"%>

View File

@ -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}
:locals => {:reply => @jfm, :journal => @jfm.parent, :m_reply_id => @jfm,:show_name => @show_name}
) %>').hide();
$('#journal_reply_ul_<%=@jfm.m_parent_id%>').append(pre_append);
pre_append.fadeIn(600);