From 072300331b1116ddea7e5f20681ad4c6f11c4e67 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 29 Feb 2016 17:05:11 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E7=BC=96=E7=A8=8B=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E9=9B=86=E7=9A=84=E8=BE=93=E5=85=A5=E8=BE=93=E5=87=BA=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=BA=8F=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_homework_form.html.erb | 4 +++- app/views/users/_user_programing_attr.html.erb | 4 +++- public/javascripts/homework.js | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index 0d542882a..88e81827e 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -228,7 +228,9 @@ diff --git a/app/views/exercise/_new_MC.html.erb b/app/views/exercise/_new_MC.html.erb index 0d7350570..6fd6c201e 100644 --- a/app/views/exercise/_new_MC.html.erb +++ b/app/views/exercise/_new_MC.html.erb @@ -18,28 +18,28 @@
  • - +
  • - +
  • - +
  • - + diff --git a/app/views/exercise/_new_MCQ.html.erb b/app/views/exercise/_new_MCQ.html.erb index 3ea198d8f..a24835fc1 100644 --- a/app/views/exercise/_new_MCQ.html.erb +++ b/app/views/exercise/_new_MCQ.html.erb @@ -18,28 +18,28 @@
  • - +
  • - +
  • - +
  • - + diff --git a/app/views/exercise/_new_single.html.erb b/app/views/exercise/_new_single.html.erb index 061b053fd..3a65c072d 100644 --- a/app/views/exercise/_new_single.html.erb +++ b/app/views/exercise/_new_single.html.erb @@ -18,22 +18,22 @@
  • - - + +
  • - - + +
  • - - + +
  • diff --git a/app/views/exercise/_show_MC.html.erb b/app/views/exercise/_show_MC.html.erb index d052bd6da..eef7546e5 100644 --- a/app/views/exercise/_show_MC.html.erb +++ b/app/views/exercise/_show_MC.html.erb @@ -55,28 +55,28 @@ '分'+ '
    '+ '
  • '+ - ''+ + ''+ ''+ ''+ ''+ '
  • '+ '
    '+ '
  • '+ - ''+ + ''+ ''+ ''+ ''+ '
  • '+ '
    '+ '
  • '+ - ''+ + ''+ ''+ ''+ ''+ '
  • '+ '
    '+ '
  • '+ - ''+ + ''+ ''+ ''+ ''+ diff --git a/app/views/exercise/_show_MCQ.html.erb b/app/views/exercise/_show_MCQ.html.erb index a477303d7..9e66f17f9 100644 --- a/app/views/exercise/_show_MCQ.html.erb +++ b/app/views/exercise/_show_MCQ.html.erb @@ -54,28 +54,28 @@ '分'+ '
  • '+ '
  • '+ - ''+ + ''+ ''+ ''+ ''+ '
  • '+ '
    '+ '
  • '+ - ''+ + ''+ ''+ ''+ ''+ '
  • '+ '
    '+ '
  • '+ - ''+ + ''+ ''+ ''+ ''+ '
  • '+ '
    '+ '
  • '+ - ''+ + ''+ ''+ ''+ ''+ diff --git a/app/views/exercise/_show_single.html.erb b/app/views/exercise/_show_single.html.erb index 86203b8bb..90f604da1 100644 --- a/app/views/exercise/_show_single.html.erb +++ b/app/views/exercise/_show_single.html.erb @@ -9,7 +9,7 @@
    <% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %> - 候选答案:<%= exercise_choice.answer_text%>
    + 候选答案<%= convert_to_chi_num(index+1) %>:<%= exercise_choice.answer_text%>
    <% end %>
  • @@ -42,22 +42,22 @@ '分'+ '
    '+ '
  • '+ - ''+ - ''+ + ''+ + ''+ ''+ ''+ '
  • '+ '
    '+ '
  • '+ - ''+ - ''+ + ''+ + ''+ ''+ ''+ '
  • '+ '
    '+ '
  • '+ - ''+ - ''+ + ''+ + ''+ ''+ ''+ '
  • '+ diff --git a/public/stylesheets/polls.css b/public/stylesheets/polls.css index bcace8cf2..1cb288d51 100644 --- a/public/stylesheets/polls.css +++ b/public/stylesheets/polls.css @@ -152,4 +152,6 @@ a:hover.btn_pu{ background:#3cb761;} .polls_alert_upload_box{ width:120px; margin:15px auto;} .polls_alert_box_p{ font-size:14px; padding-left: 45px;padding-top: 10px;} +.w56 { width: 56px;} + From 11592bdbcc1a71f4c694d68d95c5a18ca6030409 Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 1 Mar 2016 17:28:49 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E9=A2=98=E5=BA=93?= =?UTF-8?q?=E9=A2=98=E7=9B=AE=E5=BC=B9=E6=A1=86=E6=A0=B7=E5=BC=8F=E6=9B=B4?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_homework_detail_information.html.erb | 12 +++--- .../users/_homework_search_input.html.erb | 2 +- .../users/_show_user_homework_form.html.erb | 13 +++--- app/views/users/_show_user_homeworks.html.erb | 31 +++++++------- public/stylesheets/new_user.css | 41 ++++++++++--------- public/stylesheets/public.css | 41 ++++++++++--------- 6 files changed, 72 insertions(+), 68 deletions(-) diff --git a/app/views/users/_homework_detail_information.html.erb b/app/views/users/_homework_detail_information.html.erb index d650cd084..e43b5b6c7 100644 --- a/app/views/users/_homework_detail_information.html.erb +++ b/app/views/users/_homework_detail_information.html.erb @@ -1,9 +1,9 @@ -
    题目信息
    -
    +
    题目信息
    +
    <% if homework.nil? %> 请先在左侧选择作业 <% else %> -
    标题:<%=homework.name %>
    +
    标题:<%=homework.name %>
    来源:<%=homework.course.name %>
    <% if homework.homework_type == 2 && homework.homework_detail_programing %> 编程语言:<%=homework.language_name %>
    @@ -15,15 +15,15 @@
    描述如下:
    -
    +
    <%=homework.description.html_safe %>
    <% if homework.homework_type == 2 %> -
    +
    测试集:<%=homework.homework_tests.count %>组
    <% elsif homework.homework_type ==3 && homework.homework_detail_group %> -
    +
    分组人数:<%=homework.homework_detail_group.min_num %> - <%=homework.homework_detail_group.max_num %>人
    <% end %> diff --git a/app/views/users/_homework_search_input.html.erb b/app/views/users/_homework_search_input.html.erb index ba85f0d09..05f023200 100644 --- a/app/views/users/_homework_search_input.html.erb +++ b/app/views/users/_homework_search_input.html.erb @@ -1,4 +1,4 @@ - + diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 289cb2699..721f56bf8 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -1438,26 +1438,27 @@ span.at a{color:#269ac9;text-decoration: none;} .proInfoP{color:#000000 !important; float:left; width:80px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; } /*导入题库样式*/ -.popupWrap {border:3px solid #269ac9; padding:15px; background-color:#ffffff; position:relative; z-index:1000;} -.subjectList {width:585px;} -.subjectDetail {width:385px;} -a.subjectChoose {padding:8px 20px; background-color:#f1f1f1; color:#888888;} -a.chooseActive {background-color:#269ac9; color:#ffffff;} -.subjectBanner {width:585px; height:40px; background-color:#f1f1f1; border-top:1px solid #eaeaea; color:#7a7a7a; font-size:14px;} -.subjectBanner li {height:40px; line-height:40px; vertical-align:middle;} -.subjectName {width:270px; padding-left:10px; padding-right:10px;} -.subjectPublisher {width:80px; text-align:center;} -.subjectDate {width:80px; text-align:center;} -.subjectType {width:70px; text-align:center;} -.subjectCount {width:65px; text-align:center;} -.subjectRow {width:585px; height:30px; color:#7a7a7a; font-size:12px;} -.subjectRow li {height:30px; line-height:30px; vertical-align:middle;} -.subjectSearch {border:1px solid #dddddd; height:32px; width:250px;outline: none;} -.subjectInfo {width:385px; background-color:#f1f1f1; border:1px solid #dddddd; height:32px; line-height:32px; vertical-align:middle; text-align:center; color:#7a7a7a;} -.subjectWrap {border:1px solid #dddddd; border-top:none; padding:10px; width:365px; height:470px; overflow-y:auto;} -.subjectIntro {color:#585858; line-height:18px; font-size:12px;} -.subjectContent {color:#888888; line-height:18px; font-size:12px;} -.popupClose {background:url(../images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:10px; top:5px;} +.popup-wrapper {border:3px solid #269ac9; padding:15px; background-color:#ffffff; position:relative; z-index:1000;} +.subject-list {width:585px;} +.subject-detail {width:385px;} +a.subject-choose {padding:8px 20px; background-color:#f1f1f1; color:#888888;} +a.choose-active {background-color:#269ac9; color:#ffffff;} +.subject-pop-banner {width:585px; height:40px; background-color:#f1f1f1; border-top:1px solid #eaeaea; color:#7a7a7a; font-size:14px;} +.subject-pop-banner li {height:40px; line-height:40px; vertical-align:middle;} +.subject-pop-name {width:200px; padding-left:10px; padding-right:10px;} +.subject-pop-publisher {width:80px; text-align:center;} +.subject-pop-date {width:75px; text-align:center;} +.subject-pop-row {width:585px; height:30px; color:#7a7a7a; font-size:12px;} +.subject-pop-row li {height:30px; line-height:30px; vertical-align:middle;} +.subject-pop-search {border:1px solid #dddddd; height:32px; width:250px;} +.subject-pop-info {width:385px; background-color:#f1f1f1; border:1px solid #dddddd; height:32px; line-height:32px; vertical-align:middle; text-align:center; color:#7a7a7a;} +.subject-pop-wrap {border:1px solid #dddddd; border-top:none; padding:10px; width:365px; height:475px; overflow-y:auto;} +.subject-pop-intro {color:#585858; line-height:18px; font-size:12px;} +.subject-pop-content {color:#888888; line-height:18px; font-size:12px;} +.popup-close {background:url(../images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:10px; top:5px;} +.subject-pop-type {width:50px; text-align:center;} +.subject-pop-count {width:60px; text-align:center;} +.subject-pop-from {width:100px; text-align:center;} .subjectContent p,.subjectContent div,.subjectContent em, .subjectContent span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; line-height: 18px !important; color:#888888 !important; font-size:12px !important;} .whiteSettingIcon {background:url(../images/hwork_icon.png) -5px -302px no-repeat; width:20px; height:20px;} diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 8df561d1a..59bdb3fda 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -1025,26 +1025,27 @@ a:hover.userCancel{border:1px solid #888888; } .relatePWrap{max-height: 210px;overflow:hidden;} /*导入题库样式*/ -.popupWrap {border:3px solid #269ac9; padding:15px; background-color:#ffffff; position:relative; z-index:1000;} -.subjectList {width:585px;} -.subjectDetail {width:385px;} -a.subjectChoose {padding:8px 20px; background-color:#f1f1f1; color:#888888;} -a.chooseActive {background-color:#269ac9; color:#ffffff;} -.subjectBanner {width:585px; height:40px; background-color:#f1f1f1; border-top:1px solid #eaeaea; color:#7a7a7a; font-size:14px;} -.subjectBanner li {height:40px; line-height:40px; vertical-align:middle;} -.subjectName {width:270px; padding-left:10px; padding-right:10px;} -.subjectPublisher {width:80px; text-align:center;} -.subjectDate {width:80px; text-align:center;} -.subjectType {width:70px; text-align:center;} -.subjectCount {width:65px; text-align:center;} -.subjectRow {width:585px; height:30px; color:#7a7a7a; font-size:12px;} -.subjectRow li {height:30px; line-height:30px; vertical-align:middle;} -.subjectSearch {border:1px solid #dddddd; height:32px; width:250px;outline: none;} -.subjectInfo {width:385px; background-color:#f1f1f1; border:1px solid #dddddd; height:32px; line-height:32px; vertical-align:middle; text-align:center; color:#7a7a7a;} -.subjectWrap {border:1px solid #dddddd; border-top:none; padding:10px; width:365px; height:470px; overflow-y:auto;} -.subjectIntro {color:#585858; line-height:18px; font-size:12px;} -.subjectContent {color:#888888; line-height:18px; font-size:12px;} -.popupClose {background:url(../images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:10px; top:5px;} +.popup-wrapper {border:3px solid #269ac9; padding:15px; background-color:#ffffff; position:relative; z-index:1000;} +.subject-list {width:585px;} +.subject-detail {width:385px;} +a.subject-choose {padding:8px 20px; background-color:#f1f1f1; color:#888888;} +a.choose-active {background-color:#269ac9; color:#ffffff;} +.subject-pop-banner {width:585px; height:40px; background-color:#f1f1f1; border-top:1px solid #eaeaea; color:#7a7a7a; font-size:14px;} +.subject-pop-banner li {height:40px; line-height:40px; vertical-align:middle;} +.subject-pop-name {width:200px; padding-left:10px; padding-right:10px;} +.subject-pop-publisher {width:80px; text-align:center;} +.subject-pop-date {width:75px; text-align:center;} +.subject-pop-row {width:585px; height:30px; color:#7a7a7a; font-size:12px;} +.subject-pop-row li {height:30px; line-height:30px; vertical-align:middle;} +.subject-pop-search {border:1px solid #dddddd; height:32px; width:250px;} +.subject-pop-info {width:385px; background-color:#f1f1f1; border:1px solid #dddddd; height:32px; line-height:32px; vertical-align:middle; text-align:center; color:#7a7a7a;} +.subject-pop-wrap {border:1px solid #dddddd; border-top:none; padding:10px; width:365px; height:475px; overflow-y:auto;} +.subject-pop-intro {color:#585858; line-height:18px; font-size:12px;} +.subject-pop-content {color:#888888; line-height:18px; font-size:12px;} +.popup-close {background:url(../images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:10px; top:5px;} +.subject-pop-type {width:50px; text-align:center;} +.subject-pop-count {width:60px; text-align:center;} +.subject-pop-from {width:100px; text-align:center;} .subjectContent p,.subjectContent div,.subjectContent em, .subjectContent span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; line-height: 18px !important; color:#888888 !important; font-size:12px !important;} .whiteSettingIcon {background:url(../images/hwork_icon.png) -5px -302px no-repeat; width:20px; height:20px;} From 486d791c72fc6a271b0378dee44d306795f51fc6 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 2 Mar 2016 17:34:50 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E9=A2=9C=E8=89=B2=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/_org_subfield_list.html.erb | 2 +- app/views/files/_project_list.html.erb | 2 +- app/views/files/_resource_detail.html.erb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/files/_org_subfield_list.html.erb b/app/views/files/_org_subfield_list.html.erb index 866cf6fd8..d249aede9 100644 --- a/app/views/files/_org_subfield_list.html.erb +++ b/app/views/files/_org_subfield_list.html.erb @@ -10,7 +10,7 @@
    <%= link_to truncate(file.filename,length: 35, omission: '...'), download_named_attachment_path(file.id, file.filename), - :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %> + :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14 f_l" %> <%= file_preview_eye(file, class: 'preview') %> <% if file.is_public? == false%> diff --git a/app/views/files/_project_list.html.erb b/app/views/files/_project_list.html.erb index 391430126..81227529e 100644 --- a/app/views/files/_project_list.html.erb +++ b/app/views/files/_project_list.html.erb @@ -10,7 +10,7 @@
    <%= link_to truncate(file.filename,length: 35, omission: '...'), download_named_attachment_path(file.id, file.filename), - :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkBlue f_14 f_b" %> + :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %> <%= file_preview_eye(file, class: 'preview') %> <% if file.is_public? == false%> diff --git a/app/views/files/_resource_detail.html.erb b/app/views/files/_resource_detail.html.erb index fd0a165aa..6342e91f6 100644 --- a/app/views/files/_resource_detail.html.erb +++ b/app/views/files/_resource_detail.html.erb @@ -8,7 +8,7 @@
    <%= link_to truncate(file.filename,length: 35, omission: '...'), download_named_attachment_path(file.id, file.filename), - :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkBlue f_14 f_b" %> + :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %> <%= file_preview_eye(file, class: 'preview') %> <% if file.is_public? == false%> From d2cf95a32d3d4a1929164ca07954bd542b300e07 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 3 Mar 2016 15:43:36 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E6=9C=80=E8=BF=91=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E8=80=81=E5=B8=88=E5=88=97=E8=A1=A8=E7=9A=84=E8=B6=85=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E6=8C=87=E5=90=91=E4=BA=86=E5=85=B6=E4=BB=96=E7=94=A8?= =?UTF-8?q?=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/admin/latest_login_teachers.html.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/admin/latest_login_teachers.html.erb b/app/views/admin/latest_login_teachers.html.erb index 06c0386f5..a42e84369 100644 --- a/app/views/admin/latest_login_teachers.html.erb +++ b/app/views/admin/latest_login_teachers.html.erb @@ -59,17 +59,17 @@ <%=format_time(teacher.last_login_on) %> - <%=teacher.id %> + <%=teacher.user_id %> <%= teacher.login%><% else %><%=teacher.try(:realname) %><% end %>'> <% if teacher.try(:realname) == ' '%> - <%= link_to(teacher.login, user_path(teacher)) %> + <%= link_to(teacher.login, user_path(teacher.user_id)) %> <% else %> - <%= link_to(teacher.try(:realname), user_path(teacher)) %> + <%= link_to(teacher.try(:realname), user_path(teacher.user_id)) %> <% end %> - <%=link_to(teacher.login, user_path(teacher)) %> + <%=link_to(teacher.login, user_path(teacher.user_id)) %> 老师 From f0d7542ac6d7862558fce933dd23362937c530f4 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 3 Mar 2016 17:04:38 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E9=A2=98=E5=BA=93?= =?UTF-8?q?=E5=92=8C=E5=85=AC=E5=85=B1=E9=A2=98=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 150 +++++++++++++++--- app/helpers/courses_helper.rb | 18 ++- app/views/layouts/_logined_header.html.erb | 12 +- app/views/layouts/static_base.html.erb | 5 +- app/views/users/_homework_repository.html.erb | 39 +++++ .../_homework_repository_detail.html.erb | 33 ++++ .../users/_homework_search_input.html.erb | 2 +- .../users/_send_homework_to_course.html.erb | 79 +++++++++ .../users/_show_user_homework_form.html.erb | 2 +- app/views/users/_show_user_homeworks.html.erb | 6 +- app/views/users/_user_homework_list.html.erb | 2 +- app/views/users/_user_homeworks_old.html.erb | 47 ++++++ app/views/users/choose_user_course.js.erb | 7 + .../users/send_homework_to_course.js.erb | 1 + app/views/users/show_homework_detail.js.erb | 6 +- app/views/users/student_homeworks.html.erb | 47 ++++++ app/views/users/student_homeworks.js.erb | 1 + app/views/users/user_homework_type.js.erb | 9 +- app/views/users/user_homeworks.html.erb | 139 ++++++++++------ app/views/users/user_homeworks.js.erb | 5 +- app/views/users/user_search_homeworks.js.erb | 8 +- config/routes.rb | 3 + public/stylesheets/new_user.css | 18 ++- public/stylesheets/public.css | 51 +++++- 24 files changed, 604 insertions(+), 86 deletions(-) create mode 100644 app/views/users/_homework_repository.html.erb create mode 100644 app/views/users/_homework_repository_detail.html.erb create mode 100644 app/views/users/_send_homework_to_course.html.erb create mode 100644 app/views/users/_user_homeworks_old.html.erb create mode 100644 app/views/users/choose_user_course.js.erb create mode 100644 app/views/users/send_homework_to_course.js.erb create mode 100644 app/views/users/student_homeworks.html.erb create mode 100644 app/views/users/student_homeworks.js.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index e6b2a2036..baf74f979 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -26,6 +26,7 @@ class UsersController < ApplicationController menu_item :user_information, :only => :info menu_item :user_course, :only => :user_courses menu_item :user_homework, :only => :user_homeworks + menu_item :student_homework, :only => :student_homeworks menu_item :user_project, :only => [:user_projects, :watch_projects] menu_item :requirement_focus, :only => :watch_contests menu_item :user_newfeedback, :only => :user_newfeedback @@ -35,12 +36,12 @@ class UsersController < ApplicationController # before_filter :can_show_course, :only => [:user_courses,:user_homeworks] before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, - :user_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, + :user_homeworks,:student_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index, :activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index, :activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,:user_resource, :user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages,:edit_brief_introduction, - :user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages] + :user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course] before_filter :auth_user_extension, only: :show #before_filter :rest_user_score, only: :show #before_filter :select_entry, only: :user_projects @@ -374,32 +375,130 @@ class UsersController < ApplicationController #用户作业列表 def user_homeworks - if User.current == @user - @page = params[:page] ? params[:page].to_i + 1 : 0 - user_course_ids = @user.courses.empty? ? "(-1)" :"(" + @user.courses.visible.map{|course| course.id}.join(",") + ")" + @user = User.current + if(params[:type].blank? || params[:type] == "1") #公共题库 + visible_course = Course.where("is_public = 1 && is_delete = 0") + visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")" + @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'").order("created_at desc") + elsif params[:type] == "2" #我的题库 + @homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}'").order("created_at desc") + end + @type = params[:type] + @limit = 15 + @is_remote = true + @hw_count = @homeworks.count + @hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1 + @offset ||= @hw_pages.offset + @homeworks = paginateHelper @homeworks,15 + respond_to do |format| + format.js + format.html {render :layout => 'static_base'} + end + end - #判断当前用户在当前课程的身份 - visibleCourse = @user.courses.empty? ? [] : @user.courses.visible - homework_ids = [] - visibleCourse.each do |course| - if User.current.allowed_to?(:as_teacher,course) - homeworks = HomeworkCommon.where("course_id = #{course.id}") - homework_ids << homeworks.pluck(:id) unless homeworks.empty? - else - homeworks = HomeworkCommon.where("course_id = #{course.id} and publish_time <= '#{Date.today}'") - homework_ids << homeworks.pluck(:id) unless homeworks.empty? + def student_homeworks + if User.current == @user + @page = params[:page] ? params[:page].to_i + 1 : 0 + user_course_ids = @user.courses.empty? ? "(-1)" :"(" + @user.courses.visible.map{|course| course.id}.join(",") + ")" + + #判断当前用户在当前课程的身份 + visibleCourse = @user.courses.empty? ? [] : @user.courses.visible + homework_ids = [] + visibleCourse.each do |course| + homeworks = HomeworkCommon.where("course_id = #{course.id} and publish_time <= '#{Date.today}'") + homework_ids << homeworks.pluck(:id) unless homeworks.empty? + end + visible_homework_ids = homework_ids.size == 0 ? "(-1)" :"(" + homework_ids.join(",") + ")" + @homework_commons = HomeworkCommon.where("id in #{visible_homework_ids}").order("created_at desc").limit(10).offset(@page * 10) + @is_teacher = User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true) + @is_in_course = params[:is_in_course].to_i || 0 + respond_to do |format| + format.js + format.html {render :layout => 'new_base_user'} + end + else + render_403 + end + end + + def choose_user_course + if !params[:search].nil? + search = "%#{params[:search].to_s.strip.downcase}%" + @course = @user.courses.where(" #{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like :p",:p=>search).select { |course| @user.allowed_to?(:as_teacher,course)} + else + @course = @user.courses.select { |course| @user.allowed_to?(:as_teacher,course)} + end + @search = params[:search] + #这里仅仅是传递需要发送的资源id + @send_id = params[:send_id] + respond_to do |format| + format.js + end + end + + def send_homework_to_course + homework = HomeworkCommon.find params[:send_id].to_i + course_ids = params[:course_ids] + course_ids.each do |course_id| + course = Course.find course_id.to_i + new_homework = HomeworkCommon.new + new_homework.name = homework.name + new_homework.user_id = User.current.id + new_homework.description = homework.description + new_homework.homework_type = homework.homework_type + new_homework.late_penalty = homework.late_penalty + new_homework.course_id = course.id + new_homework.teacher_priority = homework.teacher_priority + new_homework.anonymous_comment = homework.anonymous_comment + new_homework.quotes = 0 + new_homework.is_open = homework.is_open + homework.attachments.each do |attachment| + att = attachment.copy + att.container_id = nil + att.container_type = nil + att.copy_from = attachment.id + att.save + new_homework.attachments << att + end + homework_detail_manual = homework.homework_detail_manual + homework_detail_programing = homework.homework_detail_programing + homework_detail_group = homework.homework_detail_group + if homework_detail_manual + new_homework.homework_detail_manual = HomeworkDetailManual.new + new_homework_detail_manual = new_homework.homework_detail_manual + new_homework_detail_manual.ta_proportion = homework_detail_manual.ta_proportion + new_homework_detail_manual.comment_status = 0 + new_homework_detail_manual.evaluation_num = homework_detail_manual.evaluation_num + new_homework_detail_manual.absence_penalty = homework_detail_manual.absence_penalty + end + if homework_detail_programing + new_homework.homework_detail_programing = HomeworkDetailPrograming.new + new_homework.homework_detail_programing.ta_proportion = homework_detail_programing.ta_proportion + new_homework.homework_detail_programing.language = homework_detail_programing.language + homework.homework_tests.each_with_index do |homework_test| + new_homework.homework_tests << HomeworkTest.new( + input: homework_test.input, + output: homework_test.output + ) end end - visible_homework_ids = homework_ids.size == 0 ? "(-1)" :"(" + homework_ids.join(",") + ")" - @homework_commons = HomeworkCommon.where("id in #{visible_homework_ids}").order("created_at desc").limit(10).offset(@page * 10) - @is_teacher = User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true) - @is_in_course = params[:is_in_course].to_i || 0 - respond_to do |format| - format.js - format.html {render :layout => 'new_base_user'} + + if homework_detail_group + new_homework.homework_detail_group = HomeworkDetailGroup.new + new_homework.homework_detail_group.min_num = homework_detail_group.min_num + new_homework.homework_detail_group.max_num = homework_detail_group.max_num + new_homework.homework_detail_group.base_on_project = homework_detail_group.base_on_project end - else - render_403 + if new_homework.save + new_homework_detail_manual.save if new_homework_detail_manual + new_homework.homework_detail_programing.save if new_homework.homework_detail_programing + new_homework.homework_detail_group.save if new_homework.homework_detail_group + end + homework.update_attribute(:quotes, homework.quotes+1) + end + @homework = homework + respond_to do |format| + format.js end end @@ -439,6 +538,7 @@ class UsersController < ApplicationController @hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1 @offset ||= @hw_pages.offset @homeworks = paginateHelper @homeworks,15 + @is_import = params[:is_import] respond_to do |format| format.js end @@ -446,6 +546,7 @@ class UsersController < ApplicationController def show_homework_detail @homework = HomeworkCommon.find params[:homework].to_i + @is_import = params[:is_import] respond_to do |format| format.js end @@ -469,6 +570,7 @@ class UsersController < ApplicationController @hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1 @offset ||= @hw_pages.offset @homeworks = paginateHelper @homeworks,15 + @is_import = params[:is_import] respond_to do |format| format.js end diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 2cdb277be..229a7c7d5 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -116,7 +116,7 @@ module CoursesHelper @course.journals_for_messages.where('m_parent_id IS NULL').count end - #当前学期 + #当前学期(2015春季学期) def current_time_and_term course str = "" term = cur_course_term @@ -144,6 +144,22 @@ module CoursesHelper val end + #当前学期(2015春) + def current_time_and_term_short course + str = "" + term = cur_course_term + if (course.time == course.end_time && course.term == course.end_term) || (course.end_term.nil? && course.end_time.nil?) || course.time > Time.now.year + str = course.time.to_s + course.term[0] + elsif course.time == Time.now.year && set_term_value(cur_course_term) <= set_term_value(course.term) + str = course.time.to_s + course.term[0] + elsif course.end_time < Time.now.year || (course.end_time == Time.now.year && set_term_value(cur_course_term) >= set_term_value(course.term)) + str = course.end_time.to_s + course.end_term[0] + else + str = Time.now.year.to_s + cur_course_term[0] + end + str + end + # 返回学生数量,即roles表中定义的Reporter #def studentCount project # searchStudent(project).count diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index 2fa627c73..68e951896 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -9,9 +9,15 @@ - + <% if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%> + + <% else %> + + <% end %> diff --git a/app/views/layouts/static_base.html.erb b/app/views/layouts/static_base.html.erb index f73d1bc61..32436f23d 100644 --- a/app/views/layouts/static_base.html.erb +++ b/app/views/layouts/static_base.html.erb @@ -47,7 +47,10 @@
    <%= render :partial => 'layouts/footer' %>
    - + + <%= call_hook :view_layouts_base_body_bottom %> diff --git a/app/views/users/_homework_repository.html.erb b/app/views/users/_homework_repository.html.erb new file mode 100644 index 000000000..d514f4b59 --- /dev/null +++ b/app/views/users/_homework_repository.html.erb @@ -0,0 +1,39 @@ + + +
    + <% homeworks.each do |homework| %> +
      + + +
    • + <% case homework.homework_type %> + <% when 1 %> + 普通 + <% when 2 %> + 编程 + <% when 3 %> + 分组 + <% end %> +
    • + +
    • <%= homework.quotes %>
    • +
    • <%=format_date homework.publish_time %>
    • +
    + <% end %> +
    \ No newline at end of file diff --git a/app/views/users/_homework_repository_detail.html.erb b/app/views/users/_homework_repository_detail.html.erb new file mode 100644 index 000000000..f9df9eee5 --- /dev/null +++ b/app/views/users/_homework_repository_detail.html.erb @@ -0,0 +1,33 @@ +
    +
    题目信息
    +
    + <% if homework.nil? %> + 请先在左侧选择作业 + <% else %> +
    标题:<%=homework.name %>
    + 来源:<%=homework.course.name %>
    + <% if homework.homework_type == 2 && homework.homework_detail_programing %> + 编程语言:<%=homework.language_name %>
    + <% end %> + 贡献者:<%=homework.user.show_name %> + <% if homework.user.user_extensions.occupation && homework.user.user_extensions.occupation!="" %> + ,<%=homework.user.user_extensions.occupation%> + <% end %> +
    + 描述如下: +
    +
    + <%=homework.description.html_safe %> +
    + <% if homework.homework_type == 2 %> +
    + 测试集:<%=homework.homework_tests.count %>组 +
    + <% elsif homework.homework_type ==3 && homework.homework_detail_group %> +
    + 分组人数:<%=homework.homework_detail_group.min_num %> - <%=homework.homework_detail_group.max_num %>人 +
    + <% end %> + <% end %> +
    +
    \ No newline at end of file diff --git a/app/views/users/_homework_search_input.html.erb b/app/views/users/_homework_search_input.html.erb index ba85f0d09..d8d0e0806 100644 --- a/app/views/users/_homework_search_input.html.erb +++ b/app/views/users/_homework_search_input.html.erb @@ -9,7 +9,7 @@ } lastSearchCondition = $(e.target).val().trim(); $.ajax({ - url: '<%= url_for(:controller => 'users', :action => 'user_search_homeworks') %>'+'?name='+ e.target.value+'&type=<%=type %>', + url: '<%= url_for(:controller => 'users', :action => 'user_search_homeworks') %>'+'?name='+ e.target.value+'&type=<%=type %>&is_import=<%=is_import %>', type:'get' }); } diff --git a/app/views/users/_send_homework_to_course.html.erb b/app/views/users/_send_homework_to_course.html.erb new file mode 100644 index 000000000..902eebe22 --- /dev/null +++ b/app/views/users/_send_homework_to_course.html.erb @@ -0,0 +1,79 @@ +
    +
    +
    发送到
    +
    +
    + +
    + + +
    + <%= form_tag send_homework_to_course_user_path(user),:remote=>true,:id=>'choose_course_list_form' %> +
    + <%= hidden_field_tag(:send_id, send_id) %> +
    + <% if !courses.empty? %> + <% courses.each do |course| %> +
      +
    • + +
    • +
    • <%= truncate(course.name,:lendght=>25) + '['+current_time_and_term(course) + ']'%>
    • +
    + <% end %> +
    +
    +
    + +
    +
    + 确定 +
    +
    + 取消 +
    +
    +
    + <% end %> +
    + \ No newline at end of file diff --git a/app/views/users/_show_user_homework_form.html.erb b/app/views/users/_show_user_homework_form.html.erb index 004c8fec4..de33c7422 100644 --- a/app/views/users/_show_user_homework_form.html.erb +++ b/app/views/users/_show_user_homework_form.html.erb @@ -1,7 +1,7 @@ <% homeworks.each do |homework| %>
    <% end %> - <% if homework_common.anonymous_comment == 0%> + <% if homework_common.anonymous_comment == 0 && !homework_common.publish_time.nil?%>
    匿评关闭时间:<%= homework_common.homework_detail_manual.evaluation_end%> 23:59
    From 8e5abe997a3619cb4bc0bdcb0cff634109edac10 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 3 Mar 2016 17:39:08 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E5=B7=B2=E7=A6=81=E7=94=A8=E5=8C=BF?= =?UTF-8?q?=E8=AF=84=E7=9A=84=E4=BD=9C=E4=B8=9A=E8=BF=98=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=8C=BF=E8=AF=84=E6=88=AA=E6=AD=A2=E6=97=B6=E9=97=B4=E4=B8=8D?= =?UTF-8?q?=E5=90=88=E9=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_org_course_homework.html.erb | 2 +- app/views/users/_course_homework.html.erb | 2 +- app/views/users/_user_homework_detail.html.erb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb index 77ff5de13..4767e2ad2 100644 --- a/app/views/organizations/_org_course_homework.html.erb +++ b/app/views/organizations/_org_course_homework.html.erb @@ -89,7 +89,7 @@ <% end %> <% if activity.homework_detail_manual && activity.homework_detail_manual.comment_status < 2 %>
    提交截止时间:<%= activity.end_time.to_s %> 23:59
    - <% elsif activity.homework_detail_manual && activity.homework_detail_manual.comment_status >= 2 %> + <% elsif activity.homework_detail_manual && activity.homework_detail_manual.comment_status >= 2 && activity.anonymous_comment == 0%>
    匿评截止时间:<%= activity.homework_detail_manual.evaluation_end.to_s %> 23:59
    <% end %>
    diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index b43951c08..5e684ab15 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -89,7 +89,7 @@ <% end %> <% if activity.homework_detail_manual && activity.homework_detail_manual.comment_status < 2 %>
    提交截止时间:<%= activity.end_time.to_s %> 23:59
    - <% elsif activity.homework_detail_manual && activity.homework_detail_manual.comment_status >= 2 %> + <% elsif activity.homework_detail_manual && activity.homework_detail_manual.comment_status >= 2 && activity.anonymous_comment == 0%>
    匿评截止时间:<%= activity.homework_detail_manual.evaluation_end.to_s %> 23:59
    <% end %>
    diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index df2077719..bf4f4cde6 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -88,7 +88,7 @@ <% end %> <% if homework_common.homework_detail_manual && homework_common.homework_detail_manual.comment_status < 2 && !homework_common.publish_time.nil? %>
    提交截止时间:<%= homework_common.end_time.to_s %> 23:59
    - <% elsif homework_common.homework_detail_manual && homework_common.homework_detail_manual.comment_status >= 2 && !homework_common.publish_time.nil? %> + <% elsif homework_common.homework_detail_manual && homework_common.homework_detail_manual.comment_status >= 2 && !homework_common.publish_time.nil? && homework_common.anonymous_comment == 0 %>
    匿评截止时间:<%= homework_common.homework_detail_manual.evaluation_end.to_s %> 23:59
    <% end %> <% if homework_common.homework_detail_manual.comment_status == 0 && !homework_common.publish_time.nil? %>