Merge branch 'cxt_course' into 'develop'

匿评时其他人的评语不可见



See merge request !41
This commit is contained in:
陈晓婷 2016-12-02 17:09:34 +08:00
commit dd0c202f8c
5 changed files with 17 additions and 9 deletions

View File

@ -691,7 +691,11 @@ class StudentWorkController < ApplicationController
def show
@score = student_work_score @work,User.current
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
@student_work_scores = student_work_score_record(@work)
if @homework.homework_detail_manual.comment_status == 2 && !@is_teacher && @work.user != User.current
@student_work_scores = @work.student_works_scores.where("user_id = #{User.current.id} and reviewer_role = 3").order("updated_at desc")
else
@student_work_scores = student_work_score_record(@work)
end
respond_to do |format|
format.js
end
@ -867,6 +871,7 @@ class StudentWorkController < ApplicationController
@score = StudentWorksScore.find params[:score_id]
@is_last = params[:is_last] == "true"
@jour = @score.journals_for_messages.new(:user_id => User.current.id,:notes =>params[:message], :reply_id => 0)
@show_real_name = User.current.allowed_to?(:as_teacher, @score.student_work.homework_common.course) || User.current.admin? || @score.reviewer_role != 3 || @jour.user == User.current
if @jour.save
@status = 1
else

View File

@ -2,7 +2,7 @@
<%= link_to image_tag(url_to_avatar(jour.user), :width => "32", :height => "32"), user_path(jour.user),:class => "st_img fl" %>
<div class="ping_back_tit">
<a href="javascript:void(0);" class="c_blue fl" >
<%= link_to jour.user.show_name, user_path(jour.user), :title => jour.user.show_name, :class => "c_blue fl" %>
<%= link_to show_real_name ? jour.user.show_name : "匿名", user_path(jour.user), :title => jour.user.show_name, :class => "c_blue fl" %>
</a>
<% if jour.user==User.current || User.current.admin? %>
<%= link_to(l(:label_bid_respond_delete), destroy_score_reply_student_work_index_path(:jour_id => jour.id),

View File

@ -1,6 +1,7 @@
<ul class="ping_box_ul <%= is_last ? '' : 'ping_line'%> fl">
<% show_real_name = @is_teacher || score.user == User.current || score.user.allowed_to?(:as_teacher,@course) || score.reviewer_role != 3 %>
<% show_real_name = @is_teacher || score.user == User.current || score.reviewer_role != 3 %>
<%= link_to image_tag(url_to_avatar(show_real_name ? score.user : ""), :width => "34", :height => "34"), show_real_name ? user_path(score.user) : "javascript:void(0)",:class => "ping_pic fl" %>
<% show_real_score = @homework.score_open == 1 || @is_teacher || score.student_work.user == User.current %>
<div class="pingBoxTit">
<%= link_to show_real_name ? score.user.show_name : "匿名", show_real_name ? user_path(score.user) : "javascript:void(0)", :title => show_real_name ? score.user.show_name : "匿评用户", :class => "linkBlue fl" %>
<span class="ml5 fl">
@ -9,7 +10,7 @@
<% unless score.score.nil? %>
<span class="ml20 fl">评分:</span>
<a href="javascript:void(0);" class="c_orange fl" >
<%= score.score%>分
<%= show_real_score ? score.score : "**" %>分
</a>
<% end %>
<a href="javascript:void(0);" class="fr linkBlue mr5" onclick="$('#add_score_reply_<%= score.id%>').slideToggle();">回复</a>
@ -33,7 +34,8 @@
<div id="replay_histroy_<%= score.id%>">
<% score.journals_for_messages.order("created_on desc").each do |jour|%>
<%= render :partial => 'jour_replay',:locals => {:jour => jour}%>
<% show_real_name = @is_teacher || score.reviewer_role != 3 %>
<%= render :partial => 'jour_replay',:locals => {:jour => jour, :show_real_name => show_real_name || jour.user == User.current}%>
<% end%>
</div>
<div class="cl"></div>

View File

@ -7,6 +7,7 @@ $('#score_<%= @work.id%>').peSlider({range: 'min'});
<%# else %>
//$("#work_score_<%#= @score.id%>").html("<%#= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @new_score,:is_last => @is_last}) %>");
<%# end%>
<% score_open = @is_teacher || @homework.score_open == 1 || @work.user == User.current %>
$("#score_list_<%= @work.id%>").html("<%=escape_javascript(render :partial => 'student_work_score_records', :locals => {:student_work_scores => @student_work_scores, :is_member_work => is_member_work}) %>");
var num = $("#work_num_<%= @work.id%>").html();
@ -19,14 +20,14 @@ $("#score_list_<%= @work.id%>").removeAttr("style");
$("#group_member_work_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'group_member_work', :locals => {:student_work => @work}) %>");
<% else %>
<% anon_count = @work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count %>
$("#student_work_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'evaluation_un_group_member_work', :locals => {:st => @work, :anon_count => anon_count}) %>");
$("#student_work_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'evaluation_un_group_member_work', :locals => {:st => @work, :anon_count => anon_count, :score_open => score_open}) %>");
<% end %>
<% else %>
$("tr[id='student_work_<%= @work.id%>']").replaceWith("<%= escape_javascript(render :partial => 'evaluation_un_work',:locals => {:student_work => @work, :index => 1}) %>");
$("tr[id='student_work_<%= @work.id%>']").replaceWith("<%= escape_javascript(render :partial => 'evaluation_un_work',:locals => {:student_work => @work, :index => 1, :score_open => score_open}) %>");
$("#work_num_<%= @work.id%>").html(num);
<% end %>
<% else %>
$("tr[id='student_work_<%= @work.id%>']").replaceWith("<%= escape_javascript(render :partial => 'evaluation_work',:locals => {:student_work => @work, :index => 1}) %>");
$("tr[id='student_work_<%= @work.id%>']").replaceWith("<%= escape_javascript(render :partial => 'evaluation_work',:locals => {:student_work => @work, :index => 1, :score_open => score_open}) %>");
$("#work_num_<%= @work.id%>").html(num);
<% end%>

View File

@ -1,6 +1,6 @@
$("#add_score_reply_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'add_score_reply', :locals => {:score => @score,:is_last => @is_last}) %>");
<% if @status && @status == 1%>
$("#replay_histroy_<%= @score.id%>").prepend("<%= escape_javascript(render :partial => 'jour_replay', :locals => {:jour => @jour}) %>");
$("#replay_histroy_<%= @score.id%>").prepend("<%= escape_javascript(render :partial => 'jour_replay', :locals => {:jour => @jour, :show_real_name => @show_real_name}) %>");
$("#add_score_reply_<%= @score.id%>").hide();
<% else%>
alert("回复内容不能为空");