我发布的作业
This commit is contained in:
parent
111bf5a140
commit
e43ef02d57
|
@ -35,7 +35,7 @@ class UsersController < ApplicationController
|
|||
|
||||
#
|
||||
before_filter :can_show_course, :only => [:user_courses,:user_homeworks]
|
||||
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, :unsolved_issues_list, :unfinished_homework_list,
|
||||
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, :unsolved_issues_list, :unfinished_homework_list, :user_manage_homeworks,
|
||||
:unfinished_poll_list, :user_homeworks,:student_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments,
|
||||
:anonymous_evaluation_list,:unfinished_test_list, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index,
|
||||
:unapproval_applied_list, :activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
|
||||
|
@ -1830,6 +1830,39 @@ end
|
|||
end
|
||||
end
|
||||
|
||||
# 用户发布的作业
|
||||
def user_manage_homeworks
|
||||
@manage_homeworks = "我发布的作业"
|
||||
@order,@b_sort,@type = params[:order] || "created_at",params[:sort] || "desc", 1
|
||||
@r_sort = @b_sort == "desc" ? "asc" : "desc"
|
||||
@type = @type.to_i
|
||||
tea_courses = @user.courses.visible.not_deleted.select{|course| @user.has_teacher_role(course)}
|
||||
tea_course_ids = tea_courses.empty? ? "(-1)" : "(" + tea_courses.map{|course| course.id}.join(',') + ")"
|
||||
@homeworks = HomeworkCommon.where("course_id in #{tea_course_ids}").order("#{@order} #{@b_sort}")
|
||||
if params[:property]
|
||||
all_homework_ids = @homeworks.empty? ? "(-1)" : "(" + @homeworks.map{|h| h.id}.join(",") + ")"
|
||||
if params[:property] == "1"
|
||||
@homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 1")
|
||||
elsif params[:property] == "2"
|
||||
@homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 2")
|
||||
elsif params[:property] == "3"
|
||||
@homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 3")
|
||||
end
|
||||
end
|
||||
@limit = 10
|
||||
@is_remote = true
|
||||
@hw_count = @homeworks.count
|
||||
@hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1
|
||||
@offset ||= @hw_pages.offset
|
||||
@homeworks = paginateHelper @homeworks,@limit
|
||||
@search = ""
|
||||
@property = params[:property]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {render :layout => 'static_base'}
|
||||
end
|
||||
end
|
||||
|
||||
#我管理/收到的作业
|
||||
def manage_or_receive_homeworks
|
||||
@order,@b_sort,@type = params[:order] || "created_at",params[:sort] || "desc",params[:type] || 1
|
||||
|
|
|
@ -1352,6 +1352,8 @@ module ApplicationHelper
|
|||
title << @manage_issues
|
||||
elsif !@receive_issues.blank?
|
||||
title << @receive_issues
|
||||
elsif !@manage_homeworks.blank?
|
||||
title << @manage_homeworks
|
||||
else
|
||||
title << @user.try(:realname)
|
||||
end
|
||||
|
@ -2924,6 +2926,13 @@ module ApplicationHelper
|
|||
@user_course_total = @my_joined_course_count + @my_course_count
|
||||
end
|
||||
|
||||
# 用户发布的作业数
|
||||
def user_manage_homework_count
|
||||
tea_courses = @user.courses.visible.not_deleted.select{|course| @user.has_teacher_role(course)}
|
||||
tea_course_ids = tea_courses.map{|course| course.id}
|
||||
@manage_homeworks = HomeworkCommon.where(:course_id => tea_course_ids).count
|
||||
end
|
||||
|
||||
# 用户发布的issue数
|
||||
def issues_author_is_self_count
|
||||
@issues = Issue.where( :author_id => @user.id )
|
||||
|
|
|
@ -170,8 +170,14 @@
|
|||
<%= link_to user_course_count > 0 ? "课程<span class='issues_nav_tag mr10 fr' style='line-height:18px;margin-top: 9px;font-size: 11px;background-color:#f5f2f2;color:#666;'>#{user_course_count}</span>".html_safe : "课程",
|
||||
user_course_community_path(User.current), :id => "user_course_list", :target => "_blank" %>
|
||||
</li>
|
||||
<% if user_manage_homework_count %>
|
||||
<li class="home-user-leftnav-li icons-homework clear">
|
||||
<%= link_to user_manage_homework_count > 0 ? "我发布的作业<span class='issues_nav_tag mr10 fr' style='line-height:18px;margin-top:9px;font-size:11px;background-color:#f5f2f2;color:#666;'>#{user_manage_homework_count}</span>".html_safe : "我发布的作业",
|
||||
user_manage_homeworks_user_path(@user), :target => "_blank" %>
|
||||
</li>
|
||||
<% end %>
|
||||
<li class="home-user-leftnav-li icons-homework clear">
|
||||
<%=link_to '我的作业', my_homeworks_user_path(@user), :target => "_blank", :class => "fl", :style => "color:#666" %>
|
||||
<%= link_to '我收到的作业', my_homeworks_user_path(@user), :target => "_blank", :class => "fl", :style => "color:#666" %>
|
||||
</li>
|
||||
<li class="home-user-leftnav-li icons-doc clear">
|
||||
<%= link_to "题库", user_homeworks_user_path(User.current), :target => "_blank", :class => "fl", :style => "color:#666" %>
|
||||
|
|
|
@ -5,34 +5,20 @@
|
|||
<% else %>
|
||||
<% homeworks.each do |homework| %>
|
||||
<ul class="sy_classlist">
|
||||
<span class="hw_icons_cir fl mt5 mr5"></span>
|
||||
<span class="icons-user-homework homework-user-leftnav-li fl"></span>
|
||||
<div class="fl ">
|
||||
<h3 class="sy_classlist_title fl">
|
||||
<%= link_to homework.name, student_work_index_path(:homework => homework.id), :class => 'sy_cblack', :target => '_blank' %>
|
||||
<%= link_to homework.course.name+" / "+homework.name, student_work_index_path(:homework => homework.id), :class => 'sy_cblack', :target => '_blank' %>
|
||||
</h3>
|
||||
<div class="cl"></div>
|
||||
<p class="sy_cgrey clear">
|
||||
<span class="fl">来源:</span>
|
||||
<span class="hw_classname mr15 fl">
|
||||
<%= link_to homework.course.name, course_path(homework.course), :target => '_blank', :class => 'hw_cgrey' %>
|
||||
</span>
|
||||
<span class="mr15 fl">类别:<%=homework.homework_type_ch %></span>
|
||||
<span class="fl">作品:</span>
|
||||
<span class="sy_corange hw_w30 fl "><%=homework.student_works.has_committed.count %></span>
|
||||
<span class="fl">/</span>
|
||||
<span class="sy_cgrey hw_w30 fl mr15"><%= homework.homework_type == 3 ? '--' : homework.course.student.count %></span>
|
||||
<span class="fl">待评阅:</span>
|
||||
<span class="sy_corange hw_w30 fl"><%= homework.student_works.has_committed.where("teacher_score is null and teaching_asistant_score is null").count %></span>
|
||||
<span class="fl">/</span>
|
||||
<span class="sy_cgrey hw_w30 fl mr15"><%=homework.student_works.has_committed.count %></span>
|
||||
<span class="mr15 fl">发布时间:
|
||||
<% if homework.publish_time %>
|
||||
<%= format_date(homework.publish_time) %>
|
||||
<% else %>
|
||||
<span> -- </span>
|
||||
<% end %>
|
||||
</span>
|
||||
<span class="mr15 fl"><%=(cur_homework_end_time homework).html_safe %></span>
|
||||
<span class="mr15 fl"><%= (cur_homework_end_time homework).html_safe %></span>
|
||||
<span class="fl">未交:</span>
|
||||
<span class="sy_cgrey hw_w30 fl mr15"><%= homework.homework_type == 3 ? '--' : (homework.course.student.count - homework.student_works.has_committed.count) %></span>
|
||||
<span class="fl c_green">已评:</span>
|
||||
<span class="sy_cgrey hw_w30 fl mr15"><%= homework.student_works.has_committed.count - homework.student_works.has_committed.where("teacher_score is null and teaching_asistant_score is null").count %></span>
|
||||
<span class="fl c_red">未评:</span>
|
||||
<span class="sy_cgrey hw_w30 fl mr15"><%= homework.student_works.has_committed.count %></span>
|
||||
</p>
|
||||
</div>
|
||||
<% if homework.student_works.has_committed.count == 0 %>
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<span class="sy_cgrey ">排序:</span>
|
||||
<% if type == 1 %>
|
||||
<%= link_to "发布时间",search_m_r_homeworks_user_path(@user,:name=>search,:type => type,:property=>property,:order => "publish_time", :sort => @r_sort),:class => "sy_cgrey fl",:remote => true%>
|
||||
<%= link_to "发布时间",search_m_r_homeworks_user_path(@user,:name=>search,:type => type,:property => property,:order => "publish_time", :sort => @r_sort),:class => "sy_cgrey fl",:remote => true%>
|
||||
<% if order == "publish_time" %>
|
||||
<%= link_to "", search_m_r_homeworks_user_path(@user,:name=>search,:type => type,:property=>property,:order => "publish_time", :sort => @r_sort), :class => "#{@r_sort == 'asc' ? 'sortupbtn' : 'sortdownbtn'} mt15 fl", :remote => true %>
|
||||
<%= link_to "", search_m_r_homeworks_user_path(@user,:name=>search,:type => type, :property => property,:order => "publish_time", :sort => @r_sort), :class => "#{@r_sort == 'asc' ? 'sortupbtn' : 'sortdownbtn'} mt15 fl", :remote => true %>
|
||||
<% else %>
|
||||
<%= link_to "", search_m_r_homeworks_user_path(@user,:name=>search,:type => type,:property=>property,:order => "publish_time", :sort => @r_sort), :class => "sortdownbtn sort_no mt15 fl", :remote => true %>
|
||||
<%= link_to "", search_m_r_homeworks_user_path(@user,:name=>search,:type => type,:property => property,:order => "publish_time", :sort => @r_sort), :class => "sortdownbtn sort_no mt15 fl", :remote => true %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= link_to "状态", search_m_r_homeworks_user_path(@user,:name=>search,:type => type,:property=>property,:order => "status", :sort => @r_sort),:class => "sy_cgrey fl",:remote => true%>
|
||||
<%= link_to "状态", search_m_r_homeworks_user_path(@user,:name=>search,:type => type,:property => property,:order => "status", :sort => @r_sort),:class => "sy_cgrey fl",:remote => true%>
|
||||
<% if order == "status" %>
|
||||
<%= link_to "", search_m_r_homeworks_user_path(@user,:name=>search,:type => type,:property=>property,:order => "status", :sort => @r_sort), :class => "#{@r_sort == 'asc' ? 'sortupbtn' : 'sortdownbtn'} mt15 fl", :remote => true %>
|
||||
<% else %>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
</div>
|
||||
|
||||
<div class="hw_search_box fr mr10">
|
||||
<input class="hw_search-input" name="search" value='<%=search %>' placeholder="输入作业关键词进行搜索" type="text" >
|
||||
<input class="hw_search-input" name="search" value='<%= search %>' placeholder="输入作业关键词进行搜索" type="text" >
|
||||
<span class="hw_btn_search"></span>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
@ -17,7 +17,7 @@
|
|||
}
|
||||
lastSearchCondition = $(e.target).val().trim();
|
||||
$.ajax({
|
||||
url: '<%= url_for(:controller => 'users', :action => 'search_m_r_homeworks') %>'+'?name='+ e.target.value+'&type=<%=type %>&property=<%=property %>',
|
||||
url: '<%= url_for(:controller => 'users', :action => 'search_m_r_homeworks') %>'+'?name='+ e.target.value+'&type=<%= type %>&property=<%= property %>',
|
||||
type:'get'
|
||||
});
|
||||
}
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
<script type="text/javascript" language="javascript">
|
||||
function HoverLi(url){
|
||||
window.location.href = url;
|
||||
}
|
||||
</script>
|
||||
<div class="mt10 mb10">
|
||||
<div class="banner-big f16 fontGrey3" style="margin: 0 auto; position: relative;">
|
||||
我发布的的作业
|
||||
<div class="hw_more_box" >
|
||||
<ul>
|
||||
<li class="hw_more_icons fr">
|
||||
<ul class="hw_more_txt">
|
||||
<li> <a href="<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 0) %>" id="homework_type_all" class="hw_more_li" data-method="get" data-remote="true">全部作业</a> </li>
|
||||
<li> <a href="<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 1) %>" id="homework_type_nor" class="hw_more_li" data-method="get" data-remote="true">普通作业</a> </li>
|
||||
<li> <a href="<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 2) %>" id="homework_type_pro" class="hw_more_li" data-method="get" data-remote="true">编程作业</a> </li>
|
||||
<li> <a href="<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 3) %>" id="homework_type_gro" class="hw_more_li" data-method="get" data-remote="true">分组作业</a> </li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hw_content mb10" >
|
||||
<div id="hw_tab_con_2">
|
||||
<div class="sy_category" id="homework_search_input">
|
||||
<%=render :partial=>'my_homeworks_search', :locals => {:type => @type,:property => nil, :order => @order, :search => ''} %>
|
||||
</div>
|
||||
|
||||
<div class="sy_classbox" style="min-height:800px;" id="my_homework_list">
|
||||
<%= render :partial => "manage_homework_list", :locals => {:homeworks => @homeworks, :is_manage => 1} %>
|
||||
</div>
|
||||
|
||||
<div style="text-align:center;">
|
||||
<div class="pages" style="width:auto; display:inline-block;">
|
||||
<ul id="homework_list_ref_pages">
|
||||
<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true%>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,7 @@
|
|||
$("#my_homework_list").html('<%= escape_javascript(render :partial => "manage_homework_list", :locals => {:homeworks => @homeworks, :is_manage => 1})%>');
|
||||
$("#homework_list_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>');
|
||||
$("#my_homework_sort").html('<%= escape_javascript( render :partial => 'users/my_homework_sort', :locals => {:type => @type,:property => @property,:order => @order,:search => @search})%>');
|
||||
$("#homework_type_all").attr('href','<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 0) %>');
|
||||
$("#homework_type_nor").attr('href','<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 1) %>');
|
||||
$("#homework_type_pro").attr('href','<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 2) %>');
|
||||
$("#homework_type_gro").attr('href','<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 3) %>');
|
|
@ -739,6 +739,7 @@ RedmineApp::Application.routes.draw do
|
|||
match "user_issues", :to => 'users#user_issues', :via => [:get, :post], :as => "user_issues"
|
||||
match "user_manage_issues", :to => 'users#user_manage_issues', :via => [:get, :post], :as => "user_manage_issues"
|
||||
match "user_receive_issues", :to => 'users#user_receive_issues', :via => [:get, :post], :as => "user_receive_issues"
|
||||
match "user_manage_homeworks", :to => 'users#user_manage_homeworks', :via => [:get, :post], :as => "user_manage_homeworks"
|
||||
get "import_resources"
|
||||
get "import_resources_search"
|
||||
post "import_into_container"
|
||||
|
|
|
@ -879,3 +879,6 @@ input.btn-blue{background: #3b94d6; color: #fff; cursor:pointer;}
|
|||
input:hover.btn-blue{background: #2788d0; color: #fff;}
|
||||
input.btn-grey{background: #d9d9d9; color: #656565; cursor:default;}
|
||||
input.btn-grey:hover{background: #717171; color: #fff; cursor:default;}
|
||||
.icons-user-homework{background:url(/images/user/home-user-left.png) 0px -150px no-repeat; }
|
||||
.homework-user-leftnav-li{ height: 25px; line-height: 40px; padding-left: 25px; color: #666;background:url(/images/user/home-user-left.png) 0px -149px no-repeat; font-size: 14px; position: relative; }
|
||||
.homework-user-leftnav-li:hover{ height: 25px; line-height: 40px; padding-left: 25px; background:#f4f4f4; background:url(/images/user/home-user-left.png) 0px -186px no-repeat; font-size: 14px; position: relative; }
|
||||
|
|
Loading…
Reference in New Issue