parent
ad8bd131ce
commit
d9c3103e6e
|
@ -87,8 +87,8 @@ module HomeworkAttachHelper
|
|||
|
||||
#获取用户对作业的评分
|
||||
def get_homework_score user, homework
|
||||
seems_rateable_rate = HomeworkAttach.find_by_sql("SELECT * FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = #{homework.id} AND rater_id = #{user.id}")
|
||||
seems_rateable_rate.nil? || seems_rateable_rate.count == 0 ? 0:seems_rateable_rate[0].stars
|
||||
temp = HomeworkAttach.find_by_sql("SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = #{homework.id} AND rater_id = #{user.id}").first
|
||||
@m_score = temp.nil? ? 0:temp.stars.to_i
|
||||
end
|
||||
|
||||
def convert_array array
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
<div class="ping_dis" id="tbc_03">
|
||||
<%= render :partial => 'homework_attach/jour',:locals => {:jours => @jour,:show_score => false,:show_name => true,:is_jour => true} %>
|
||||
</div>
|
||||
|
||||
<div class="ping_undis" id="tbc_04">
|
||||
<%= render :partial => 'homework_attach/jour',:locals => {:jours => @comprehensive_evaluation,:show_score => true,:show_name => true,:is_jour => false} %>
|
||||
</div>
|
||||
|
|
|
@ -11,18 +11,22 @@
|
|||
<div class="ping_distop">
|
||||
<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"%>
|
||||
<%= link_to jour.user, user_path(jour.user),:style => " font-weight:bold; color:#15bccf; margin-right:5px; background:none;", :target => "_blank"%>
|
||||
<% else%>
|
||||
<span style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;"><%= l(:label_anonymous) %></span>
|
||||
<span style=" font-weight:bold; color:#15bccf; margin-right:5px; background:none;"><%= l(:label_anonymous) %></span>
|
||||
<% end %>
|
||||
</span>
|
||||
<span style="color:#a6a6a6; margin-right:20px; margin-left:10px;"><%= format_time(jour.created_on) %></span>
|
||||
<span style="font-weight:bold; color:#a6a6a6; ">
|
||||
<span style="color:#a6a6a6; margin-right:30px; margin-left:10px;"><%= format_time(jour.created_on) %></span>
|
||||
<span style="font-weight:bold; color:#a6a6a6; float: right;">
|
||||
<% if show_score %>
|
||||
<span style="float:left">
|
||||
<%= l(:label_work_rating) %>:
|
||||
</span>
|
||||
<%= render :partial => 'homework_attach/show_score', locals: {:stars => get_homework_score(jour.user,@homework ) } %>
|
||||
<div class="ping_star">
|
||||
<% star = get_homework_score(jour.user,@homework)%>
|
||||
<%= render :partial => 'homework_attach/show_static_star', :locals => {:start_score => star } %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<span><a href="#" id="star05" style="background-position:<%= start_score>=1 ? '-24px 0px;':'-2px 0'%>"></a></span>
|
||||
<span><a href="#" id="star04" style="background-position:<%= start_score>=2 ? '-24px 0px;':'-2px 0'%>"></a></span>
|
||||
<span><a href="#" id="star03" style="background-position:<%= start_score>=3 ? '-24px 0px;':'-2px 0'%>"></a></span>
|
||||
<span><a href="#" id="star02" style="background-position:<%= start_score>=4 ? '-24px 0px;':'-2px 0'%>"></a></span>
|
||||
<span><a href="#" id="star01" style="background-position:<%= start_score>=5 ? '-24px 0px;':'-2px 0'%>"></a></span>
|
Loading…
Reference in New Issue