socialforge/app/views/contestant_works/_show.html.erb

149 lines
7.0 KiB
Plaintext
Raw Normal View History

2016-12-23 21:44:03 +08:00
<div class="show_hwork_arrow"></div>
<div class="showHwork">
<% is_teacher = User.current.admin_of_contest?(@contestwork.contest) || User.current.judge_of_contest?(@contestwork.contest) || User.current.admin? %>
<% if @contestwork.work_type != 3 %>
<% is_my_work = work.user == User.current%>
<% else %>
<% pro = @contestwork.contestant_work_projects.where(:user_id => User.current.id).first %>
<% is_my_work = pro && pro.contestant_work_id == work.id%>
<% end %>
<% is_member_work = @contestwork.work_type == 3 && work.contestant_work_projects.empty? %>
<% if !is_member_work %>
<ul>
<li class="fl" >
<span class="tit_fb">上交时间:</span>
<%=format_time work.commit_time %>
</li>
2016-12-30 10:30:21 +08:00
<% if work.user == User.current && @contestwork.work_status == 1 %>
2016-12-23 21:44:03 +08:00
<!-- 我的作业 && 匿评作业 && 未开启匿评,显示编辑和删除按钮 -->
<li class="fr" >
<%= link_to("", contestant_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del",:title=>"删除") %>
</li>
<li class="fr mr5" >
<%= link_to "",edit_contestant_work_path(work),:class => "pic_edit",:title => "修改"%>
</li>
<% end%>
<div class="cl"></div>
<!--<li ><span class="tit_fb"> 参与人员:</span>程梦雯&nbsp;&nbsp;王强</li>-->
<% if @contestwork.work_type == 3 && work.contestant_work_projects %>
<div class="cl"></div>
<li>
<span class="tit_fb"> 参与人员:</span>
<%= link_to(work.user.show_name+"(组长)", user_path(work.user.id), :class => "linkBlue" )%>
<% members = work.contestant_work_projects.where("is_leader = 0") %>
<% members.each do |member| if !members.empty? %>
、<%=link_to((User.find member.user_id).show_name, user_path(member.user.id), :class => "linkBlue" ) %>
<% end %>
<% end %>
</li>
<% if @contestwork.work_detail_group.base_on_project %>
<li>
<span class="tit_fb"> 关联项目:</span>
<% if work.project_id == 0 || work.project_id.nil? %>
<span>暂无</span>
<% elsif work.project.is_public || User.current.member_of?(work.project) || User.current.admin? %>
<%= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%>
<span class="ml5">(综合评分:<font class="c_red"><%=static_project_score(work.project.project_score).to_i %></font>)</span>
<% else %>
<span title ="该项目是私有的"><%=work.project.name %></span>
<span class="ml5">(综合评分:<font class="c_red"><%=static_project_score(work.project.project_score).to_i %></font>)</span>
<% end %>
<%#= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%>
</li>
<% end %>
<% end%>
<li>
<span class="tit_fb ">内容:</span>
<div class="showHworkP break_word upload_img" id="student_work_img_<%=work.id %>">
<%= work.description.html_safe if work.description%>
</div>
<div class="cl"></div>
</li>
<li>
<span class="tit_fb"> 附件:</span>
<% com_attachments = work.attachments.where("attachtype IS NULL OR attachtype <> 7") %>
<% if com_attachments.empty?%>
<span style="color: #999999">尚未提交附件</span>
<% else%>
<div class="fl" style="width: 90%;">
<%= render :partial => 'contest_work_attachments_status', :locals => {:attachments => com_attachments, :status => 1} %>
</div>
<% end%>
<div class="cl"></div>
</li>
<!--<li >-->
2016-12-30 10:30:21 +08:00
<!--<%# if @contestwork.online_evaluation && User.current.judge_of_contest?(@contestwork.contest) && @contestwork.work_status == 3 %>-->
2016-12-23 21:44:03 +08:00
<!--&lt;!&ndash; 老师 || 开启匿评状态 && 不是当前用户自己的作品 &ndash;&gt;-->
<!--<div id="add_student_score_<%#= work.id%>" class="mt10 evaluation">-->
<!--<%#= render :partial => 'add_score',:locals => {:work => work,:score => score,:is_member_work => is_member_work}%>-->
<!--</div>-->
<!--<%# end%>-->
<!--<div class="cl"></div>-->
<!--</li>-->
</ul>
<!--<div id="revise_attachment">-->
<!--<%#= render :partial => 'student_work/revise_attachment', :locals => {:work => work} %>-->
<!--</div>-->
<div class="cl"></div>
<% else %>
<!--<ul>-->
<!--<li >-->
<!--<%# if @is_teacher %>-->
2016-12-30 10:30:21 +08:00
<!--<!-- 老师 -->-->
2016-12-23 21:44:03 +08:00
<!--<div id="add_student_score_<%#= work.id%>" class="mt10 evaluation">-->
<!--<%#= render :partial => 'add_score',:locals => {:work => work,:score => score,:is_member_work => is_member_work}%>-->
<!--</div>-->
<!--<%# end%>-->
<!--<div class="cl"></div>-->
<!--</li>-->
<!--</ul>-->
<% end %>
2016-12-30 10:30:21 +08:00
<!--<div class="ping_box fl" id="score_list_<%#= work.id%>" style="<%#= student_work_scores.empty? ? 'padding:0px;' : ''%>">-->
<!--<%#= render :partial => 'contestant_work_score_records', :locals => {:student_work_scores => student_work_scores, :is_member_work => is_member_work} %>-->
2016-12-23 21:44:03 +08:00
<!--</div>-->
<div class="cl"></div>
<!---ping_box end--->
<a href="javascript:void(0);" class="linkBlue mt5 mb5" style="margin-left:auto; margin-right: auto; display:block; width: 24px;" onclick="$('#about_hwork_<%= work.id%>').html('');">收起</a>
<div class="cl"></div>
</div>
<script type="text/javascript">
$(function(){
showNormalImage('student_work_img_<%=work.id %>');
<% if defined?(is_focus) && is_focus.to_i == 1 %>
$("#upload_revise_attachment").click();
<% end %>
});
// function show_upload(){
// var htmlvalue = "<%#= escape_javascript( render :partial => 'student_work/upload_attachment' ,:locals => {:work=>work})%>";
// pop_box_new(htmlvalue, 500, 230);
// }
function regex_des() {
if ($.trim($("#attachment_des").val()) == "") {
$("#hint_message").text("附件描述不能为空");
$("#hint_message").css('color','#ff0000');
return false;
} else {
$("#hint_message").text("");
return true;
}
}
function submit_revise_files(){
if (regex_des()) {
$("#upload_form").submit();
}
}
function closeModal(){
hideModal($(".uploadBoxContainer"));
}
function disable_choose(){
if ($("#attachments_fields .attachment").size() >= 1) {
$("#choose_revise_attach").attr("onclick","return false;").addClass(disable_link);
}
}
</script>