socialforge/app/views/contests/_contest_base_info.html.erb

61 lines
3.6 KiB
Plaintext

<p class="sy_cgrey mb10">
<%= link_to @contest.user.try(:show_name), user_path(@contest.user), :class => "sy_cgrey" %>
<span class="sy_cgrey">&nbsp;&gt;&nbsp;</span>
<%= link_to @contest.name, contest_path(@contest), :class => "sy_cgrey" %>
</p>
<% if User.current.admin_of_contest?(@contest) || User.current.admin? %>
<%= render :partial => "contests/mamager_setting" %>
<% end %>
<div class="cl"></div>
<div class="banner-game">
<%= image_tag(url_to_avatar(@contest), :width => "968", :height => "110", :alt => "竞赛图片", :id=>'nh_source_tx')%>
<% if User.current.admin_of_contest?(@contest) || User.current.admin? %>
<a class="banner-inner" href="<%=my_clear_user_avatar_temp_path(:contest => @contest.id) %>" data-remote="true"></a>
<a class="banner-notice" href="<%=my_clear_user_avatar_temp_path(:contest => @contest.id) %>" data-remote="true">点击替换图片(968*110)</a>
<% end %>
<%#=render :partial => 'avatar/new_contest_avatar_form', :locals => {source: @contest, is_admin: User.current.admin_of_contest?(@contest) || User.current.admin?} %>
</div>
<div class="sy_class_info fl">
<div class="sy_class_titbox">
<h3 class="fl sy_class_title"><%= @contest.name %></h3>
<span class="<%= @contest.is_public ? 'hw_icon_open' : 'hw_icon_private' %> fl ml5 mt3"></span>
<div class="cl"></div>
</div>
<p class="sy_cgrey ">
<span class=" mr15">管理员:<a class="sy_cblue" href="<%= member_contest_path(@contest, :role => 1)%>" id="admin_num"><%= contest_managers(@contest).count %></a></span>
<span class=" mr15">评委:<a class="sy_cblue" href="<%= member_contest_path(@contest, :role => 2)%>" id="judge_num"><%= contest_judges(@contest).count %></a></span>
<span class=" mr15">参赛者:<a class="sy_cblue" href="<%= member_contest_path(@contest, :role => 3)%>" id="contestant_num"><%= contest_contestants(@contest).count %></a></span>
</p>
</div>
<% if User.current.member_of_contest?(@contest) %>
<% if @contest.contest_members.where(:user_id => User.current.id)[0].contest_member_roles.count == 2 %>
<% if User.current.admin_of_contest?(@contest) %>
<%= link_to '评委身份', switch_role_contest_path(@contest, :user_id => User.current.id, :curr_role => 13, :tar_role => 14), :class => "fr sy_btn_blue mt28 ml10", :title => "由管理员身份切换至评委身份" %>
<% elsif User.current.judge_of_contest?(@contest) %>
<%= link_to '管理员身份', switch_role_contest_path(@contest, :user_id => User.current.id, :curr_role => 14, :tar_role => 13), :class => "fr sy_btn_blue mt28 ml10", :title => "由评委身份切换至管理员身份" %>
<% end %>
<% end %>
<% else %>
<%= link_to "加入竞赛",join_contest_contests_path(),:remote => true, :method => "get", :class => "fr sy_btn_blue mt28 ml10" %>
<% end %>
<span class="fr mt30 f16"> 邀请码:
<span class="sy_corange">
<span class="sy_corange">
<% if @contest.invite_code_halt == 0 %>
<%=@contest.generate_invite_code %>
<% else %>
已停用
<% end %>
</span>
</span></span>
<div class="cl"></div>
<% if User.current.admin_of_contest?(@contest) || User.current.admin? %>
<div class="invite_code_tip_box fontGrey2" id="invite_code_tip_box" style="top: 160px;">
<em></em>
<span></span>
<p class="mt10 mb5"><%= @contest.invite_code_halt == 0 ? "请将邀请码告诉成员" : "邀请码已停用" %></p>
<p class="mb10"><%= @contest.invite_code_halt == 0 ? "他们可以主动加入" : "暂时停止成员主动加入" %></p>
</div>
<% end %>