评分支持打0分

This commit is contained in:
sw 2015-05-06 16:55:59 +08:00
parent e32a065c09
commit b456bc0e62
5 changed files with 6 additions and 4 deletions

View File

@ -445,7 +445,8 @@ class HomeworkAttachController < ApplicationController
is_teacher = @is_teacher ? 1 : 0
#保存评分@homework.rate(@m_score.to_i,User.current.id,:quality, (@is_teacher ? 1 : 0))
@is_comprehensive_evaluation = @is_teacher ? 1 : (@is_anonymous_comments ? 2 : 3) #判断当前评论是老师评论?匿评?留言
if @m_score && (@is_teacher || @is_anonymous_comments)
if @is_teacher || @is_anonymous_comments
@m_score ||= 0
rate = @homework.rates(:quality).where(:rater_id => User.current.id, :is_teacher_score => is_teacher).first
if rate
rate.stars = @m_score

View File

@ -32,7 +32,7 @@
<% unless is_student_batch_homework %>
<%= l(:label_teacher_score)%>:
<span class="c_red">
<%= (homework.t_score.nil? || (homework.t_score && homework.t_score.to_i == 0)) ? l(:label_without_score) : format("%.2f",homework.t_score)%>
<%= (homework.t_score.nil?) ? l(:label_without_score) : format("%.2f",homework.t_score)%>
</span>
&nbsp;&nbsp;
<% end %>

View File

@ -26,7 +26,7 @@
<%= format_time(review.created_at) %>
</span>
<span style="font-weight:bold; color:#a6a6a6; float: right;">
<% if review.stars && review.stars.to_i > 0%>
<% if review.stars%>
<span style="float:left">
<%= l(:label_work_rating) %>
</span>

View File

@ -1,3 +1,4 @@
<a style="float: right;padding-left: 10px;font-weight: normal;cursor: pointer;color: red;" onclick="ChoseStars(0)">零分</a>
<span><a href="javascript:" id="star05" onclick="ChoseStars(5)" style="background-position:<%= start_score>=5 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="javascript:" id="star04" onclick="ChoseStars(4)" style="background-position:<%= start_score>=4 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="javascript:" id="star03" onclick="ChoseStars(3)" style="background-position:<%= start_score>=3 ? '-24px 0px;':'-2px 0'%>"></a></span>

View File

@ -86,7 +86,7 @@ a.wzan_visited{background:url(images/pic_zan.png) 0 0 no-repeat;}
.ping_con h2{ font-size:14px; color:#444443; margin-bottom:10px; }
.ping_con p{ color:#777777; font-size:12px; border-bottom:1px dashed #CCC; padding-bottom:5px;}
.ping_con p span a{ color:#777777;}
.ping_star{ width:165px; color:#333; font-weight:bold; margin-bottom:5px;}
.ping_star{ width:185px; color:#333; font-weight:bold; margin-bottom:5px;}
.ping_star span a{ float:right; width:20px; height:20px; background:url(images/star.png);background-repeat: no-repeat; margin-right:3px;}
.ping_con textarea{ height:76px; border:1px solid #15bccf; margin-bottom:5px; color:#666; font-size:12px;}
a.ping_sub{ float:right; height:22px; width:60px; margin-right:20px; background:#15bccf; color:#fff; text-align:center;}