From 6df40be30e0efe687205a494be5cea385576ac0c Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Tue, 21 Jul 2015 10:38:38 +0800 Subject: [PATCH 01/17] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=EF=BC=9A=E5=A6=82=E5=9B=BE=E2=80=9C=E5=8F=96=E6=B6=88=E2=80=9D?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E2=80=9C=E5=8F=96=E6=B6=88=E5=85=B3=E6=B3=A8?= =?UTF-8?q?=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_user_watch_btn.html.erb | 2 +- app/views/users/show.html.erb | 2 +- public/stylesheets/users.css | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/layouts/_user_watch_btn.html.erb b/app/views/layouts/_user_watch_btn.html.erb index 71eea7166..234b81152 100644 --- a/app/views/layouts/_user_watch_btn.html.erb +++ b/app/views/layouts/_user_watch_btn.html.erb @@ -1,7 +1,7 @@ <% if(User.current.logged? && User.current!=target)%> <%if(target.watched_by?(User.current))%> 取消 + 'user',:object_id=>target.id,:target_id=>target.id) %>" class="fr qx_btn mr10" data-method="delete" data-remote="true" title="取消关注">取消关注 <% else %> 关注 <% end %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index efe5d0539..e8db87a7e 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -32,7 +32,7 @@
diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index b3d16908d..d0893ca3d 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -73,6 +73,7 @@ h4{ font-size:14px; color:#3b3b3b;} .ml320{ margin-left:320px;} .mr5{ margin-right:5px;} .mr10{ margin-right:10px;} +.mr15 {margin-right: 15px;} .mr20{ margin-right:20px;} .mr30{ margin-right:30px;} .mr40{ margin-right:40px;} From 95af2ab20b62de40ca9e3cd0769368e050f48400 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 23 Jul 2015 10:33:54 +0800 Subject: [PATCH 10/17] =?UTF-8?q?=E4=BD=9C=E5=93=81=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E5=AF=BC=E5=87=BA=E5=88=97=E8=A1=A8=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=EF=BC=9A=20=E6=99=AE=E9=80=9A=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=EF=BC=9A=E4=B8=8D=E6=98=BE=E7=A4=BA=E5=8C=BF=E8=AF=84=E8=AF=84?= =?UTF-8?q?=E5=88=86=20=E5=8C=BF=E8=AF=84=E4=BD=9C=E4=B8=9A=EF=BC=9A?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=8C=BF=E8=AF=84=E8=AF=84=E5=88=86=20?= =?UTF-8?q?=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A=EF=BC=9A=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E8=AF=84=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 70 +++++++++++++++++----- config/locales/zh.yml | 1 + 2 files changed, 55 insertions(+), 16 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index da2575456..3e1e0ba29 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -468,22 +468,60 @@ class StudentWorkController < ApplicationController sheet1 = book.create_worksheet :name => "homework" blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10 sheet1.row(0).default_format = blue - sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name), - l(:excel_t_score),l(:excel_ta_score),l(:excel_n_score),l(:excel_f_score),l(:excel_commit_time)]) - count_row = 1 - items.each do |homework| - sheet1[count_row,0]=homework.user.id - sheet1[count_row,1] = homework.user.lastname.to_s + homework.user.firstname.to_s - sheet1[count_row,2] = homework.user.login - sheet1[count_row,3] = homework.user.user_extensions.student_id - sheet1[count_row,4] = homework.user.mail - sheet1[count_row,5] = homework.name - sheet1[count_row,6] = homework.teacher_score.nil? ? l(:label_without_score) : format("%.2f",homework.teacher_score) - sheet1[count_row,7] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : format("%.2f",homework.teaching_asistant_score) - sheet1[count_row,8] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score) - sheet1[count_row,9] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : format("%.2f",homework.score) : l(:label_without_score) - sheet1[count_row,10] = format_time(homework.created_at) - count_row += 1 + if @homework.homework_type == 0 #普通作业 + sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name), + l(:excel_t_score),l(:excel_ta_score),l(:excel_f_score),l(:excel_commit_time)]) + count_row = 1 + items.each do |homework| + sheet1[count_row,0]=homework.user.id + sheet1[count_row,1] = homework.user.lastname.to_s + homework.user.firstname.to_s + sheet1[count_row,2] = homework.user.login + sheet1[count_row,3] = homework.user.user_extensions.student_id + sheet1[count_row,4] = homework.user.mail + sheet1[count_row,5] = homework.name + sheet1[count_row,6] = homework.teacher_score.nil? ? l(:label_without_score) : format("%.2f",homework.teacher_score) + sheet1[count_row,7] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : format("%.2f",homework.teaching_asistant_score) + # sheet1[count_row,8] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score) + sheet1[count_row,8] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : format("%.2f",homework.score) : l(:label_without_score) + sheet1[count_row,9] = format_time(homework.created_at) + count_row += 1 + end + elsif @homework.homework_type == 1 #匿评作业 + sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name), + l(:excel_t_score),l(:excel_ta_score), l(:excel_n_score),l(:excel_f_score),l(:excel_commit_time)]) + count_row = 1 + items.each do |homework| + sheet1[count_row,0]=homework.user.id + sheet1[count_row,1] = homework.user.lastname.to_s + homework.user.firstname.to_s + sheet1[count_row,2] = homework.user.login + sheet1[count_row,3] = homework.user.user_extensions.student_id + sheet1[count_row,4] = homework.user.mail + sheet1[count_row,5] = homework.name + sheet1[count_row,6] = homework.teacher_score.nil? ? l(:label_without_score) : format("%.2f",homework.teacher_score) + sheet1[count_row,7] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : format("%.2f",homework.teaching_asistant_score) + sheet1[count_row,8] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score) + sheet1[count_row,9] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : format("%.2f",homework.score) : l(:label_without_score) + sheet1[count_row,10] = format_time(homework.created_at) + count_row += 1 + end + elsif @homework.homework_type == 2 #编程作业 + sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name), + l(:excel_t_score),l(:excel_ta_score), l(:excel_s_score),l(:excel_f_score),l(:excel_commit_time)]) + count_row = 1 + items.each do |homework| + sheet1[count_row,0]=homework.user.id + sheet1[count_row,1] = homework.user.lastname.to_s + homework.user.firstname.to_s + sheet1[count_row,2] = homework.user.login + sheet1[count_row,3] = homework.user.user_extensions.student_id + sheet1[count_row,4] = homework.user.mail + sheet1[count_row,5] = homework.name + sheet1[count_row,6] = homework.teacher_score.nil? ? l(:label_without_score) : format("%.2f",homework.teacher_score) + sheet1[count_row,7] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : format("%.2f",homework.teaching_asistant_score) + sheet1[count_row,8] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score) + sheet1[count_row,9] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : format("%.2f",homework.score) : l(:label_without_score) + sheet1[count_row,10] = format_time(homework.created_at) + count_row += 1 + end end book.write xls_report xls_report.string diff --git a/config/locales/zh.yml b/config/locales/zh.yml index b2faa6319..d89ecb4f5 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1835,6 +1835,7 @@ zh: excel_t_score: 教师评分 excel_ta_score: 教辅评分 excel_n_score: 匿名评分 + excel_s_score: 系统评分 excel_f_score: 成绩 excel_commit_time: 提交时间 excel_homework_score: 作业积分 From c2d41ab8db2ad8252da86128779ac1327d1faecb Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 23 Jul 2015 10:34:44 +0800 Subject: [PATCH 11/17] =?UTF-8?q?=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E7=9A=84=E4=B8=8A=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 50 +++++++++---------- app/views/homework_common/new.html.erb | 28 +++++++---- 2 files changed, 44 insertions(+), 34 deletions(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 333f86da1..4b655cf31 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -18,31 +18,31 @@ class HomeworkCommonController < ApplicationController end def new - @homework_type = "1" - - @homework = HomeworkCommon.new - @homework.safe_attributes = params[:homework_common] - @homework.late_penalty = 0 - @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') - @homework.publish_time = Time.now.strftime('%Y-%m-%d') - - if @homework_type == "1" - #匿评作业相关属性 - @homework_detail_manual = HomeworkDetailManual.new - @homework_detail_manual.ta_proportion = 0.6 - @homework_detail_manual.absence_penalty = 0 - @homework_detail_manual.evaluation_num = 3 - @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d') - @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d') - @homework.homework_detail_manual = @homework_detail_manual - elsif @homework_type == "2" - #编程作业相关属性 - @homework_detail_programing = HomeworkDetailPrograming.new - @homework.homework_detail_programing = @homework_detail_programing - end - respond_to do |format| - format.html - end + # @homework_type = "1" + # + # @homework = HomeworkCommon.new + # @homework.safe_attributes = params[:homework_common] + # @homework.late_penalty = 0 + # @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') + # @homework.publish_time = Time.now.strftime('%Y-%m-%d') + # + # if @homework_type == "1" + # #匿评作业相关属性 + # @homework_detail_manual = HomeworkDetailManual.new + # @homework_detail_manual.ta_proportion = 0.6 + # @homework_detail_manual.absence_penalty = 0 + # @homework_detail_manual.evaluation_num = 3 + # @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d') + # @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d') + # @homework.homework_detail_manual = @homework_detail_manual + # elsif @homework_type == "2" + # #编程作业相关属性 + # @homework_detail_programing = HomeworkDetailPrograming.new + # @homework.homework_detail_programing = @homework_detail_programing + # end + # respond_to do |format| + # format.html + # end end #新建作业下一步 diff --git a/app/views/homework_common/new.html.erb b/app/views/homework_common/new.html.erb index 6fc0fff0e..cdc2ceca0 100644 --- a/app/views/homework_common/new.html.erb +++ b/app/views/homework_common/new.html.erb @@ -1,17 +1,27 @@ -<%= javascript_include_tag "/assets/kindeditor/kindeditor" %> -<%= error_messages_for 'homework_common' %>