socialforge/app/views/layouts/_user_contests.html.erb

81 lines
4.4 KiB
Plaintext

<% contests.each do |contest|%>
<li class="pr">
<span class="user_icons_class"></span>
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.admin_of_contest?(contest)) %>
<p href="javascript:void(0);" id="show_contest_<%= contest.id %>" class="course_list_menu" >
<%= link_to contest.name, contest_path(contest.id), :target => '_blank', :class => 'hidden', :style => 'display:block;'%>
</p>
<% count = ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Contest' and shield_id=#{contest.id}").count %>
<div class="user_navmore_box">
<ul class="<%#= count > 0 ? 'shild shildP':'subNavArrow'%>">
<li class="user_navmore_icons">
<ul class="user_navmore_txt">
<% if is_teacher %>
<li class="clear">
<%= link_to "提交",works_path(:contest => contest.id), :class => 'user_navmore_li fl', :target => '_blank' %>
<%= link_to '+',works_path(:contest => contest.id,:is_new => 1), :class => 'user_navmore_add fl', :title => '发布作品',:target => '_blank' %>
</li>
<li class="clear">
<%= link_to "通知", contest_news_index_path(contest), :class => 'user_navmore_li fl',:target => '_blank' %>
<%= link_to "+", new_contest_news_path(contest,:is_new=>1), :class => 'user_navmore_add fl', :title => '发布通知',:target => '_blank' %>
</li>
<li class="clear">
<%= link_to "论坛", contest_boards_path(contest), :class => 'user_navmore_li fl',:target => '_blank' %>
<%= link_to "+", contest_boards_path(contest, :flag => true, :is_new => 1), :class => 'user_navmore_add fl', :title => '发布帖子',:target => '_blank' %>
</li>
<% else %>
<li>
<%= link_to "提交",works_path(:contest => contest.id), :class => 'user_navmore_li', :target => '_blank' %>
<div class="cl"></div>
</li>
<li>
<%= link_to "通知", contest_news_index_path(contest), :class => 'user_navmore_li',:target => '_blank' %>
<div class="cl"></div>
</li>
<li class="clear">
<%= link_to "论坛", contest_boards_path(contest), :class => 'user_navmore_li fl',:target => '_blank' %>
<div class="cl"></div>
</li>
<% end %>
<!--<li class="clear">-->
<!--<%#= link_to "论坛",contest_boards_path(contest), :class => 'user_navmore_li fl',:target => '_blank' %>-->
<!--<%#= link_to "+",contest_boards_path(contest, :flag => true, :is_new => 1), :class => 'user_navmore_add fl', :title => '发布帖子',:target => '_blank' %>-->
<!--</li>-->
<% if User.current == user %>
<li>
<%= link_to "取消收藏", cancel_or_collect_user_path(user, :contest => contest.id), :class => 'user_navmore_li',:target => '_blank', :remote => true %>
<div class="cl"></div>
</li>
<li>
<% if count == 0 %>
<%= link_to "屏蔽动态", shield_activities_path(:user_id => user.id, :contest_id => contest.id), :method => 'post', :class => 'user_navmore_li',:remote => true %>
<% else %>
<%= link_to "显示动态", show_acts_shield_activities_path(:user_id => user.id, :contest_id => contest.id),:remote => true,:method => 'delete', :class => 'user_navmore_li' %>
<% end %>
</li>
<% end %>
</ul>
</li>
</ul>
</div>
</li>
<% end %>
<% if all_count > (page.to_i+1) * 10%>
<a class="user_navmorebox" href="javascript:void(0);" id="user_show_more_course" onclick="show_more_course('<%= user_contests4show_user_path(user.id,:page => page)%>');">
<span class="user_icons_moreclass"></span>
</a>
<% end%>
<script type="text/javascript">
var coursecount = <%= all_count %>;
var courseshowcount = document.getElementsByClassName("course_list_menu").length;
if((coursecount <= courseshowcount)&&(coursecount > 10) ){
$("#user_show_more_course").hide();
$('#user_hide_course').show();
}
</script>