题库的作业过滤
This commit is contained in:
parent
0cd536fcc9
commit
e2ff348075
|
@ -531,6 +531,13 @@ class UsersController < ApplicationController
|
|||
elsif params[:type] == "2" #我的题库
|
||||
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}'").order("created_at desc")
|
||||
end
|
||||
if params[:property] && params[:property] == "1"
|
||||
@homeworks = @homeworks.where("homework_type = 1").reorder("created_at desc")
|
||||
elsif params[:property] && params[:property] == "2"
|
||||
@homeworks = @homeworks.where("homework_type = 2").reorder("created_at desc")
|
||||
elsif params[:property] && params[:property] == "3"
|
||||
@homeworks = @homeworks.where("homework_type = 3").reorder("created_at desc")
|
||||
end
|
||||
@type = params[:type]
|
||||
@limit = 15
|
||||
@is_remote = true
|
||||
|
|
|
@ -8,4 +8,8 @@ $("#homework_repository").html('<%= escape_javascript(render :partial => 'users/
|
|||
$("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
|
||||
$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil}) %>");
|
||||
$("#homework_search_input").html("<%=escape_javascript(render :partial=>'homework_search_input', :locals=>{:type=>@type,:is_import=>@is_import}) %>");
|
||||
$("#homework_type_all").attr('href','<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 0) %>');
|
||||
$("#homework_type_nor").attr('href','<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 1) %>');
|
||||
$("#homework_type_pro").attr('href','<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 2) %>');
|
||||
$("#homework_type_gro").attr('href','<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 3) %>');
|
||||
<% end %>
|
||||
|
|
|
@ -45,10 +45,10 @@
|
|||
<ul class="resourcesSelect">
|
||||
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
|
||||
<ul class="resourcesType">
|
||||
<li> <a href="/users/8523/user_resource?type=1" class="resourcesTypeAll resourcesGrey" data-method="get" data-remote="true">全部</a> </li>
|
||||
<li> <a href="/users/8523/user_resource?type=2" class="homepagePostTypeAssignment postTypeGrey" data-method="get" data-remote="true">普通作业</a> </li>
|
||||
<li> <a href="/users/8523/user_resource?type=3" class="program-btn postTypeGrey" data-method="get" data-remote="true" style="white-space:nowrap;">编程作业</a> </li>
|
||||
<li> <a href="/users/8523/user_resource?type=5" class="group-btn resourcesGrey" data-method="get" data-remote="true">分组作业</a> </li>
|
||||
<li> <a href="<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 0) %>" id="homework_type_all" class="resourcesTypeAll resourcesGrey" data-method="get" data-remote="true">全部</a> </li>
|
||||
<li> <a href="<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 1) %>" id="homework_type_nor" class="homepagePostTypeAssignment postTypeGrey" data-method="get" data-remote="true">普通作业</a> </li>
|
||||
<li> <a href="<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 2) %>" id="homework_type_pro" class="program-btn postTypeGrey" data-method="get" data-remote="true" style="white-space:nowrap;">编程作业</a> </li>
|
||||
<li> <a href="<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 3) %>" id="homework_type_gro" class="group-btn resourcesGrey" data-method="get" data-remote="true">分组作业</a> </li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
$("#homework_repository").html('<%= escape_javascript(render :partial => 'users/homework_repository', :locals => {:homeworks => @homeworks})%>');
|
||||
$("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
|
||||
$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil}) %>");
|
||||
/*$("#user_show_more_homework").replaceWith("<%#= escape_javascript( render :partial => 'users/user_homework_list',:locals => {:homework_commons => @homework_commons, :page => @page,:is_in_course => 0} )%>");*/
|
||||
|
||||
|
|
|
@ -1099,3 +1099,6 @@ a.resource-tab-active {color:#fff; background-color:#269ac9; border-bottom:1px s
|
|||
.resource-pop-from {width:120px; text-align:center;}
|
||||
|
||||
.course-search {border: 1px solid #dddddd; height: 25px; width: 200px;outline: none;}
|
||||
|
||||
a.group-btn{ background: url(../images/course/hwork_icon.png) -2px -58px no-repeat !important; height:20px; display:block; padding-left:23px; color:#888888; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;}
|
||||
a.program-btn{background: url(../images/homepage_icon.png) -86px -393px no-repeat; width:30px; height:20px; display:block; padding-left:23px; color:#888888;}
|
||||
|
|
Loading…
Reference in New Issue