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

146 lines
6.8 KiB
Plaintext
Raw Normal View History

2016-12-23 16:58:50 +08:00
<% content_for :header_tags do %>
<%= javascript_include_tag "/assets/codemirror/codemirror_python_ruby_c" %>
<%= javascript_include_tag "resizeable_table" %>
<%= stylesheet_link_tag "/assets/codemirror/codemirror" %>
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<% end %>
<% is_group_project_homework = @contestwork.work_type == 3 && @contestwork.work_detail_group.base_on_project %>
<script type="text/javascript">
$(function(){
$("#RSide").removeAttr("id");
$("#homework_page_right").css("min-height",$("#courseLSide").height()-33);
$("#Container").css("width","1000px");
<% if @tab == 2%>
$("#student_work_tab2").click();
<% elsif @tab == 3 %>
$("#student_work_tab3").click();
<% end %>
sd_create_editor_from_data(<%= @contestwork.id %>, null, "100%", "<%= @contestwork.class.to_s %>");
});
function HoverLi(n){
for(var i=1;i<=3;i++){
$('#student_work_tab'+i).removeClass('selected');
$('#student_work_con'+i).addClass('undis');
}
$('#student_work_tab'+n).addClass('selected');
$('#student_work_con'+n).removeClass('undis');
}
$("#moreProject_<%=@contestwork.id %>").click(function(){
$("#relatePWrap_<%=@contestwork.id %>").toggleClass('relatePWrap');
$("#relatePWrap_<%=@contestwork.id %>").css("height","auto");
$(this).hide();
});
$("#hideProject_<%=@contestwork.id %>").click(function(){
$("#relatePWrap_<%=@contestwork.id %>").toggleClass('relatePWrap');
$("#moreProject_<%=@contestwork.id %>").show();
});
</script>
<div class="homepageRight mt0 ml10">
<div class="resources" id="homework_page_right">
<div class="hworkListBanner">
<div id="menu_r" class="fl">
<ul class="menu_r">
<li>
<a href="javascript:void(0);" class="parent">
<% if @is_teacher %>
<% hcommons = @all_homework_commons %>
<% else %>
<% hcommons = @homework_commons %>
<% end %>
<% hcommons.each_with_index do |homework_common,index |%>
<% if homework_common.id == @contestwork.id %>
2016-12-30 13:58:09 +08:00
<%="提交 #{hcommons.count - index}" %>
2016-12-23 16:58:50 +08:00
<% end %>
<% end%>
</a>
<ul>
<% hcommons.each_with_index do |homework_common,index |%>
<li class="pr10">
2016-12-30 13:58:09 +08:00
<%= link_to "提交#{hcommons.count - index}#{homework_common.name}",contestant_works_path(:work => homework_common.id)%>
2016-12-23 16:58:50 +08:00
<%#= link_to "第#{@homework_commons.count - index}次作业",student_work_index_path(:homework => homework_common.id)%>
</li>
<% end%>
</ul>
</li>
<!---level1 end--->
</ul>
<!---menu_r end--->
</div>
<!--div class="hworkInfor"><a href="javascript:void(0);" class="linkBlue">作业信息</a></div-->
<% if @is_teacher%>
<div class="fr mt5">
<ul class="">
<li class="pr export_icon_li">
<a href="javascript:void(0);" class="export_icon linkBlue2">导出</a>
<ul class="hworkMenu" style="top: 30px; left: -100px;">
<li>
<%= link_to "导出提交成绩", contestant_works_path(:work => @contestwork.id,:order => @order, :sort => @b_sort, :name => @name, :group => @group, :format => 'xls'),:class=>'hworkExport postTypeGrey', :id => "export_student_work"%>
</li>
2017-01-13 11:17:21 +08:00
<li>
<% if @contestwork.contestant_works.has_committed.empty?%>
<a href="javascript:void(0)" class="hworkExport resourcesGrey" onclick="notice_box('没有学生提交作业,无法下载附件')">导出作业附件</a>
<%#= link_to "导出作业附件", "javascript:void(0)", class: "hworkExport resourcesGrey", :onclick => "alert('没有学生提交作业,无法下载附件')" %>
<% else%>
<%= link_to "导出作业附件", zipdown_assort_path(obj_class: @contestwork.class, obj_id: @contestwork, format: :json),
remote: true, class: "hworkExport resourcesGrey", :id => "download_homework_attachments" %>
<% end%>
</li>
</ul>
</li>
</ul>
</div>
<% end%>
2016-12-23 16:58:50 +08:00
<div class="cl"></div>
</div>
<ul class="homework-detail-tab mb10 mt15 fb">
<li class="selected" id="student_work_tab1" onclick="HoverLi(1);">
2016-12-30 13:58:09 +08:00
<a href="javascript:void(0);" class="fontGrey3">提交信息</a>
2016-12-23 16:58:50 +08:00
</li>
<li onclick="HoverLi(2);" id="student_work_tab2">
<a href="javascript:void(0);" class="fontGrey3">作品列表</a>
</li>
<% if is_group_project_homework %>
<li onclick="HoverLi(3);" id="student_work_tab3">
<a href="javascript:void(0);" class="fontGrey3">关联项目列表</a>
</li>
<li style="width:415px;">&nbsp;</li>
<% else %>
<li style="width:515px;">&nbsp;</li>
<% end %>
</ul>
<div id="student_work_con1">
<div class="homepagePostBrief" id="homework_post_brief">
<%= render :partial => 'work_post_brief', :locals => {:homework => @contestwork, :is_teacher => @is_teacher} %>
</div>
<%= render :partial => 'users/contest_work_post_reply', :locals => {:activity => @contestwork, :user_activity_id => @contestwork.id, :hw_status => 3, :is_teacher => @is_teacher} %>
<div class="cl"></div>
</div>
<div class="undis" id="student_work_con2">
<div class="hworkListContainer">
<div class="ctt2">
<div class="dis" id="homework_student_work_list">
2016-12-23 21:44:03 +08:00
<%= render :partial => "contestant_work_list"%>
2016-12-23 16:58:50 +08:00
</div>
</div>
</div>
</div>
<% if @contestwork.work_type == 3 && @contestwork.work_detail_group.base_on_project %>
<div class="undis" id="student_work_con3">
<% student_work_ids = @contestwork.contestant_works.has_committed.blank? ? "(-1)" : "(" + @contestwork.contestant_works.has_committed.map{|st| st.id}.join(",") + ")" %>
<% student_work_projects = @contestwork.contestant_work_projects.where("contestant_work_id in #{student_work_ids} or contestant_work_id is null") %>
<% project_ids = student_work_projects.blank? ? "(-1)" : "(" + student_work_projects.map{|pro| pro.project_id}.join(",") + ")" %>
<% projects = Project.where("id in #{project_ids}").order("updated_on desc") %>
2016-12-23 21:44:03 +08:00
<%= render :partial => "relate_projects", :locals => {:projects => projects}%>
2016-12-23 16:58:50 +08:00
</div>
<% end %>
</div>
</div>
<div class="cl"></div>