1.修改分页,使用封装好的分页方法
2.修正作业总数统计 3.修改留言界面样式 4.修正点击各个标签页之后TAB的显示样式
This commit is contained in:
parent
3fa5a4b3c5
commit
f65a852bc8
|
@ -506,15 +506,15 @@ class BidsController < ApplicationController
|
||||||
teachers += member.user_id.to_s + ","
|
teachers += member.user_id.to_s + ","
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
limit = 10
|
all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM (SELECT homework_attaches.*,
|
||||||
start_item = params['page'].nil? ? 0 : (params['page'].to_i - 1) * limit
|
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN #{teachers}) AS t_score,
|
||||||
@homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*,
|
(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
|
||||||
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id in #{teachers}) AS t_score,
|
FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY s_score DESC,created_at ASC) AS table1
|
||||||
(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
|
WHERE table1.t_score IS NULL")
|
||||||
FROM homework_attaches WHERE bid_id = #{@bid.id}
|
|
||||||
ORDER BY s_score DESC,created_at ASC
|
|
||||||
limit #{start_item}, #{limit}")
|
|
||||||
|
|
||||||
|
@homework_list = paginateHelper all_homework_list,10
|
||||||
|
|
||||||
|
#limit = 10
|
||||||
#feedback_count = all_homework_list.count
|
#feedback_count = all_homework_list.count
|
||||||
#@feedback_pages = Paginator.new feedback_count, limit, params['page']
|
#@feedback_pages = Paginator.new feedback_count, limit, params['page']
|
||||||
#offset ||= @feedback_pages.offset
|
#offset ||= @feedback_pages.offset
|
||||||
|
|
|
@ -12,14 +12,13 @@ class HomeworkAttachController < ApplicationController
|
||||||
#获取未批作业列表
|
#获取未批作业列表
|
||||||
def get_not_batch_homework
|
def get_not_batch_homework
|
||||||
teachers = find_course_teachers @course
|
teachers = find_course_teachers @course
|
||||||
limit = 10
|
all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM (SELECT homework_attaches.*,
|
||||||
start_item = params['page'].nil? ? 0 : (params['page'].to_i - 1) * limit
|
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN #{teachers}) AS t_score,
|
||||||
@homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*,
|
(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
|
||||||
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id in #{teachers}) AS t_score,
|
FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY s_score DESC,created_at ASC) AS table1
|
||||||
(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
|
WHERE table1.t_score IS NULL")
|
||||||
FROM homework_attaches WHERE bid_id = #{@bid.id}
|
|
||||||
ORDER BY s_score DESC,created_at ASC
|
@homework_list = paginateHelper all_homework_list,10
|
||||||
limit #{start_item}, #{limit}")
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
end
|
end
|
||||||
|
@ -28,14 +27,12 @@ class HomeworkAttachController < ApplicationController
|
||||||
#获取已评作业列表
|
#获取已评作业列表
|
||||||
def get_batch_homeworks
|
def get_batch_homeworks
|
||||||
teachers = find_course_teachers @course
|
teachers = find_course_teachers @course
|
||||||
limit = 10
|
all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM (SELECT homework_attaches.*,
|
||||||
start_item = params['page'].nil? ? 0 : (params['page'].to_i - 1) * limit
|
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN #{teachers} and stars IS NOT NULL) AS t_score,
|
||||||
@homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*,
|
(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
|
||||||
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id in #{teachers}) AS t_score,
|
FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY s_score DESC,created_at ASC) AS table1
|
||||||
(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
|
WHERE table1.t_score IS NOT NULL")
|
||||||
FROM homework_attaches WHERE bid_id = #{@bid.id}
|
@homework_list = paginateHelper all_homework_list,10
|
||||||
ORDER BY s_score DESC,created_at ASC
|
|
||||||
limit #{start_item}, #{limit}")
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
end
|
end
|
||||||
|
@ -44,14 +41,12 @@ class HomeworkAttachController < ApplicationController
|
||||||
#获取所有作业列表
|
#获取所有作业列表
|
||||||
def get_homeworks
|
def get_homeworks
|
||||||
teachers = find_course_teachers @course
|
teachers = find_course_teachers @course
|
||||||
limit = 10
|
all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*,
|
||||||
start_item = params['page'].nil? ? 0 : (params['page'].to_i - 1) * limit
|
|
||||||
@homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*,
|
|
||||||
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id in #{teachers}) AS t_score,
|
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id in #{teachers}) AS t_score,
|
||||||
(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
|
(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}
|
FROM homework_attaches WHERE bid_id = #{@bid.id}
|
||||||
ORDER BY s_score DESC,created_at ASC
|
ORDER BY s_score DESC,created_at ASC")
|
||||||
limit #{start_item}, #{limit}")
|
@homework_list = paginateHelper all_homework_list,10
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
end
|
end
|
||||||
|
|
|
@ -36,5 +36,5 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div id='bidding_project_list'>
|
<div id='bidding_project_list'>
|
||||||
<%= render :partial => 'homework_list', :locals => {:homework => @homework_list} %>
|
<%= render :partial => 'homework_list' %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -13,17 +13,17 @@
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<div id="tb_" class="tb_">
|
<div id="tb_" class="tb_">
|
||||||
<ul>
|
<ul>
|
||||||
<li id="tb_1" class="hovertab" onclick="a:HoverLi(1);">
|
<li id="tb_1" class="hovertab">
|
||||||
<%= link_to "未批作业", get_not_batch_homework_homework_attach_path(@bid), {:remote => true}%>
|
<%= link_to "未批作业", get_not_batch_homework_homework_attach_path(@bid), {:remote => true}%>
|
||||||
</li>
|
</li>
|
||||||
<li id="tb_2" class="normaltab" onclick="a:HoverLi(2);">
|
<li id="tb_2" class="normaltab">
|
||||||
<%= link_to "已改作业", get_batch_homeworks_homework_attach_path(@bid), {:remote => true}%>
|
<%= link_to "已改作业", get_batch_homeworks_homework_attach_path(@bid), {:remote => true}%>
|
||||||
</li>
|
</li>
|
||||||
<li id="tb_3" class="normaltab" onclick="a:HoverLi(3);">
|
<li id="tb_3" class="normaltab">
|
||||||
<%= link_to "全部作业", get_homeworks_homework_attach_path(@bid), {:remote => true}%>
|
<%= link_to "全部作业", get_homeworks_homework_attach_path(@bid), {:remote => true}%>
|
||||||
</li>
|
</li>
|
||||||
<li id="tb_4" class="normaltab" onclick="o:HoverLi(4);"><a href="#">作业下载</a></li>
|
<li id="tb_4" class="normaltab" onclick="o:HoverLi(4);"><a href="#">作业下载</a></li>
|
||||||
<li id="tb_5" class="normaltab" onclick="g:HoverLi(5);">
|
<li id="tb_5" class="normaltab">
|
||||||
<%= link_to "留言", get_homework_jours_homework_attach_path(@bid), {:remote => true}%>
|
<%= link_to "留言", get_homework_jours_homework_attach_path(@bid), {:remote => true}%>
|
||||||
(<span class="c_red f_12">23</span>)
|
(<span class="c_red f_12">23</span>)
|
||||||
</li>
|
</li>
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<div class="ctt">
|
<div class="ctt">
|
||||||
<div class="dis" id="tbc_01">
|
<div class="dis" id="tbc_01">
|
||||||
<%= render :partial => 'homework_attach/homeworks_list', :locals => {:homeworks => homework}%>
|
<%= render :partial => 'homework_attach/homeworks_list', :locals => {:homeworks => @homework_list, :homework_count => @obj_count}%>
|
||||||
</div><!---未批作业结束-->
|
</div><!---未批作业结束-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<div class="msg_box">
|
<div class="msg_box">
|
||||||
<h4>留言内容</h4>
|
<h4>留言内容</h4>
|
||||||
<textarea id="ta_msg_content" name="content" placeholder="最多250个字" ></textarea>
|
<textarea id="ta_msg_content" name="content" placeholder="最多250个字"></textarea>
|
||||||
<a href="#">取 消</a><a href="#">留 言</a>
|
<a href="#">取 消</a><a href="#">留 言</a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<span>
|
<span>
|
||||||
<%= l(:label_homework_list)%>
|
<%= l(:label_homework_list)%>
|
||||||
(<font color="#CC0000">
|
(<font color="#CC0000">
|
||||||
<%= homeworks.count unless homeworks.nil?%>
|
<%= homework_count%>
|
||||||
</font>)
|
</font>)
|
||||||
</span><span class="fr">
|
</span><span class="fr">
|
||||||
按
|
按
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
<%= link_to homework_filename , homework_attach_path(homework), :title => homework_filename%>
|
<%= link_to homework_filename , homework_attach_path(homework), :title => homework_filename%>
|
||||||
</li>
|
</li>
|
||||||
<li class="wdown">
|
<li class="wdown">
|
||||||
<%= link_to "#{homework.attachments.count.to_s}个附件", zipdown_download_user_homework_path(:homework => homework)%>
|
<%= link_to "(#{homework.attachments.count.to_s}个附件)", zipdown_download_user_homework_path(:homework => homework)%>
|
||||||
</li>
|
</li>
|
||||||
<li class="wscore">
|
<li class="wscore">
|
||||||
<%= l(:label_teacher_score)%>:
|
<%= l(:label_teacher_score)%>:
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
$('#tbc_01').html('<%= escape_javascript(render(:partial => 'homeworks_list', :locals => {:homeworks => @homework_list} )) %>');
|
$('#tbc_01').html('<%= escape_javascript(render(:partial => 'homeworks_list', :locals => {:homeworks => @homework_list, :homework_count => @obj_count} )) %>');
|
||||||
|
for(var i=1;i<=5;i++){$("#tb_"+i).removeClass().addClass("normaltab");}
|
||||||
|
$("#tb_2").removeClass().addClass("hovertab");
|
|
@ -1 +1,3 @@
|
||||||
$('#tbc_01').html('<%= escape_javascript(render(:partial => 'homework_jours' )) %>');
|
$('#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");
|
|
@ -1,2 +1,4 @@
|
||||||
$('#tbc_01').html('<%= escape_javascript(render(:partial => 'homeworks_list', :locals => {:homeworks => @homework_list} )) %>');
|
$('#tbc_01').html('<%= escape_javascript(render(:partial => 'homeworks_list', :locals => {:homeworks => @homework_list, :homework_count => @obj_count} )) %>');
|
||||||
|
for(var i=1;i<=5;i++){$("#tb_"+i).removeClass().addClass("normaltab");}
|
||||||
|
$("#tb_3").removeClass().addClass("hovertab");
|
||||||
|
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
$('#tbc_01').html('<%= escape_javascript(render(:partial => 'homeworks_list', :locals => {:homeworks => @homework_list} )) %>');
|
$('#tbc_01').html('<%= escape_javascript(render(:partial => 'homeworks_list', :locals => {:homeworks => @homework_list, :homework_count => @obj_count} )) %>');
|
||||||
|
for(var i=1;i<=5;i++){$("#tb_"+i).removeClass().addClass("normaltab");}
|
||||||
|
$("#tb_1").removeClass().addClass("hovertab");
|
|
@ -53,7 +53,7 @@ ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; }
|
||||||
.c_grey{ color:#999; font-weight:normal;}
|
.c_grey{ color:#999; font-weight:normal;}
|
||||||
|
|
||||||
.msg_box{ width:693px; height:170px; border-bottom:1px dashed #CCC; padding-top:20px;}
|
.msg_box{ width:693px; height:170px; border-bottom:1px dashed #CCC; padding-top:20px;}
|
||||||
.msg_box h4{ margin-left:15px;}
|
.msg_box h4{ margin-left:15px;border-style: none;}
|
||||||
.msg_box textarea{width:660px;height:90px;padding:2px;overflow:hidden;background-color: #ffffff; border:1px solid #CCC; margin:5px 15px; color:#666; font-size:12px;}
|
.msg_box textarea{width:660px;height:90px;padding:2px;overflow:hidden;background-color: #ffffff; border:1px solid #CCC; margin:5px 15px; color:#666; font-size:12px;}
|
||||||
.msg_box a{ float:right; display:block; width:50px; height:22px; background:#15bccf; color:#fff; margin-right:10px; text-align:center; margin-top:5px; }
|
.msg_box a{ float:right; display:block; width:50px; height:22px; background:#15bccf; color:#fff; margin-right:10px; text-align:center; margin-top:5px; }
|
||||||
.msg_box a:hover{ background-color:#03a1b3; text-decoration:none;}
|
.msg_box a:hover{ background-color:#03a1b3; text-decoration:none;}
|
||||||
|
|
Loading…
Reference in New Issue