@ -1,25 +1,26 @@
<% result = User.current.is_certification_teacher || User.current.admin? %>
<% shixuns.each do |shixun| %>
<div class="square-Item">
<% if shixun.tag_repertoires.first.present? %>
<div class="tag-green"><span class="tag-name"><%= shixun.tag_repertoires.first.try(:name) %></span><img src="/images/educoder/tag2.png"></div>
<% end %>
<% if params[:controller] != "welcome" && shixun_view_allow(shixun, true) %>
<% unless result %>
<div class="closeSquare">
<img src="/images/educoder/icon/lockclose.svg" class="mt80 mb25">
<p class="font-14 color-white">非试用内容,需要授权 </p>
<p class="font-14 color-white">暂未公开 </p>
</div>
<% end %>
<a href="<%= shixun_path(shixun) %>" class="square-img" target="_blank">
<a href="<%= result ? shixun_path(shixun) : "javascript:void(0);" %>" class="square-img" target="_blank">
<%= image_tag(url_to_avatar(shixun)) %>
</a>
<div class="square-main">
<p class="task-hide">
<a href="<%= shixun_path(shixun) %>" class="justify color-grey-name" title="<%= shixun.name %>" target="_blank"><%= shixun.name %></a>
<a href="<%= result ? shixun_path(shixun) : "javascript:void(0);" %>" class="justify color-grey-name" title="<%= shixun.name %>" target="_blank"><%= shixun.name %></a>
</p>
<!--五星评分-->
<p class="clearfix mt3 mb3"><span class="rateYoStar fl" data-star="<%= shixun.shixun_preference %>" style="padding: 0px;width: 100%;height:20px;line-height:19px;width: 90px;"></span><span class="fl ml10 font-12 color-grey-9 lineh-12 mt3"><%= shixun.shixun_preference %>分</span></p>
<p class="clearfix mt3 mb3"><span class="rateYoStar fl" data-star="<%= shixun.averge_star %>" style="padding: 0px;width: 100%;height:20px;line-height:19px;width: 90px;">
</span><span class="fl ml10 font-12 color-grey-9 lineh-12 mt3"><%= shixun.averge_star %>分</span></p>
<p class="clearfix mt8 font-12 color-grey-B4">
<% if shixun.challenges_count > 0 %>
@ -32,9 +33,9 @@
<i class="iconfont icon-jingyan fl mr3" data-tip-down="经验值"></i><%= shixun.shixun_score %>
</span>
<% end %>
<% if shixun.myshixuns. count > 0 %>
<% if shixun.myshixuns_ count > 0 %>
<span class="mr10 fl squareIconSpan">
<i class="iconfont icon-chengyuan fl mr3" data-tip-down="学习人数"></i><%= shixun.myshixuns. count %>
<i class="iconfont icon-chengyuan fl mr3" data-tip-down="学习人数"></i><%= shixun.myshixuns_ count %>
</span>
<% end %>
<span class="fr color-grey-B3 squareIconSpan"><%= shixun.shixun_level %></span>
@ -65,3 +66,75 @@
});
})
</script>
<% if false %>
<% result = User.current.is_certification_teacher || User.current.admin? %>
<% shixuns.each do |shixun| %>
<div class="square-Item">
<% if shixun.tag_repertoires.first.present? %>
<div class="tag-green"><span class="tag-name"><%= shixun.tag_repertoires.first.try(:name) %></span><img src="/images/educoder/tag2.png"></div>
<% end %>
<% unless result %>
<div class="closeSquare">
<img src="/images/educoder/icon/lockclose.svg" class="mt80 mb25">
<p class="font-14 color-white">暂未公开</p>
</div>
<% end %>
<a href="<%= result ? shixun_path(shixun) : "javascript:void(0);" %>" class="square-img" target="_blank">
<%= image_tag(url_to_avatar(shixun)) %>
</a>
<div class="square-main">
<p class="task-hide">
<a href="<%= result ? shixun_path(shixun) : "javascript:void(0);" %>" class="justify color-grey-name" title="<%= shixun.name %>" target="_blank"><%= shixun.name %></a>
</p>
<!--五星评分-->
<p class="clearfix mt3 mb3"><span class="rateYoStar fl" data-star="<%= shixun.shixun_preference %>" style="padding: 0px;width: 100%;height:20px;line-height:19px;width: 90px;"></span><span class="fl ml10 font-12 color-grey-9 lineh-12 mt3"><%= shixun.shixun_preference %>分</span></p>
<p class="clearfix mt8 font-12 color-grey-B4">
<% if shixun.challenges_count > 0 %>
<span class="mr10 fl squareIconSpan">
<i class="iconfont icon-shixunguanqia fl mr3" data-tip-down="关卡"></i><%= shixun.challenges_count %>
</span>
<% end %>
<% if shixun.shixun_score > 0 %>
<span class="mr10 fl squareIconSpan">
<i class="iconfont icon-jingyan fl mr3" data-tip-down="经验值"></i><%= shixun.shixun_score %>
</span>
<% end %>
<% if shixun.myshixuns.count > 0 %>
<span class="mr10 fl squareIconSpan">
<i class="iconfont icon-chengyuan fl mr3" data-tip-down="学习人数"></i><%= shixun.myshixuns.count %>
</span>
<% end %>
<span class="fr color-grey-B3 squareIconSpan"><%= shixun.shixun_level %></span>
</p>
</div>
</div>
<% end %>
<script>
$(function(){
$(".rateYoStar").raty({
hints: ['', '', '', '', ''],
readOnly: true,
path:"/images/educoder",
starOff: 'star-off.png',
starHalf:'star-half.png',
starOn: 'star-on.png',
size:'14',
score:function(){
var s=$(this).attr("data-star");
var yu=(s*10)%10;
if(yu>0){
return parseFloat(Math.floor((s*10)/10)+".5");
}else{
return $(this).attr("data-star");
}
}
});
})
</script>
<% end %>