点击作品消息,作品展开

This commit is contained in:
huang 2016-03-24 15:04:50 +08:00
parent 77419dc2d4
commit 88185b1f34
3 changed files with 41 additions and 39 deletions

View File

@ -230,12 +230,12 @@ class StudentWorkController < ApplicationController
render_403 render_403
return return
end end
@student_work_count = (search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").order("#{@order} #{@b_sort}"),@name).count @student_work_count = (search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").order("#{@order} #{@b_sort}"),@name).count
end end
@score = @b_sort == "desc" ? "asc" : "desc" @score = @b_sort == "desc" ? "asc" : "desc"
# 消息传过来的ID
@message_student_work_id = params[:student_work_id]
respond_to do |format| respond_to do |format|
format.js format.js
format.html format.html

View File

@ -48,6 +48,9 @@
$(function(){ $(function(){
<% if !@is_evaluation && !@is_teacher %> <% if !@is_evaluation && !@is_teacher %>
<% work = @homework.student_works.where("user_id = ?",User.current.id).first %> <% work = @homework.student_works.where("user_id = ?",User.current.id).first %>
<% elsif !@message_student_work_id.nil? %>
<% work = @homework.student_works.where("id =?", @message_student_work_id).first %>
<% end %>
<% unless work.nil? %> <% unless work.nil? %>
<% if @homework.homework_type == 2 %> <% if @homework.homework_type == 2 %>
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show',:locals => {:work =>work,:score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc")}) %>"); $("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show',:locals => {:work =>work,:score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc")}) %>");
@ -83,6 +86,5 @@
<% end %> <% end %>
$('#score_<%= work.id%>').peSlider({range: 'min'}); $('#score_<%= work.id%>').peSlider({range: 'min'});
<% end %> <% end %>
<% end %>
}); });
</script> </script>

View File

@ -167,7 +167,7 @@
</li> </li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey"> <li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<% unless ma.content.nil? %> <% unless ma.content.nil? %>
<%= link_to ma.content.html_safe, student_work_index_path(:homework => ma.course_message.student_work.homework_common_id), <%= link_to ma.content.html_safe, student_work_index_path(:homework => ma.course_message.student_work.homework_common_id, :student_work_id => ma.course_message.student_work),
:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %> :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
<!--:onmouseover =>"message_titile_show($(this),event)",--> <!--:onmouseover =>"message_titile_show($(this),event)",-->
<!--:onmouseout => "message_titile_hide($(this))" %>--> <!--:onmouseout => "message_titile_hide($(this))" %>-->
@ -208,7 +208,7 @@
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">回复了作品评论:</span> <span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">回复了作品评论:</span>
</li> </li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey"> <li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ma.course_message.notes, student_work_index_path(:homework => ma.course_message.jour.student_work.homework_common_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %> <%= link_to ma.course_message.notes, student_work_index_path(:homework => ma.course_message.jour.student_work.homework_common_id, :student_work_id => ma.course_message.jour.student_work), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
<!--:onmouseover => "message_titile_show($(this),event)",--> <!--:onmouseover => "message_titile_show($(this),event)",-->
<!--:onmouseout => "message_titile_hide($(this))" %>--> <!--:onmouseout => "message_titile_hide($(this))" %>-->
</a> </a>