<style type="text/css">
#attachments_fields input.description {
	width: auto;
}
</style>
<%= javascript_include_tag 'attachments' %>
<!-- fq -->
<!--modified by huang-->
<div class="content-title-top">
	<% if User.current.logged? && (User.current.admin? || (!Member.where('user_id = ? and project_id = ?', User.current.id, @project.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @project.id).first.roles&Role.where(id: [3, 4, 7, 9] )).size >0))%>		
		<%= link_to(l(:label_course_homework_new), {:controller => 'projects', :action => 'new_homework'}, :class => 'icon icon-add') %>			
	<% end %>
</div>
<div id="bid-show">
	<%= render :partial => 'bids/bid_homework_show', :locals => {:bids => @bids, :bid_pages => @bid_pages} %>
</div>

<div id="OpenWindow">
    <div id="signup-ct">
        <div id="OpenWindow-header">
            <h1> 课程: <%= @project.name%> </h1>
            <p id='bid-desc'>  上传作业 </p>
            <a href="javascript:void(0);" class="modal_close"></a>
        </div>
        <div id="OpenWindow-content">

        </div>
    </div>
</div>
<script type="text/javascript">
$("a[rel*=leanModal]").leanModal({
	top:100,
	closeButton: ".modal_close"
});

function showSubH(/* ... */){
	var id, name, numargs = arguments.length;

	id   = arguments[0];
	name = arguments[1];

	$("#OpenWindow").find("#bid-desc").html('作业名: '+name);

	post_url = '/bids/' + id + '/homework_ajax_modal.js'
	function deal_post (data, textStatus, xhr) {
		if(textStatus == 'success'){
			eval(data);
		}
		if(textStatus != 'success'){
			$('#OpenWindow-content').html('<span class=\"font_color_orange\" > ' + textStatus + ' <\/span>\n');
		}
	}
	function deal_error (argument) {
		$('#OpenWindow-content').html('<strong>Network Error</strong><span class=\"font_color_orange\" > <br/>http_status:' + argument.status + '<br/>statusText:' + argument.statusText + ' <\/span>\n');
	}
	$.post(post_url,{}, deal_post).error(deal_error);
}
</script>

