socialforge/app/views/student_work/new.html.erb

177 lines
8.1 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!-- 此界面只用来新建匿评作业作品 -->
<script type="text/javascript">
<%if @homework.homework_detail_manual.comment_status != 1%>
$(function(){
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/new_student_work_alert') %>');
showModal('ajax-modal', '360px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","65%").css("left","60%");
$('#ajax-modal').parent().addClass("anonymos_work");
});
<% end%>
<% if @homework.homework_detail_group %>
$(function(){
$('span.group_detail_info').text('分组人数:<%=@homework.homework_detail_group.min_num %>-<%=@homework.homework_detail_group.max_num %> 人');
});
<% end %>
//快速创建项目的弹框
function new_project(){
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/new_project') %>');
showModal('ajax-modal', '800px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","30%").css("left","20%").css("position","fixed");
}
// 点击 checkbox选中引用的资源的时候保存该资源的id到session里去
function store_seleted_resource(dom){
if(dom.attr('checked') == 'checked' ){
$.get(
'<%= store_selected_resource_user_path(User.current) %>'+'?save=y&res_id='+dom.val()
)
}else {
$.get(
'<%= store_selected_resource_user_path(User.current) %>'+'?save=n&res_id='+dom.val()
)
}
}
// 添加组成员
function show_group_member() {
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/choose_group_member',:locals => {:homework=>@homework}) %>');
showModal('ajax-modal', '528px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("addMemberCP");
}
// 关联项目
function show_project() {
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/relate_project',:locals => {:homework=>@homework}) %>');
showModal('ajax-modal', '320px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("groupPopUp");
}
// 作品校验
function popupRegex(){
if(regexStudentWorkName()&&regexStudentWorkDescription())
{
if($("#group_member_ids").length > 0) {
if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) {
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("anonymos");
}
} else {
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("anonymos");
}
}
}
</script>
<div class="homepageRightBanner mb10">
<div class="NewsBannerName">提交作品</div>
</div>
<div class="cl"></div>
<div class="HomeWork" id="users_setting">
<div class="HomeWorkBox">
<div class="">
<div class="homepagePostTitle fl m_w530 hidden">
<%= @homework.name%>(作业名称)
</div>
<span class="fr c_grey">
截止时间:<%= @homework.end_time%>
</span>
<div class="cl"></div>
<a href="javascript:void(0);" class="c_blue">
<%= link_to @homework.user.show_name, user_activities_path(@homework.user_id), :class => "c_blue"%>
</a>
<div class="cl"></div>
<div class="HomeWorkP">
<%= @homework.description.html_safe %>
</div>
<div>
<%= render :partial => 'student_work/work_attachments', :locals => {:attachments => @homework.attachments} %>
<div class="cl"></div>
</div>
</div>
</div><!----HomeWorkBox end-->
<div class="cl"></div>
<div class="HomeWorkCon mt15">
<%= form_for(@student_work,
:html => { :multipart => true },
:url => {:controller => 'student_work',
:action => 'create',
:homework => @homework.id
},:remote=>true ) do |f| %>
<div class=" c_red mb10">
提示:作品名称和描述中不要出现真实的姓名信息
</div>
<div class="cl"></div>
<% if @homework.homework_type == 3 %>
<span id="min_num_member" style="display: none"><%=@homework.homework_detail_group.min_num %></span>
<span id="max_num_member" style="display: none"><%=@homework.homework_detail_group.max_num %></span>
<%=hidden_field_tag 'group_member_ids', params[:group_member_ids], :value=>User.current.id %>
<% end %>
<div>
<%= f.text_field "name", :required => true, :size => 60, :class => "InputBox W700", :maxlength => 200, :placeholder => "请简洁的概括作品的功能或特性", :onkeyup => "regexStudentWorkName();" %>
<div class="cl"></div>
<p id="student_work_name_span" class="c_red mb10"></p>
</div>
<div class="mt10">
<%= f.text_area "description", :class => "InputBox W700 H150", :placeholder => "请介绍你的作品", :onkeyup => "regexStudentWorkDescription();"%>
<script>
var text = document.getElementById("student_work_description");
autoTextarea(text);// 调用
</script>
<div class="cl"></div>
<p id="student_work_description_textarea" class="c_red mb10"></p>
</div>
<div id="homework_attachments">
<%= render :partial => 'users/user_homework_attachment', :locals => {:container => @student_work, :has_program=>false,:has_group=>false} %>
</div>
<div id="group_member">
</div>
<div id="relate_project">
</div>
<% if @homework.homework_type == 3 %>
<div class="mt5 fl">
<a href="javascript:void(0);" class="memberBtn fl mt3 mr15" title="请添加小组的其他成员" onclick="show_group_member();">合作成员</a>
</div>
<% end %>
<!--<div class="mt5 fl">
<a href="javascript:void(0);" class="RalationIcon fl mt3" title="请选择作业的关联项目" onclick="show_project();">关联项目</a>
</div>-->
<!--<div class="mt10 none" id="about_project">
<%#= select_tag :project_id, options_for_select(user_projects_option, @student_work.project_id), {:class => "InputBox W680 fl"} %>
<%#=link_to "", new_project_path, :class => "ml5 mt5 SetUpIcon fl", :title => "快速创建"%>
<a class=" ml5 mt5 SetUpIcon fl" href="javascript:void(0)" title="快速创建" onclick="new_project();"></a>
<div class="cl"></div>
</div>-->
<div class="mt5">
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="popupRegex();new_student_work();">提交</a>
<span class="fr mr10 mt3">或</span>
<%= link_to "取消", delete_work_student_work_index_path(:homework =>@homework.id), :class => "fr mr10 mt3"%>
</div>
<div class="cl"></div>
<% end%>
</div><!----HomeWorkCon end-->
</div>