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/users.css b/public/stylesheets/users.css index 81529288c..446f0e607 100644 --- a/public/stylesheets/users.css +++ b/public/stylesheets/users.css @@ -97,7 +97,7 @@ a.select_btn_select{ background:#64bddb; color:#fff;} /* 个人主页*/ a.gz_btn{display:block; background:url(../images/pic_uersall.png) -318px -25px no-repeat; width:33px; height:18px; border:1px solid #cdcdcd; color:#333333; padding:0px 0 0 18px;} a:hover.gz_btn{ color:#ff5722;} -a.qx_btn{display:block; background:url(../images/pic_uersall.png) -318px -47px no-repeat; width:33px; height:18px; border:1px solid #cdcdcd; color:#333333; padding:0px 0 0 18px;} +a.qx_btn{display:block; background:url(../images/pic_uersall.png) -318px -47px no-repeat; width:53px; height:18px; border:1px solid #cdcdcd; color:#333333; padding:0px 0 0 18px;} a:hover.qx_btn{color:#64bdd9;} a.c_lgrey{ color:#CCC;} a:hover.c_lgrey{ color:#3ca5c6;} From 8c47e6ca1fe2a065e6add78279aa90f69b3f98f8 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Tue, 21 Jul 2015 15:47:54 +0800 Subject: [PATCH 02/17] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5--?= =?UTF-8?q?=E2=80=9C=E6=88=91=E7=9A=84=E8=AF=BE=E7=A8=8B=E2=80=9D=E3=80=81?= =?UTF-8?q?=E2=80=9C=E6=88=91=E7=9A=84=E9=A1=B9=E7=9B=AE=E2=80=9D=E4=B8=8D?= =?UTF-8?q?=E6=98=AF=E4=B8=8B=E6=8B=89=E6=A1=86=E5=8D=B4=E5=81=9A=E6=88=90?= =?UTF-8?q?=E4=B8=8B=E6=8B=89=E6=A1=86=E7=9A=84=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_users_new.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/base_users_new.html.erb b/app/views/layouts/base_users_new.html.erb index ef6d82245..3c61916a2 100644 --- a/app/views/layouts/base_users_new.html.erb +++ b/app/views/layouts/base_users_new.html.erb @@ -200,7 +200,7 @@ $(".subNav").click(function(){ <% if @center_flag %> From 74c50e155ab97a7ccf26b6b6acf41f6c2876e077 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Wed, 22 Jul 2015 17:46:37 +0800 Subject: [PATCH 06/17] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E7=9A=84=E5=8A=A0=E5=85=A5=E8=AF=BE=E7=A8=8B=E4=B8=BA-1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/users_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index d4f9e4eb8..558be15e2 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -335,7 +335,7 @@ module UsersHelper return Course.where("tea_id = ?",user.id).count() end def get_join_course_count(user) - return user.coursememberships.count() - get_create_course_count(user) + ((user.coursememberships.count() - get_create_course_count(user)) < 0) ? 0 : user.coursememberships.count() - get_create_course_count(user) end def get_homework_commons_count(user) return HomeworkCommon.where("user_id = ?",user.id).count() From c0eea861320bca3e80fbe69eea7db742a1bd5c68 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 23 Jul 2015 10:12:07 +0800 Subject: [PATCH 07/17] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=9A=84=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_programing_work_show.html.erb | 41 +++++++++++-------- public/stylesheets/courses.css | 14 +++++-- 2 files changed, 36 insertions(+), 19 deletions(-) diff --git a/app/views/student_work/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb index 9b5035a04..667baba62 100644 --- a/app/views/student_work/_programing_work_show.html.erb +++ b/app/views/student_work/_programing_work_show.html.erb @@ -23,35 +23,44 @@
+
  • 测试结果: - - - - - - - - - - - - - + + + + + <%@homework.homework_tests.each do |test|%> "> - - <% student_work_test = StudentWorkTest.where(:homework_test_id => test.id,:student_work_id => @work.id).first%> - + <% end%> + <% student_work_test = @work.student_work_test.first%> + <% if student_work_test && student_work_test.error_msg && !student_work_test.error_msg.empty?%> + + + + + <% end%> + + +
    输入输出测试结果
    + + <%= student_work_test.nil? ? "正在编译" : student_work_test.status_to_s%><%= student_work_test.nil? ? "正在编译" : student_work_test.status_to_s%>
    编程错误信息编程错误信息编程错误信息编程错误信息编程错误信息编程错误信息编程错误信息编程错误信息编程错误信息编程错误信息编程错误信息编程错误信息编程错误信息编程错误信息编程错误信息编程错误信息编程错误信息编程错误信息编程错误信息
    +
    +
  • + +
  • 测试结果: + +
    diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 5a7bb001a..778a474cd 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -685,12 +685,18 @@ input#score{ width:40px;} .ui-slider .ui-slider-handle:hover,.ui-slider .ui-slider-handle:focus{background:#64bdd9;} .ui-slider .ui-slider-handle:active{background-image:none;} .ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;top:0;height:100%;background:#64bdd9;left:0;} + /* 编程作品 */ .border_ce{ border:1px solid #e4e4e4; } .border_ce tr td{ height:26px; } -.td_tit{width:155px; text-align:center;} -.td_50{width:50px; text-align:center;} -a.work_list_tit{width:610px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} +.td_tit{width:170px; text-align:center;} +.td_50{width:60px; text-align:center;} +a.work_list_tit{width:580px; display:block; overflow:hidden; font-size:14px; font-weight:bold; white-space: nowrap; text-overflow:ellipsis;} +.work_list_pro{ width:670px;} +.border_l{border-left:1px solid #e4e4e4;} +.border_t{ border-top:1px solid #e4e4e4;} +.td_end{border-top:1px solid #e4e4e4; height:auto; padding:5px; } +.c_w{ color:#fff;} .filename { background: url(../images/pic_file.png) 0 -25px no-repeat;color: #3ca5c6;max-width: 150px;border: none; padding-left: 20px;margin-right: 10px;margin-bottom: 5px; white-space: nowrap; text-overflow:ellipsis;} .evaluation{position: relative;} @@ -708,3 +714,5 @@ a:hover.about_me{ color:#0781b4;} + + From 69024b248930e1ae10bc63491b878679e0b990e8 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 23 Jul 2015 10:14:55 +0800 Subject: [PATCH 08/17] =?UTF-8?q?=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E5=87=BA=E9=94=99=E6=97=B6=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=9A=84=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/_programing_work_show.html.erb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/student_work/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb index 667baba62..807fc80fe 100644 --- a/app/views/student_work/_programing_work_show.html.erb +++ b/app/views/student_work/_programing_work_show.html.erb @@ -48,8 +48,9 @@ <% student_work_test = @work.student_work_test.first%> <% if student_work_test && student_work_test.error_msg && !student_work_test.error_msg.empty?%> - 编程错误信息编程错误信息编程错误信息编程错误信息编程错误信息编程错误信息编程错误信息编程错误信息编程错误信息编程错误信息编程错误信息编程错误信息编程错误信息编程错误信息编程错误信息编程错误信息编程错误信息编程错误信息编程错误信息 - + + <%= student_work_test.error_msg%> + <% end%> From f4786ea71fa035b60a5d2635b68589478d351238 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 23 Jul 2015 10:23:27 +0800 Subject: [PATCH 09/17] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=97=B6=E9=97=B4=E5=AF=B9=E9=BD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/_new_member_list.html.erb | 2 +- public/stylesheets/public.css | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/courses/_new_member_list.html.erb b/app/views/courses/_new_member_list.html.erb index e8eebe00d..35d9fe399 100644 --- a/app/views/courses/_new_member_list.html.erb +++ b/app/views/courses/_new_member_list.html.erb @@ -63,7 +63,7 @@ :member_id => member.id, :remote => true}, :class => 'ml258 c_red' %> - <%= format_date(member.created_on)%> + <%= format_date(member.created_on)%> <%= call_hook(:view_projects_settings_members_table_row, { :course => @course, :member => member}) %>
  • 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' %>

    <%= l(:label_course_homework_new)%>

    -
    - <%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %> - <%= hidden_field_tag "course",@course.id%> - <%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> - 提交 - <%#= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%> - <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> +
    + <%= form_for("new_homework_common",:url => next_step_homework_common_index_path) do |f|%> + +

    + 请选择将要发布的作业类型 +

    + + + 人工评分的作业(支持匿名互评、灵活设置评分比例) + +
    + + + 自动评测的编程作业(支持C/C++程序的自动评分) + +
    + + 下一步 + <% end%>
    From 76247d74a7636d2175d313cbc52b18993dd28069 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 23 Jul 2015 10:50:48 +0800 Subject: [PATCH 12/17] =?UTF-8?q?=E5=85=AC=E5=85=B1=E8=B4=B4=E5=90=A7=20?= =?UTF-8?q?=E9=A1=B6=E5=92=8C=E8=B8=A9=E4=B9=8B=E5=90=8E=E6=95=B0=E5=AD=97?= =?UTF-8?q?=E6=9C=AA=E5=8F=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/praise_tread_helper.rb | 4 ++-- app/views/memos/show.html.erb | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/helpers/praise_tread_helper.rb b/app/helpers/praise_tread_helper.rb index 90ce6d61d..c142f0973 100644 --- a/app/helpers/praise_tread_helper.rb +++ b/app/helpers/praise_tread_helper.rb @@ -20,9 +20,9 @@ module PraiseTreadHelper # when 0 # return @record.tread_num.nil? ? 0 : @record.tread_num # end - return (@record.praise_num.to_i-@record.tread_num.to_i) + return ((@record.praise_num.nil? ? 0 : @record.praise_num.to_i)-(@record.tread_num.nil? ? 0 : @record.tread_num.to_i)) else - return 0 + return 0 end end diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index 55a2410b0..586279504 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -7,7 +7,9 @@ <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
    - <%= render :partial => "/praise_tread/praise_tread",:locals => {:obj => @memo,:show_flag => true,:user_id =>User.current.id,:horizontal => true}%> + + <%= render :partial => "/praise_tread/praise_tread",:locals => {:obj => @memo,:show_flag => true,:user_id =>User.current.id,:horizontal => true}%> +
    <%= link_to image_tag(url_to_avatar(@memo.author), :class => "avatar"), user_path(@memo.author) %> From 6775008b501a1c4da39515c5cfdd6b92046ab712 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 23 Jul 2015 14:42:47 +0800 Subject: [PATCH 13/17] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E6=95=B0=E5=92=8C=E5=88=9B=E5=BB=BA=E8=AF=BE=E7=A8=8B=E6=95=B0?= =?UTF-8?q?=E4=B8=8D=E6=AD=A3=E7=A1=AE=20=E5=8E=BB=E9=99=A4=E6=8E=89?= =?UTF-8?q?=E6=97=A0=E7=94=A8=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/users_helper.rb | 83 +++-------------- app/views/layouts/base_users_new.html.erb | 103 +++------------------- 2 files changed, 26 insertions(+), 160 deletions(-) diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index d4f9e4eb8..0b2d74ee8 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -328,73 +328,41 @@ module UsersHelper return [0,[]] end list = query.order("updated_on desc").limit(10).all - return [count,list]; + return [count,list] end def get_create_course_count(user) - return Course.where("tea_id = ?",user.id).count() + if user == User.current + user.courses.count + else + user.courses.where("is_public = 1").count + end end def get_join_course_count(user) - return user.coursememberships.count() - get_create_course_count(user) + user.coursememberships.count - get_create_course_count(user) end def get_homework_commons_count(user) - return HomeworkCommon.where("user_id = ?",user.id).count() + HomeworkCommon.where("user_id = ?",user.id).count end def get_projectandcourse_attachment_count(user) - return Attachment.where("author_id = ? and container_type in ('Project','Course')",user.id).count() + Attachment.where("author_id = ? and container_type in ('Project','Course')",user.id).count end def get_create_project_count(user) - return Project.where("user_id = ? and project_type = ?",user.id,Project::ProjectType_project).count() + Project.where("user_id = ? and project_type = ?",user.id,Project::ProjectType_project).count end def get_join_project_count(user) - return user.memberships.count(conditions: "projects.project_type = #{Project::ProjectType_project}") - get_create_project_count(user) + user.memberships.count(conditions: "projects.project_type = #{Project::ProjectType_project}") - get_create_project_count(user) end def get_create_issue_count(user) - return Issue.where("author_id = ?",user.id).count() + Issue.where("author_id = ?",user.id).count end def get_resolve_issue_count(user) - return Issue.where("assigned_to_id = ? and status_id=3",user.id).count() + Issue.where("assigned_to_id = ? and status_id=3",user.id).count end def get_anonymous_evaluation_count(user) - return StudentWorksScore.where("user_id = ? and reviewer_role=3",user.id).count() + StudentWorksScore.where("user_id = ? and reviewer_role=3",user.id).count end - - # def query_activities(query,type) - # query_rec_count = 8 - # # query = query.where("act_type='JournalsForMessage'") - # #query = query.where("act_type not in (?)", ['JournalsForMessage','Message','HomeworkCommon','News','Issue','Journal','Poll']) - # list = query.order("id desc").limit(query_rec_count).all - # - # result = []; - # for item in list - # container = get_activity_container(item,type) - # if( activity_is_show(item,container) ) - # result << { :item=>item,:e=>container } - # end - # end - # return [lastid,result] - # end - # def get_activity_container activity,type - # e = nil; - # if type == 'Project' - # if activity.act_type == 'Poll' - # # 项目没有问卷 - # # e = Project.find_by_id(activity.act.polls_group_id) - # else - # e = activity.act.project if activity.act.respond_to?('project') - # end - # end - # if type == 'Course' - # if activity.act_type == 'Poll' - # e = Course.find_by_id(activity.act.polls_group_id) - # else - # e = activity.act.course if activity.act.respond_to?('course') - # end - # end - # - # return e; - # end def query_activities(query) list = query.limit(8).all result = []; @@ -406,31 +374,8 @@ module UsersHelper end def get_activity_container activity return activity.activity_container - # if type == 'Project' - # return activity.act.project if activity.act.respond_to?('project') - # end - # if type == 'Course' - # if activity.act_type == 'Poll' - # return Course.find_by_id(activity.act.polls_group_id) - # end - # return activity.act.course if activity.act.respond_to?('course') - # end - # return nil; end - # def activity_is_show(activity,e) - # if(!e) - # return false - # end - # - # if activity.user_id == User.current.id - # return true - # end - # if( e.visible? ) - # return true - # end - # return false - # end def get_activity_act_showname_htmlclear(activity) str = get_activity_act_showname(activity) str = str.gsub(/<.*>/,'') diff --git a/app/views/layouts/base_users_new.html.erb b/app/views/layouts/base_users_new.html.erb index ef6d82245..068134bdc 100644 --- a/app/views/layouts/base_users_new.html.erb +++ b/app/views/layouts/base_users_new.html.erb @@ -19,77 +19,8 @@ <%= javascript_heads %> <%= heads_for_theme %> <%= call_hook :view_layouts_base_html_head %> - <%= yield :header_tags -%> - - @@ -103,12 +34,6 @@ $(".subNav").click(function(){ <%=link_to l(:field_homepage), home_path %> > <%=link_to (@center_flag ? '个人中心' : '个人主页'), user_path(@user) %> > <%=link_to @user.name, user_path(@user) %>

    - - - - - -
    @@ -200,22 +125,18 @@ $(".subNav").click(function(){ <% if @center_flag %> <% end %> From ce17cb1da0cdf381ef0f042cf674822421ed1bcb Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 23 Jul 2015 15:13:18 +0800 Subject: [PATCH 14/17] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=EF=BC=8CTA=E7=9A=84=E8=AF=BE=E7=A8=8B=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=92=8C=E8=AF=BE=E7=A8=8B=E6=95=B0=E9=87=8F=E3=80=81=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E5=88=97=E8=A1=A8=E4=B8=8D=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index d6597f3da..fa5ce8405 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -448,7 +448,7 @@ class UsersController < ApplicationController def user_courses4show query = Course.joins("join members m on #{Course.table_name}.id=m.course_id") - query = query.where("m.user_id = ?",@user.id) + query = query.where("m.user_id = ?",@user.id).order("#{Course.table_name}.id desc") if User.current == @user #看自己 else if @user.user_extensions!=nil && @user.user_extensions.identity == 0 #看老师 @@ -456,13 +456,12 @@ class UsersController < ApplicationController query = query.where("r.role_id in(3,7,9)") end query = query.where(Course.table_name+".is_public = 1") - # or exists (select 1 from courses c2,members m2 where c2.id=m2.course_id and c2.id=#{Course.table_name}.id and m2.user_id= User.current.id) end if params[:lastid]!=nil && !params[:lastid].empty? - query = query.where("( (#{Course.table_name}.updated_at=? and #{Course.table_name}.id < ?) or #{Course.table_name}.updated_atnil end From b781d22a6292a2788cfe985e518e147e137afe6d Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 23 Jul 2015 16:17:13 +0800 Subject: [PATCH 15/17] =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E5=99=A8=E4=B8=AD=E6=B2=A1=E6=9C=89=E7=9A=84?= =?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=9A=84action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 15 ++++++++++----- public/stylesheets/leftside.css | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index a0a61786c..b6a961239 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -20,11 +20,10 @@ class CoursesController < ApplicationController menu_item l(:label_sort_by_influence), :only => :index before_filter :can_show_course, :except => [] - before_filter :logged_user_by_apptoken,:only => [:show,:new_homework,:feedback] - before_filter :find_course, :except => [ :index, :search,:list, :new,:join,:unjoin, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches,:join_private_courses] - before_filter :authorize_course, :only => [:show, :settings, :edit, :update, :modules, :close, :reopen, :view_homework_attaches, :course] - before_filter :authorize_course_global, :only => [:view_homework_attaches, :new,:create] - before_filter :require_admin, :only => [:copy, :archive, :unarchive, :destroy, :calendar] + before_filter :logged_user_by_apptoken,:only => [:show,:feedback] + before_filter :find_course, :except => [ :index, :search, :new,:join,:unjoin, :create, :new_join, :course,:join_private_courses] + before_filter :authorize_course, :only => [:show, :settings, :update, :course] + before_filter :authorize_course_global, :only => [:new,:create] before_filter :toggleCourse, :only => [:finishcourse, :restartcourse] before_filter :require_login, :only => [:join, :unjoin] @@ -809,6 +808,12 @@ class CoursesController < ApplicationController end end + #删除课程 + #删除课程只是将课程的is_delete状态改为false,is_delete为false状态的课程只有管理员可以看到 + def destroy + + end + private def allow_join course if course_endTime_timeout? course diff --git a/public/stylesheets/leftside.css b/public/stylesheets/leftside.css index 50b47fff4..990c02d54 100644 --- a/public/stylesheets/leftside.css +++ b/public/stylesheets/leftside.css @@ -15,6 +15,7 @@ a.pr_join_a{ color:#fff; display:block; padding:0 5px 0 3px; padding-top:2px; h .pr_close{ display:block; background:url(../images/leftside.png) -1px -49px no-repeat; width:11px; height:11px; margin-top:3px; float:left; } .pr_add{display:block; background:url(../images/leftside.png) 0px -71px no-repeat; width:11px; height:11px; margin-top:3px; float:left; } .pr_arrow{display:block; background:url(../images/leftside.png) 0px -90px no-repeat; width:11px; height:11px; margin-top:3px; float:left; } +.pr_delete{ display:block; background:url(../images/leftside.png) -1px -157px no-repeat; width:11px; height:11px; margin-top:3px; float:left; } .pr_info_name{ color:#3e4040; font-size:14px; line-height:1.5;} a:hover.pr_info_name{ color:#3ca5c6;} .pr_info_score{ font-size:14px; color:#3e4040; } From 4ce693ad1752bd96bae3e490208350ede14fb042 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 23 Jul 2015 16:49:54 +0800 Subject: [PATCH 16/17] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E5=8F=91=E9=80=81=E9=82=AE=E4=BB=B6=E5=A2=9E=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/mailer/message_posted.html.erb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/mailer/message_posted.html.erb b/app/views/mailer/message_posted.html.erb index c55f4b000..ed8cb8626 100644 --- a/app/views/mailer/message_posted.html.erb +++ b/app/views/mailer/message_posted.html.erb @@ -8,8 +8,9 @@ <% if @message.project %> <%=h @message.board.project.name %> - <%=h @message.board.name %>: <%= link_to(h(@message.subject), @message_url,:style=>'color:#1b55a7; font-weight:bold;') %> <% elsif @message.course %> - <%=h @message.board.course.name %> - <%=h @message.board.name %>: <%= link_to(h(@message.subject), @message_url,:style=>'color:#1b55a7; font-weight:bold;') %> - <% end %> + <%=h @message.board.course.name %> - <%=h @message.board.name %>: + <%= link_to(h(@message.subject), @message_url + "?topic_id=#{@message.id}&&parent_id=#{@message.parent_id ? @message.parent_id : @message.id}",:style=>'color:#1b55a7; font-weight:bold;') %> + <% end %> <%= l(:mail_issue_title_active)%>

      From 1b3c6bde69b58f98238cd2756660688ef02f5965 Mon Sep 17 00:00:00 2001 From: zhangshenjerry <1375181337@qq.com> Date: Fri, 24 Jul 2015 08:56:19 +0800 Subject: [PATCH 17/17] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5--?= =?UTF-8?q?=E7=95=99=E8=A8=80=E6=96=87=E6=9C=AC=E6=A1=86=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/show.html.erb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index e8db87a7e..2c91f394f 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -32,7 +32,7 @@
      - +

      取消 @@ -119,10 +119,9 @@ $(function(){ function init_editor(params){ - params.textarea.removeAttr('placeholder'); var editor = params.kindutil.create(params.textarea, { - resizeType : 1,minWidth:"1px",width:"100%",height:"150px", - items:['emoticons'], + resizeType : 1,minWidth:"1px",width:"100%",height:"80px", + items:['emoticons'], afterChange:function(){//按键事件 nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea}); },