手写评分相关js

This commit is contained in:
sw 2014-12-01 11:15:03 +08:00
parent 046757fbd3
commit 38a912672a
6 changed files with 30 additions and 36 deletions

View File

@ -393,17 +393,15 @@ class HomeworkAttachController < ApplicationController
unless annymous_users.nil? || annymous_users.count == 0
@anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2 and user_id in #{convert_array(annymous_users)}").order("created_on DESC")
end
@totle_score = score_for_homework @homework
@teaher_score = teacher_score_for_homework @homework
#@totle_score = score_for_homework @homework
#@teaher_score = teacher_score_for_homework @homework
is_student = is_cur_course_student @homework.bid.courses.first
is_teacher = is_course_teacher User.current,@homework.bid.courses.first
@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 #是学生且开启了匿评,但已评分
elsif is_student && @is_anonymous_comments#是学生且开启了匿评
@is_comprehensive_evaluation = 2 #匿评
elsif is_student && !@is_anonymous_comments #是学生未开启匿评
@is_comprehensive_evaluation = 3 #留言

View File

@ -36,17 +36,18 @@
this.relatedElement.className = '';
this.relatedElement.firstChild.nodeValue = currentLength;
}
function test(){alert('test');}
//<!CDATA[
function g(o){return document.getElementById(o);}
function HoverLi(n){
//如果有N个标签,就将i<=N;
for(var i=3;i<=5;i++){g('ping_tb_'+i).className='ping_normaltab';g('tbc_0'+i).className='ping_undis';}g('tbc_0'+n).className='ping_dis';g('ping_tb_'+n).className='ping_hovertab';
}
//如果要做成点击后再转到请将<li>中的onmouseover 改成 onclick;
//]]>
function g(o){return document.getElementById(o);}
function HoverLi(n){
for(var i=3;i<=5;i++){g('ping_tb_'+i).className='ping_normaltab';g('tbc_0'+i).className='ping_undis';}g('tbc_0'+n).className='ping_dis';g('ping_tb_'+n).className='ping_hovertab';
}
function ChoseStars(num)
{
for (var i = num + 1; i <= 5; i++) {$("#star0" + i).css("background-position","-2px 0");}
for (var i = num; i >= 0; i--) {$("#star0" + i).css("background-position","-24px 0px");}
$("#stars_value").val(num);
}
</script>
<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
<div id="popbox">
<div class="ping_con">
<h2><%= @homework.name %></h2>
@ -113,8 +114,14 @@
</p>
<div class="ping_star" id="star_score">
<%= render :partial => 'show_star',:locals => {:is_comprehensive_evaluation => @is_comprehensive_evaluation,:totle_score => @totle_score,:has_evaluation => @has_evaluation ,
:homework => @homework} %>
<% if @is_comprehensive_evaluation == 3 || User.current == homework.user%>
<!-- 如果是留言,或者是作业创建者进入,不显示打星 -->
<% else @is_comprehensive_evaluation == 2 %>
<!-- 学生匿评或者教师评价 -->
<%= l(:label_work_rating) %>
<%= render :partial => 'show_star',:locals => {start_score:@m_score} %>
<% end %>
</div>
<div class="cl"></div>
<div id="add_jour">

View File

@ -1,16 +1,6 @@
<% if is_comprehensive_evaluation == 3 || User.current == homework.user%>
<!-- <#%= l(:label_work_rating) %>
<%#= render :partial => 'show_score', locals: {:stars => totle_score} %> -->
<% elsif is_comprehensive_evaluation == 2 %>
<% if has_evaluation %>
<%= l(:label_work_rating) %>
<%= rating_for homework, dimension: :quality,start_score: @m_score, class: 'rateable div_inline' %>
<% else %>
<%= l(:label_work_rating) %>
<%= rating_for homework, dimension: :quality,start_score: 0, class: 'rateable div_inline' %>
<% end %>
<% elsif @is_comprehensive_evaluation == 1%>
<%= l(:label_work_rating) %>
<%= rating_for homework, dimension: :quality,start_score: @m_score, class: 'rateable div_inline' %>
<% end %>
<span><a href="#" id="star05" onclick="ChoseStars(5)" style="background-position:<%= start_score>=5 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="#" id="star04" onclick="ChoseStars(4)" style="background-position:<%= start_score>=4 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="#" id="star03" onclick="ChoseStars(3)" style="background-position:<%= start_score>=3 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="#" id="star02" onclick="ChoseStars(2)" style="background-position:<%= start_score>=2 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="#" id="star01" onclick="ChoseStars(1)" style="background-position:<%= start_score>=1 ? '-24px 0px;':'-2px 0'%>"></a></span>
<input type="hidden" value="0" id="stars_value"/>

View File

@ -1,4 +1,4 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show',:locals => {:comprehensive_evaluation => @comprehensive_evaluation,:homework => @homework, :teaher_score => @teaher_score}) %>');
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show',:locals => {:comprehensive_evaluation => @comprehensive_evaluation,:homework => @homework}) %>');
showModal('ajax-modal', '513px');
$('#ajax-modal').css('height','569px');
$('#ajax-modal').siblings().remove();

BIN
public/images/bid/star.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -80,8 +80,7 @@ a.wzan_visited{background:url(images/pic_zan.png) 0 0 no-repeat;}
.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:160px; color:#333; font-weight:bold; margin-bottom:5px;}
.ping_star span a{ float:right; width:20px; height:20px; background:url(images/star.png) -2px 0 no-repeat; margin-right:3px;}
.ping_star span a:hover{background:url(images/star.png) -24px 0 no-repeat;}
.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;}
a.ping_sub1{ float:right; height:22px; width:60px; background:#15bccf; color:#fff; text-align:center;}