1.获取作业列表时增加老师和学生的判断

2.增加学生进入作业列表时的界面
This commit is contained in:
sw 2014-10-31 15:28:04 +08:00
parent 9b64027ed6
commit a3c5d7eb5e
5 changed files with 55 additions and 49 deletions

View File

@ -489,14 +489,8 @@ class BidsController < ApplicationController
if @bid.homework_type
@homework = HomeworkAttach.new
if @bid.proportion
teacher_proportion = @bid.proportion * 1.0 / 100
else
teacher_proportion = 1.0
end
#@homework_list = @bid.homeworks
#增加作业按评分排序,
#@homework_list = @bid.homeworks.eager_load(:rate_averages, :user, :attachments).order('seems_rateable_cached_ratings.avg DESC').order("#{HomeworkAttach.table_name}.created_at ASC")
@is_teacher = is_course_teacher(User.current,@bid.courses.first)
#if @is_teacher
teachers = "("
teacher_members = searchTeacherAndAssistant(@bid.courses.first)
teacher_members.each do |member|
@ -511,15 +505,12 @@ class BidsController < ApplicationController
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN #{teachers}) AS s_score
FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY s_score DESC,created_at ASC) AS table1
WHERE table1.t_score IS NULL")
#else
# all_homework_list = HomeworkAttach.all
#end
@homework_list = paginateHelper all_homework_list,10
#limit = 10
#feedback_count = all_homework_list.count
#@feedback_pages = Paginator.new feedback_count, limit, params['page']
#offset ||= @feedback_pages.offset
#@homework_list = all_homework_list[offset, limit]
if params[:student_id].present?
@temp = []
@homework_list.each do |pro|

View File

@ -1,39 +1,54 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>作业列表页_老师界面</title>
<script type="text/javascript" language="javascript">
function HoverLi(n){
for(var i=1;i<=5;i++){$("#tb_"+i).className("normaltab");}$("#tb_"+n).className("hovertab");
}
</script>
<%= stylesheet_link_tag 'css', :media => 'all' %>
</head>
<body>
<div id="content">
<div id="tb_" class="tb_">
<% if @is_teacher %>
<ul>
<li id="tb_1" class="hovertab">
<%= link_to "未批作业", get_not_batch_homework_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%>
<%= link_to "未批作品", get_not_batch_homework_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%>
</li>
<li id="tb_2" class="normaltab">
<%= link_to "已改作业", get_batch_homeworks_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%>
<%= link_to "已改作品", get_batch_homeworks_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%>
</li>
<li id="tb_3" class="normaltab">
<%= link_to "全部作业", get_homeworks_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%>
<%= link_to "全部作品", get_homeworks_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%>
</li>
<li id="tb_4" class="normaltab" onclick="o:HoverLi(4);"><a href="#">作业下载</a></li>
<li id="tb_5" class="normaltab">
<li id="tb_4" class="normaltab">
<%= link_to "留言", get_homework_jours_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%>
(<span class="c_red f_12">23</span>)
</li>
<li >
<%= link_to "作品打包下载", zipdown_assort_path(obj_class: @bid.class, obj_id: @bid), class: "tb_all" unless @bid.homeworks.empty? %>
</li>
</ul>
<% else %>
<ul>
<li id="tb_1" class="hovertab">待评作品
</li>
<li id="tb_2" class="normaltab">我的作品
</li>
<li id="tb_3" class="normaltab">
<%= link_to "所有作品", get_homeworks_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%>
</li>
<li id="tb_4" class="normaltab">
<%= link_to "留言", get_homework_jours_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%>
(<span class="c_red f_12">23</span>)
</li>
</ul>
<% end %>
</div>
<div class="cl"></div>
<div class="ctt">
<div class="dis" id="tbc_01">
<%= render :partial => 'homework_attach/homeworks_list', :locals => {:homeworks => @homework_list, :homework_count => @obj_count, :bid => @bid, :remote => false}%>
</div><!---未批作业结束-->
</div>
</div>
</div>

View File

@ -1,4 +1,4 @@
$('#tbc_01').html('<%= escape_javascript(render(:partial => 'homeworks_list',
:locals => {:homeworks => @homework_list, :homework_count => @obj_count, :bid => @bid, :remote => true} )) %>');
for(var i=1;i<=5;i++){$("#tb_"+i).removeClass().addClass("normaltab");}
for(var i=1;i<=4;i++){$("#tb_"+i).removeClass().addClass("normaltab");}
$("#tb_2").removeClass().addClass("hovertab");

View File

@ -1,3 +1,3 @@
$('#tbc_01').html('<%= escape_javascript(render(:partial => 'homework_jours' )) %>');
for(var i=1;i<=5;i++){$("#tb_"+i).removeClass().addClass("normaltab");}
$("#tb_5").removeClass().addClass("hovertab");
for(var i=1;i<=4;i++){$("#tb_"+i).removeClass().addClass("normaltab");}
$("#tb_4").removeClass().addClass("hovertab");

View File

@ -1,5 +1,5 @@
$('#tbc_01').html('<%= escape_javascript(render(:partial => 'homeworks_list',
:locals => {:homeworks => @homework_list, :homework_count => @obj_count, :bid => @bid, :remote => true} )) %>');
for(var i=1;i<=5;i++){$("#tb_"+i).removeClass().addClass("normaltab");}
for(var i=1;i<=4;i++){$("#tb_"+i).removeClass().addClass("normaltab");}
$("#tb_3").removeClass().addClass("hovertab");