From d61eb60aba4dd670e8c22defb596a3de9399a6e4 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 31 Oct 2014 09:17:30 +0800 Subject: [PATCH 1/5] =?UTF-8?q?1.=E4=BD=9C=E4=B8=9A=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=8C=89=E6=97=B6=E9=97=B4=E3=80=81=E8=AF=84=E5=88=86=E7=9A=84?= =?UTF-8?q?=E5=8D=87=E5=BA=8F=E3=80=81=E9=99=8D=E5=BA=8F=E6=8E=92=E5=88=97?= =?UTF-8?q?=202.=E4=BF=AE=E6=94=B9=E5=8D=87=E5=BA=8F=E3=80=81=E9=99=8D?= =?UTF-8?q?=E5=BA=8F=E6=8E=92=E5=BA=8F=E5=88=A4=E6=96=AD=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E4=B8=8D=E6=AD=A3=E7=A1=AE=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_attach_controller.rb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index ff26d45b0..740823c81 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -12,13 +12,13 @@ class HomeworkAttachController < ApplicationController #获取未批作业列表 def get_not_batch_homework sort, direction = params[:sort], params[:direction] - order_by = sort == 'score'? "s_score #{direction}" : "created_at #{direction}" - + order_by = sort == 'socre'? "s_score #{direction}" : "created_at #{direction}" teachers = find_course_teachers @course all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM (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 NOT IN #{teachers}) AS s_score - FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY #{order_by}) AS table1 + FROM homework_attaches WHERE bid_id = #{@bid.id} + ORDER BY #{order_by}) AS table1 WHERE table1.t_score IS NULL") @homework_list = paginateHelper all_homework_list,10 @@ -31,13 +31,14 @@ class HomeworkAttachController < ApplicationController #获取已评作业列表 def get_batch_homeworks sort, direction = params[:sort], params[:direction] - teachers = find_course_teachers @course teacher_proportion = get_teacher_proportion @bid + order_by = sort == 'socre'? "(CASE WHEN t_score IS NULL THEN 0 ELSE t_score * #{teacher_proportion} END + CASE WHEN s_score IS NULL THEN 0 ELSE s_score * #{1 - teacher_proportion} END) #{direction}" : "created_at #{direction}" + teachers = find_course_teachers @course all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM (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} and stars IS NOT NULL) 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 FROM homework_attaches WHERE bid_id = #{@bid.id} - ORDER BY (CASE WHEN t_score IS NULL THEN 0 ELSE t_score * #{teacher_proportion} END + CASE WHEN s_score IS NULL THEN 0 ELSE s_score * #{1 - teacher_proportion} END) DESC,created_at ASC) AS table1 + ORDER BY #{order_by}) AS table1 WHERE table1.t_score IS NOT NULL") @homework_list = paginateHelper all_homework_list,10 @direction = direction == 'asc'? 'desc' : 'asc' @@ -49,13 +50,14 @@ class HomeworkAttachController < ApplicationController #获取所有作业列表 def get_homeworks sort, direction = params[:sort], params[:direction] - teachers = find_course_teachers @course teacher_proportion = get_teacher_proportion @bid + order_by = sort == 'socre'? "(CASE WHEN t_score IS NULL THEN 0 ELSE t_score * #{teacher_proportion} END + CASE WHEN s_score IS NULL THEN 0 ELSE s_score * #{1 - teacher_proportion} END) #{direction}" : "created_at #{direction}" + teachers = find_course_teachers @course all_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 not in #{teachers}) AS s_score FROM homework_attaches WHERE bid_id = #{@bid.id} - ORDER BY (CASE WHEN t_score IS NULL THEN 0 ELSE t_score * #{teacher_proportion} END + CASE WHEN s_score IS NULL THEN 0 ELSE s_score * #{1 - teacher_proportion} END) DESC,created_at ASC") + ORDER BY #{order_by}") @homework_list = paginateHelper all_homework_list,10 @direction = direction == 'asc'? 'desc' : 'asc' respond_to do |format| From 70495af3ef704f6a7e3e0901042a2f0b19dc4672 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 31 Oct 2014 09:48:34 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BC=B9=E5=87=BA?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/homework_attach/_show.html.erb | 10 +++++----- app/views/homework_attach/show.js.erb | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/views/homework_attach/_show.html.erb b/app/views/homework_attach/_show.html.erb index 268b5a55e..3c2840dbc 100644 --- a/app/views/homework_attach/_show.html.erb +++ b/app/views/homework_attach/_show.html.erb @@ -15,12 +15,12 @@
描 述 : - <%= f.text_area :description, :rows => 8, :name => "homework_description", :class => 'wiki-edit', :maxlength => 65534, :style => "font-size:small;width:490px;margin-left:10px;" %> + <%= f.text_area :description, :rows => 8, :name => "homework_description", :class => 'wiki-edit', :maxlength => 3000, :style => "font-size:small;width:490px;margin-left:10px;" %>
diff --git a/config/routes.rb b/config/routes.rb index 535f9aa9e..8cc79cf9d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -44,12 +44,12 @@ RedmineApp::Application.routes.draw do match 'add_jour_reply', :via => [:get,:post] match 'destroy_jour', :via => [:get,:post] match 'comprehensive_evaluation_jour', :via => [:get,:post] - end - member do get 'get_not_batch_homework' get 'get_batch_homeworks' get 'get_homeworks' get 'get_homework_jours' + end + member do match 'add_homework_users', :via => [:get,:post] match 'destory_homework_users', :via => [:get,:post] end From fd5b7ac468d29fd3fa1bbac537e33792812ebc73 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 31 Oct 2014 11:48:40 +0800 Subject: [PATCH 4/5] =?UTF-8?q?1.=E6=9B=B4=E6=96=B0css=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E6=96=87=E4=BB=B6=202.=E5=A2=9E=E5=8A=A0=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E5=9B=BE=E7=89=87=203.=E5=88=86=E9=A1=B5=E7=A9=BA=E9=97=B4?= =?UTF-8?q?=E6=94=AF=E6=8C=81ajax=E5=88=B7=E6=96=B0=E7=95=8C=E9=9D=A2=204.?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=86=E9=A1=B5=E6=8E=A7=E4=BB=B6=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/bids/_homework_list.html.erb | 2 +- .../homework_attach/_homeworks_list.html.erb | 3 +- .../get_batch_homeworks.js.erb | 3 +- .../homework_attach/get_homeworks.js.erb | 3 +- .../get_not_batch_homework.js.erb | 3 +- lib/redmine/pagination.rb | 48 +++++++++++++----- public/stylesheets/css.css | 46 +++++++++++++---- public/stylesheets/images/pic_ad.png | Bin 0 -> 521 bytes public/stylesheets/images/pic_ni.jpg | Bin 0 -> 11091 bytes public/stylesheets/images/pic_question.png | Bin 0 -> 502 bytes public/stylesheets/images/pic_top.jpg | Bin 0 -> 8817 bytes 11 files changed, 79 insertions(+), 29 deletions(-) create mode 100644 public/stylesheets/images/pic_ad.png create mode 100644 public/stylesheets/images/pic_ni.jpg create mode 100644 public/stylesheets/images/pic_question.png create mode 100644 public/stylesheets/images/pic_top.jpg diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb index 53ed014dd..ab067fdd0 100644 --- a/app/views/bids/_homework_list.html.erb +++ b/app/views/bids/_homework_list.html.erb @@ -32,7 +32,7 @@
@KF?02VbEyhavWNw_~@V6~N}oc@(-0t_<(-zj@vNybOLXkNCG
zNpM
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => remote%>
\ No newline at end of file
+<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => remote, :flag => true%>
\ No newline at end of file
diff --git a/lib/redmine/pagination.rb b/lib/redmine/pagination.rb
index 89af979bb..189c15d36 100644
--- a/lib/redmine/pagination.rb
+++ b/lib/redmine/pagination.rb
@@ -224,13 +224,14 @@ module Redmine
#per_page_links = options.delete(:per_page_links)
per_page_links = options[:per_page_links]
remote = options[:remote] ? options[:remote] : false
+ flag = options[:flag] ? options[:flag] : false
per_page_links = false if count.nil?
page_param = paginator.page_param
html = ''
if paginator.previous_page
# \xc2\xab(utf-8) = «
- if remote
+ if flag
text = l(:label_previous)
else
text = "\xc2\xab " + l(:label_previous)
@@ -239,7 +240,7 @@ module Redmine
end
unless paginator.previous_page
if paginator.next_page
- if remote
+ if flag
text = l(:label_previous)
else
text = "\xc2\xab " + l(:label_previous)
@@ -251,11 +252,15 @@ module Redmine
previous = nil
paginator.linked_pages.each do |page|
if previous && previous != page - 1
- html << '