socialforge/app/views/users/user_homeworks.html.erb

52 lines
1.8 KiB
Plaintext

<script type="text/javascript">
var scrollHandler = function(){
if ($(window).scrollTop() == $(document).height() - $(window).height()) {
$.get(
'<%= user_homeworks_user_path(User.current.id)%>',
{ page : $("#user_show_more_homework").val()},
function (data) {
}
);
}
};
$(window).scroll(scrollHandler);
function reset_homework(){
$("#homework_name").val("");
$("#homework_end_time").val("");
$("#course_id").val("");
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new })%>");
homework_description_editor.html("");
}
</script>
<% if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
<!-- 老师身份才可以发布作业 -->
<div class="resources mb10">
<div class="homepageRightBanner">
<div class="NewsBannerName">发布作业</div>
</div>
</div>
<div class="cl"></div>
<div class="HomeWork mb10">
<% homework = HomeworkCommon.new %>
<%= labelled_form_for homework,:url => user_new_homework_users_path,:method => "post" do |f| %>
<div id="HomeWorkCon">
<%= render :partial => 'users/user_homework_form', :locals => { :homework => homework,:f => f,:edit_mode => false } %>
</div>
<% end%>
</div><!----HomeWork end-->
<%else%>
<div class="resources mb10">
<div class="homepageRightBanner">
<div class="NewsBannerName">作业</div>
</div>
</div>
<div class="cl"></div>
<% end%>
<%= render :partial => 'users/user_homework_list', :locals => {:homework_commons => @homework_commons,:page => 0} %>