From 356fbfe792d612f381a8b1369eb81c90493537ca Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 7 Nov 2016 15:44:40 +0800 Subject: [PATCH 01/12] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E9=97=AE=E5=8D=B7?= =?UTF-8?q?=EF=BC=9A=E6=96=B0=E5=BB=BA=E9=97=AE=E5=8D=B7=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E5=A6=82=E5=9B=BE=E4=B8=8D=E8=BE=93=E5=85=A5=E6=A0=87=E9=A2=98?= =?UTF-8?q?=E5=8F=8A=E6=8F=8F=E8=BF=B0=E7=9B=B4=E6=8E=A5=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E2=80=9C=E5=8F=96=E6=B6=88=E2=80=9D=EF=BC=8C=E5=86=8D=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E4=BF=9D=E5=AD=98=E6=88=96=E5=8F=91=E5=B8=83=EF=BC=8C?= =?UTF-8?q?=E5=8D=B4=E6=8F=90=E7=A4=BA=E4=BF=9D=E5=AD=98=E6=88=90=E5=8A=9F?= =?UTF-8?q?=E5=92=8C=E5=8F=91=E5=B8=83=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/poll/_poll_form.html.erb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/views/poll/_poll_form.html.erb b/app/views/poll/_poll_form.html.erb index 72131fd1d..a95d06d5c 100644 --- a/app/views/poll/_poll_form.html.erb +++ b/app/views/poll/_poll_form.html.erb @@ -566,6 +566,8 @@ function insert_MCQ(quest_type,quest_id){ var forms = $("form.new_poll_question"); if($("#polls_head_edit").is(":visible")){ alert("请先保存问卷标题及问卷描述。"); + }else if($.trim($("#polls_name_h").html()) == ""){ + alert("问卷标题不能为空"); }else if(forms.length > 0){ alert("请先保存正在编辑的题目。"); } else { @@ -585,6 +587,8 @@ function insert_MCQ(quest_type,quest_id){ var forms = $("form.new_poll_question"); if($("#polls_head_edit").is(":visible")){ alert("请先保存问卷标题及问卷描述。"); + }else if($.trim($("#polls_name_h").html()) == ""){ + alert("问卷标题不能为空"); }else if(forms.length > 0){ alert("请先保存正在编辑的题目再发布。"); } else{ From 6dbf031d3bb75bfdbd9f6990a22607c91231f623 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 7 Nov 2016 16:03:04 +0800 Subject: [PATCH 02/12] =?UTF-8?q?=E9=97=AE=E5=8D=B7=E7=BC=96=E8=BE=91icon?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=95=88=E6=9E=9C=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/poll/_poll_tool_bar.html.erb | 12 +++++++++++- app/views/poll/_show_MC.html.erb | 2 +- app/views/poll/_show_MCQ.html.erb | 2 +- app/views/poll/_show_head.html.erb | 2 +- app/views/poll/_show_mulit.html.erb | 2 +- app/views/poll/_show_single.html.erb | 2 +- 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/app/views/poll/_poll_tool_bar.html.erb b/app/views/poll/_poll_tool_bar.html.erb index e598a9ff9..63647d1b6 100644 --- a/app/views/poll/_poll_tool_bar.html.erb +++ b/app/views/poll/_poll_tool_bar.html.erb @@ -4,6 +4,7 @@ * <%end%>

+
<% poll = poll_question.poll %> <% count = poll.poll_questions.count %> <% unless poll_question.question_number == 1 %> @@ -21,4 +22,13 @@
<%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id), - method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "poll-delete", :title => "删除") %> \ No newline at end of file + method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "poll-delete", :title => "删除") %> + + \ No newline at end of file diff --git a/app/views/poll/_show_MC.html.erb b/app/views/poll/_show_MC.html.erb index c00522ed7..c610c07cd 100644 --- a/app/views/poll/_show_MC.html.erb +++ b/app/views/poll/_show_MC.html.erb @@ -7,7 +7,7 @@ <%= poll_question.question_title %> [单选题] - +
diff --git a/app/views/poll/_show_MCQ.html.erb b/app/views/poll/_show_MCQ.html.erb index 6612a3bb6..ab77be241 100644 --- a/app/views/poll/_show_MCQ.html.erb +++ b/app/views/poll/_show_MCQ.html.erb @@ -18,7 +18,7 @@

<% end %>
- +
diff --git a/app/views/poll/_show_head.html.erb b/app/views/poll/_show_head.html.erb index 44c560dfe..43941e1ce 100644 --- a/app/views/poll/_show_head.html.erb +++ b/app/views/poll/_show_head.html.erb @@ -1,5 +1,5 @@
- +

<%= poll.polls_name%>

<%= @poll.polls_description.nil? ? "" : @poll.polls_description.html_safe%>
diff --git a/app/views/poll/_show_mulit.html.erb b/app/views/poll/_show_mulit.html.erb index e72682165..fca5a7818 100644 --- a/app/views/poll/_show_mulit.html.erb +++ b/app/views/poll/_show_mulit.html.erb @@ -8,7 +8,7 @@ [多行主观题]
- +
<% poll_question.poll_answers.reorder("answer_position").each_with_index do |poll_answer, i| %>
diff --git a/app/views/poll/_show_single.html.erb b/app/views/poll/_show_single.html.erb index 88a14bccf..d3b00db55 100644 --- a/app/views/poll/_show_single.html.erb +++ b/app/views/poll/_show_single.html.erb @@ -8,7 +8,7 @@ [主观题]
- +
From 83c801878deb44990b3c390fd20ef2aea852eb98 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 7 Nov 2016 16:20:46 +0800 Subject: [PATCH 03/12] =?UTF-8?q?=E9=97=AE=E5=8D=B7=E7=AD=94=E9=A2=98?= =?UTF-8?q?=E4=B8=8E=E6=9F=A5=E7=9C=8B=E9=A1=B5=E9=A2=84=E8=A7=88=E7=AD=94?= =?UTF-8?q?=E9=A2=98=E6=A1=86=E7=9A=84=E5=AE=BD=E5=BA=A6=E8=AE=BE=E4=B8=BA?= =?UTF-8?q?=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/poll/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/poll/show.html.erb b/app/views/poll/show.html.erb index 104b30819..2ef7c4a26 100644 --- a/app/views/poll/show.html.erb +++ b/app/views/poll/show.html.erb @@ -241,7 +241,7 @@ } } - > +
From 2bb018b0fe6e005581bd41d5d37b286b3800edc0 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 7 Nov 2016 17:12:29 +0800 Subject: [PATCH 04/12] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E9=97=AE=E5=8D=B7?= =?UTF-8?q?=E7=9A=84=E5=BC=B9=E6=A1=86=E7=94=A8=E6=96=B0=E7=89=88=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/poll/_other_poll.html.erb | 37 +++++++++++++++++------------ app/views/poll/other_poll.js.erb | 19 ++++++++------- public/stylesheets/css/common.css | 1 + public/stylesheets/polls.css | 2 ++ 4 files changed, 35 insertions(+), 24 deletions(-) diff --git a/app/views/poll/_other_poll.html.erb b/app/views/poll/_other_poll.html.erb index f2b176081..8ceaf5112 100644 --- a/app/views/poll/_other_poll.html.erb +++ b/app/views/poll/_other_poll.html.erb @@ -1,19 +1,26 @@ -
-
-

选择问卷导入本班级

-
-
- <%= form_tag import_other_poll_poll_index_path, - method: :post, - id: "relation_file_form" do %> - - <%= content_tag('div', poll_check_box_tags('polls[]', polls,polls_group_id), :id => 'courses',:style=> 'width: 300px;')%> - 导  入 - 取  消 - <% end -%> +
+
+

选择问卷导入本班级

+ +
+
+
+ <%= form_tag import_other_poll_poll_index_path, + method: :post, + id: "relation_file_form" do %> + +
+ <% polls.each do |poll| %> +
  • + + +
  • + <% end %>
    - - +
    + 导  入 + 取  消 + <% end -%>
    diff --git a/app/views/poll/other_poll.js.erb b/app/views/poll/other_poll.js.erb index cbaa2bbec..80b5e4719 100644 --- a/app/views/poll/other_poll.js.erb +++ b/app/views/poll/other_poll.js.erb @@ -1,13 +1,14 @@ - <% if @polls.empty? %> alert('您的其它班级下没有问卷可供导入'); <% else %> - $('#ajax-modal').html('<%= escape_javascript(render :partial => 'other_poll',:locals => {:polls => @polls,:polls_group_id=>@polls_group_id}) %>'); - - - showModal('ajax-modal', '513px'); - $('#ajax-modal').siblings().remove(); - $('#ajax-modal').before(""); - $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); - $('#ajax-modal').parent().addClass("popbox_polls"); + var html_value = '<%= escape_javascript(render :partial => 'other_poll',:locals => {:polls => @polls,:polls_group_id=>@polls_group_id}) %>'; + pop_box_new(html_value, 510, 550); +// $('#ajax-modal').html('<%= escape_javascript(render :partial => 'other_poll',:locals => {:polls => @polls,:polls_group_id=>@polls_group_id}) %>'); +// +// +// showModal('ajax-modal', '513px'); +// $('#ajax-modal').siblings().remove(); +// $('#ajax-modal').before(""); +// $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); +// $('#ajax-modal').parent().addClass("popbox_polls"); <% end %> \ No newline at end of file diff --git a/public/stylesheets/css/common.css b/public/stylesheets/css/common.css index a2b577263..00f8ddc2a 100644 --- a/public/stylesheets/css/common.css +++ b/public/stylesheets/css/common.css @@ -158,6 +158,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/ .mr25 {margin-right:25px;} .mr27 {margin-right:27px;} .mr30{ margin-right:30px !important;} +.mr35{ margin-right:35px;} .mr40{ margin-right:40px !important;} .mr45{margin-right: 45px;} .mr50{margin-right: 50px;} diff --git a/public/stylesheets/polls.css b/public/stylesheets/polls.css index d92ddc962..085acd80f 100644 --- a/public/stylesheets/polls.css +++ b/public/stylesheets/polls.css @@ -151,4 +151,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;} +.import_poll_div{width: 430px; max-height: 550px; overflow-x:hidden; overflow-y: auto; margin: 10px auto;} + From 070e18a9b2d8dfac8ee37f5e0efb32e7751506e9 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 8 Nov 2016 15:39:00 +0800 Subject: [PATCH 05/12] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 2 +- app/views/users/_course_homework.html.erb | 16 +---------- app/views/users/_homework_base_info.html.erb | 30 ++++++-------------- app/views/users/_homework_opr.html.erb | 12 ++++---- 4 files changed, 16 insertions(+), 44 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index cf90e58a6..683bf2057 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2884,7 +2884,7 @@ module ApplicationHelper end #根据传入作业确定显示为编辑作品还是新建作品,或者显示作品数量 - def user_for_homework_common homework,is_teacher + def user_for_homework_common homework,is_teacher,work count = homework.student_works.has_committed.count if User.current.member_of_course?(homework.course) if is_teacher #老师显示作品数量 diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index f234a383a..00da3215d 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -3,7 +3,7 @@
    <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %> - <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %> + <%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %>
    @@ -63,17 +63,3 @@ <%= render :partial => 'users/homework_post_reply', :locals => {:activity => activity, :user_activity_id => user_activity_id, :hw_status => hw_status, :is_teacher => is_teacher} %>
    - diff --git a/app/views/users/_homework_base_info.html.erb b/app/views/users/_homework_base_info.html.erb index a3d216ef2..716a860ce 100644 --- a/app/views/users/_homework_base_info.html.erb +++ b/app/views/users/_homework_base_info.html.erb @@ -14,8 +14,6 @@
    缺评扣分:<%= activity.homework_detail_manual.absence_penalty%>分/作品
    - <% end %> - <% if activity.anonymous_comment == 0%>
    匿评关闭时间:<%= activity.homework_detail_manual.evaluation_end%> 23:59
    @@ -27,9 +25,7 @@
    # <%=time_from_now sw.commit_time %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
    -<% end %> -
    -<% if activity.student_works.has_committed.count != 0 %> +
    <% sw_id = "("+activity.student_works.map{|sw| sw.id}.join(",")+")" %> <%# student_work_scores = StudentWorksScore.find_by_sql("select max(created_at) as created_at, student_work_id, user_id from student_works_scores where student_work_id in #{sw_id} group by student_work_id order by max(created_at) desc") %> <% student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id} and score is not null").reorder("created_at desc") %> @@ -42,13 +38,8 @@
    <% end %>
    - <% if activity.homework_type != 2 %> - <% ids = student_work_scores.empty? ? "(-1)" : '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %> - <% student_works = activity.student_works.has_committed.select("student_works.*,student_works.work_score as score").where("student_works.id in #{ids}").order("score desc") %> - <% else %> - <% student_works = activity.student_works.has_committed.select("student_works.*,student_works.work_score as score").order("score desc") %> - <% end %> - <% student_works.includes(:user).each_with_index do |sw, i| %> + <% student_works = activity.student_works.select("student_works.*,student_works.work_score as score").where("work_score is not null and work_status != 0").order("score desc").limit(5) %> + <% student_works.includes(:user).each do |sw| %>
    <% if User.current.member_of_course?(activity.course) || User.current.admin? || activity.is_open == 1 %> @@ -63,14 +54,11 @@

    <% end %>
    - <% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %> + <% score = sw.respond_to?("score") ? sw.score : sw.work_score %>

    分数:<%=format("%.1f",score.to_f < 0 ? 0 : score.to_f) %>分

    - <% if i == 4 %> - <% break %> - <% end %> <% end %> - <% if student_works.count > 5 %> + <% if student_works.count == 5 %> <%= link_to "更多>>", student_work_index_url_in_org(activity.id, 2),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%> <% end %>
    @@ -83,11 +71,11 @@ <% sort_projects = project_sort_update projects %>
    - <%# first_pro = sort_projects.first %> - <% first_pro = Project.find sort_projects.first.project_id %> + <% first_pro_act = sort_projects.first %> + <% first_pro = Project.find first_pro_act.project_id %> <% commit_time = first_pro.project_score.commit_time %> - <% one_forge_time=ForgeActivity.where("project_id=?",first_pro.id).last.updated_at if ForgeActivity.where("project_id=?",first_pro.id).last %> - # <%=time_from_now !commit_time.nil? && format_time(commit_time) > format_time(one_forge_time) ? commit_time : one_forge_time %><%= link_to User.find(first_pro.user_id).show_name, user_activities_path(first_pro.user_id), :class => "newsBlue ml5 mr5"%>更新了项目 + <%# one_forge_time=ForgeActivity.where("project_id=?",first_pro.id).last.updated_at if ForgeActivity.where("project_id=?",first_pro.id).last %> + # <%=time_from_now !commit_time.nil? && format_time(commit_time) > format_time(first_pro_act.updated_at) ? commit_time : first_pro_act.updated_at %><%= link_to User.find(first_pro.user_id).show_name, user_activities_path(first_pro.user_id), :class => "newsBlue ml5 mr5"%>更新了项目
    diff --git a/app/views/users/_homework_opr.html.erb b/app/views/users/_homework_opr.html.erb index 90acbf830..9105f7067 100644 --- a/app/views/users/_homework_opr.html.erb +++ b/app/views/users/_homework_opr.html.erb @@ -1,20 +1,19 @@ +<% work = cur_user_works_for_homework activity %> <% if activity.homework_type == 3 && !is_teacher && activity.homework_detail_group.base_on_project == 1 && User.current.member_of_course?(activity.course)%> <% projects = cur_user_projects_for_homework activity %> - <% works = cur_user_works_for_homework activity %> - <% if works.nil? && projects.nil? %> + <% if work.nil? && projects.nil? %>
    <%=link_to "关联项目",new_student_work_project_student_work_index_path(:homework => activity.id,:hw_status=>hw_status,:user_activity_id=>user_activity_id),remote: true,:class=> 'c_blue', :title=> '请各组长关联作业项目' %>
    - <% elsif works.nil? %> + <% elsif work.nil? %>
    <%=link_to "取消关联",cancel_relate_project_student_work_index_path(:homework => activity.id,:hw_status=>hw_status,:user_activity_id=>user_activity_id), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目' %>
    <% end %> <% end %>
    - <%= user_for_homework_common activity,is_teacher %> + <%= user_for_homework_common activity,is_teacher,work %>
    -<% work = cur_user_works_for_homework activity %> <% if !is_teacher && !work.nil? && work.user == User.current && activity.end_time < Date.today %>
    <%=link_to "追加附件", student_work_index_url_in_org(activity.id, 2, 1), :class => 'c_blue', :title => "可追加作品修订附件" %> @@ -35,8 +34,7 @@ 语言: <%= activity.language_name%>
    -<% end %> -<% if activity.homework_type == 3 && activity.homework_detail_group%> +<% elsif activity.homework_type == 3 && activity.homework_detail_group%> <% if activity.homework_detail_group.base_on_project == 1 %>
    项目(<%=activity.student_work_projects.where("is_leader = 1").count %>) From 6cc38ee51e3a69ae870b16f4f8d0a4f900099346 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 10 Nov 2016 17:12:04 +0800 Subject: [PATCH 06/12] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E7=95=99=E8=A8=80?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E4=B8=AD=E7=94=A8=E6=88=B7=E5=A4=B4=E5=83=8F?= =?UTF-8?q?=E5=BB=BA=E8=AE=AE=E5=8A=A0=E9=93=BE=E6=8E=A5=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E8=AF=A5=E7=94=A8=E6=88=B7=E4=B8=BB=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/words/_journal_reply_items.html.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/words/_journal_reply_items.html.erb b/app/views/words/_journal_reply_items.html.erb index cdfee3e9f..2e06c1fb1 100644 --- a/app/views/words/_journal_reply_items.html.erb +++ b/app/views/words/_journal_reply_items.html.erb @@ -4,14 +4,14 @@ <% reply_allow = JournalsForMessage.create_by_user? User.current %> <% ids_r = 'reply_respond_form_'+ reply.id.to_s %>
    -
    +
    <% if show_name %> - <%= image_tag url_to_avatar(reply.user),:width => '30',:height => '30' %> + <%= link_to image_tag(url_to_avatar(reply.user),:width => '30',:height => '30'), user_path(reply.user) %> <% else %> - <%= image_tag url_to_avatar(nil),:width => '30',:height => '30' %> + <%= link_to image_tag(url_to_avatar(nil),:width => '30',:height => '30'), user_path(reply.user) %> <% end %>
    -
    +
    <% id = 'project_respond_form_'+ reply.id.to_s %> <%= link_to reply.user.show_name, user_path(reply.user) %> <%= l(:label_reply_to)%> From 4a5e350615122752ad98c7c2fa9314daa5b2c72e Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 10 Nov 2016 17:24:00 +0800 Subject: [PATCH 07/12] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=EF=BC=9A=E5=88=A0=E9=99=A4=E4=B8=AA=E4=BA=BA=E7=95=99=E8=A8=80?= =?UTF-8?q?=E5=8A=A8=E6=80=81=EF=BC=8C=E5=8D=B4=E8=B7=B3=E8=BD=AC=E5=88=B0?= =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E7=95=99=E8=A8=80=E9=A1=B5=E9=9D=A2=E5=8E=BB?= =?UTF-8?q?=E4=BA=86=EF=BC=8C=E4=B8=8D=E5=90=88=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/words_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index de232a423..e4b480e2f 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -102,7 +102,11 @@ class WordsController < ApplicationController @user_activity_id = params[:user_activity_id] if params[:user_activity_id] @activity = JournalsForMessage.where("id = #{params[:activity_id].to_i}").first if params[:activity_id] unless @activity - redirect_to feedback_path(@user) + if params[:user_activity_id] == params[:activity_id] + redirect_to feedback_path(@user) + else + redirect_to user_path(@user) + end return end elsif @journal_destroyed.jour_type == 'HomeworkCommon' From 1e0c2e5d6ad17eed4744c464abf6643176269151 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 10 Nov 2016 17:28:14 +0800 Subject: [PATCH 08/12] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E7=9A=84=E6=B4=BB=E8=B7=83=E5=BA=A6=E5=92=8C=E8=8B=B1=E9=9B=84?= =?UTF-8?q?=E6=A6=9C=E7=94=B13=E4=B8=AA=E5=A2=9E=E5=8A=A0=E5=88=B06?= =?UTF-8?q?=E4=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 37c4c037c..52dc9e5c4 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -895,7 +895,7 @@ module CoursesHelper desc.html_safe end - # 学生按作业总分排序,取前3个 + # 学生按作业总分排序,取前6个 def hero_homework_score(course, score_sort_by) sql_select = "SELECT members.*,( SELECT SUM(work_score) @@ -907,14 +907,14 @@ module CoursesHelper FROM members JOIN students_for_courses ON students_for_courses.student_id = members.user_id AND students_for_courses.course_id = members.course_id - WHERE members.course_id = #{course.id} ORDER BY score #{score_sort_by} limit 3" + WHERE members.course_id = #{course.id} ORDER BY score #{score_sort_by} limit 6" homework_scores = Member.find_by_sql(sql_select) end def contributor_course_scor(course_id) ccs = CourseContributorScore.find_by_sql("SELECT * FROM `course_contributor_scores` where course_id = #{course_id} order by (message_num*2 + message_reply_num + news_reply_num + news_num + - resource_num*5 + journal_num + homework_journal_num ) desc limit 3;") + resource_num*5 + journal_num + homework_journal_num ) desc limit 6;") end #用户在该课程是否具有某个角色 From 0d8d2fbc90b2f1a68326be1e02bda8db1c772259 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Nov 2016 09:29:29 +0800 Subject: [PATCH 09/12] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E6=B4=BB=E8=B7=83?= =?UTF-8?q?=E5=BA=A6=E6=8E=92=E8=A1=8C=E5=8E=BB=E9=99=A4=E8=80=81=E5=B8=88?= =?UTF-8?q?=E5=92=8C=E6=95=99=E8=BE=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 7 ++++--- app/views/courses/_course_activity_users.html.erb | 7 ++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 52dc9e5c4..e97d32523 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -912,9 +912,10 @@ module CoursesHelper end def contributor_course_scor(course_id) - ccs = CourseContributorScore.find_by_sql("SELECT * FROM `course_contributor_scores` where course_id = #{course_id} order by - (message_num*2 + message_reply_num + news_reply_num + news_num + - resource_num*5 + journal_num + homework_journal_num ) desc limit 6;") + ccs = CourseContributorScore.find_by_sql("SELECT ccs.*, (message_num*2 + message_reply_num + news_reply_num + news_num + + resource_num*5 + journal_num + homework_journal_num ) as con_score FROM `course_contributor_scores` ccs JOIN students_for_courses sfs + ON sfs.student_id = ccs.user_id AND sfs.course_id = ccs.course_id where ccs.course_id = #{course_id} order by + con_score desc limit 6;") end #用户在该课程是否具有某个角色 diff --git a/app/views/courses/_course_activity_users.html.erb b/app/views/courses/_course_activity_users.html.erb index 67ec2ede9..459f60f3d 100644 --- a/app/views/courses/_course_activity_users.html.erb +++ b/app/views/courses/_course_activity_users.html.erb @@ -23,11 +23,8 @@ 总得分为以上得分之和
    <% contributor_course_scor(course.id).each do |contributor_score| %> - <% total_score = contributor_score.resource_num.to_i * 5 + contributor_score.message_num.to_i * 2 + - contributor_score.message_reply_num.to_i * 1 + contributor_score.journal_num.to_i * 1 + - + contributor_score.homework_journal_num.to_i * 1 + contributor_score.news_reply_num.to_i * 1 + - contributor_score.news_num.to_i * 1 %> - <% unless total_score ==0 %> + <% total_score = contributor_score.con_score %> + <% if !total_score.nil? && total_score !=0 %>
  • <%=link_to image_tag(url_to_avatar(contributor_score.user), :width => "50", :height => "50", :class=> "rankPortrait"),user_path(contributor_score.user) %>

    <%=link_to contributor_score.user.show_name, user_path(contributor_score.user.id), :title => contributor_score.user.show_name %>

    From 07b97c8eb988ed620c8adaa460ef9739640865d2 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Nov 2016 13:58:07 +0800 Subject: [PATCH 10/12] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=A0=E9=99=A4=E5=8A=9F=E8=83=BD=E3=80=81?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=AD=A6=E7=94=9F=E6=97=B6=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=85=B6=E5=AF=B9=E5=BA=94=E7=9A=84=E4=BD=9C=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 29 +++++++++++++++++++++ app/controllers/members_controller.rb | 4 +-- app/controllers/watchers_controller.rb | 2 +- app/models/students_for_course.rb | 10 ++++++- app/services/courses_service.rb | 12 ++++----- app/views/courses/_new_member_list.html.erb | 25 ++++++++++++------ app/views/courses/delete_member.js.erb | 4 +++ config/routes.rb | 1 + public/javascripts/application.js | 9 +++++++ public/stylesheets/syllabus.css | 6 +++-- 10 files changed, 82 insertions(+), 20 deletions(-) create mode 100644 app/views/courses/delete_member.js.erb diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index db18566db..dd31d3778 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -558,6 +558,35 @@ class CoursesController < ApplicationController end end + def delete_member + member = @course.members.find params[:member_id] + student_role = member.member_roles.where("role_id = 10").first + if member && member.deletable? && student_role + user_admin = CourseInfos.where("user_id = ? and course_id = ?", member.user_id, @course.id) + if user_admin.size > 0 + user_admin.destroy_all + end + joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,@course.id) + joined.destroy_all + + if member.member_roles.count > 1 + student_role.destroy + member.update_attribute("course_group_id", 0) + else + member.destroy + end + #移出课程发送消息 + CourseMessage.create(:user_id => member.user_id, :course_id => @course.id, :course_message_type => "RemoveFromCourse", :viewed => false, :course_message_id => User.current.id) + + @course_groups = @course.course_groups + @no_group_count = @course.student.count - @course.members.where("course_group_id != 0").count + @canShowCode = isCourseTeacher(User.current.id,@course) + respond_to do |format| + format.js + end + end + end + def handle_course courses, activities course_activity_count_array=activities.values() course_array=[] diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index 0be18ea5c..5f0dbda97 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -337,7 +337,7 @@ class MembersController < ApplicationController else joined = StudentsForCourse.where('student_id = ? and course_id = ?', @member.user_id,@course.id) joined.each do |join| - join.delete + join.destroy end @member.course_group_id = 0 end @@ -423,7 +423,7 @@ class MembersController < ApplicationController end joined = StudentsForCourse.where('student_id = ? and course_id = ?', @member.user_id,@course.id) joined.each do |join| - join.delete + join.destroy end @roles = Role.givable.all[3..5] @members = @course.member_principals.includes(:roles, :principal).all.sort diff --git a/app/controllers/watchers_controller.rb b/app/controllers/watchers_controller.rb index 304ba10a2..da0c5733a 100644 --- a/app/controllers/watchers_controller.rb +++ b/app/controllers/watchers_controller.rb @@ -125,7 +125,7 @@ class WatchersController < ApplicationController joined = StudentsForCourse.where('student_id = ? and course_id = ?', User.current.id, params[:object_id]) joined.each do |join| - join.delete + join.destroy end end respond_to do |format| diff --git a/app/models/students_for_course.rb b/app/models/students_for_course.rb index 6958cfe73..767d65b10 100644 --- a/app/models/students_for_course.rb +++ b/app/models/students_for_course.rb @@ -7,5 +7,13 @@ class StudentsForCourse < ActiveRecord::Base validates_presence_of :course_id, :student_id validates_uniqueness_of :student_id, :scope => :course_id - + + after_destroy :delete_student_works + + def delete_student_works + course = self.course + homework_ids = course.homework_commons.blank? ? "(-1)" : "(" + course.homework_commons.map{|hw| hw.id}.join(",") + ")" + student_works = StudentWork.where("user_id = #{self.student_id} && homework_common_id in #{homework_ids}") + student_works.destroy_all + end end diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 69864f226..f72623d84 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -207,7 +207,7 @@ class CoursesService unless member.role_ids.include?(10) joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,c.id) joined.each do |join| - join.delete + join.destroy end end @@ -460,7 +460,7 @@ class CoursesService @member.first.destroy joined = StudentsForCourse.where('student_id = ? and course_id = ?', user.id, params[:object_id]) joined.each do |join| - join.delete + join.destroy end @state = 0 @state @@ -837,7 +837,7 @@ class CoursesService member = Member.new(:role_ids =>[7], :user_id => params[:user_id],:course_id=>params[:course_id]) joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,course.id) joined.each do |join| - join.delete + join.destroy end member.course_group_id = 0 members << member @@ -858,7 +858,7 @@ class CoursesService end joined = StudentsForCourse.where('student_id = ? and course_id = ?', params[:user_id],params[:course_id]) joined.each do |join| - join.delete + join.destroy end end @@ -1261,7 +1261,7 @@ class CoursesService else joined = StudentsForCourse.where('student_id = ? and course_id = ?', params[:user_id],params[:id]) joined.each do |join| - join.delete + join.destroy end member.course_group_id = 0 end @@ -1305,7 +1305,7 @@ class CoursesService end joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,course.id) joined.each do |join| - join.delete + join.destroy end roles = Role.givable.all[3..5] #移出课程发送消息 diff --git a/app/views/courses/_new_member_list.html.erb b/app/views/courses/_new_member_list.html.erb index 7b59b2db6..d04e14cc8 100644 --- a/app/views/courses/_new_member_list.html.erb +++ b/app/views/courses/_new_member_list.html.erb @@ -1,8 +1,9 @@ +<% is_teacher = User.current.allowed_to?(:as_teacher, @course) || User.current.admin? %> <% if members.any? %>
  • - + - - - - + <% if is_teacher %> + + <% end %> @@ -98,10 +102,10 @@ + <% if is_teacher %> + + <% end %> <% end %> diff --git a/app/views/courses/delete_member.js.erb b/app/views/courses/delete_member.js.erb new file mode 100644 index 000000000..144ad749b --- /dev/null +++ b/app/views/courses/delete_member.js.erb @@ -0,0 +1,4 @@ +hideModal(); +$("#member_li_<%=params[:member_id] %>").html(""); +$("#st_groups").html("<%=escape_javascript(render :partial => 'new_groups_name', :locals => {:course_groups => @course_groups}) %>"); +$("#group_children_list").html("<%= escape_javascript( render :partial => 'layouts/group_children_list', :locals => {:course => @course})%>"); diff --git a/config/routes.rb b/config/routes.rb index e5a122f19..e25689099 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1238,6 +1238,7 @@ RedmineApp::Application.routes.draw do get "switch_role" get 'search_not_group_member' post 'add_members' + get 'delete_member' end collection do match 'join_private_courses', :via => [:get, :post] diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 6248194f5..a7126c002 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1768,6 +1768,15 @@ function expand_course_list(id, target, btnid, count) { btn.parent().show(); } } + +//点击删除时的确认弹框 +function delete_confirm_box(url, str){ + var htmlvalue = '

    提示

    '+ + '

    ' + str + '

    确定'+ + '取消
    '; + pop_box_new(htmlvalue, 300, 140); +} + //删除组织成员 function ifDeleteOrgMember(id,name){ var htmlvalue = "
    您确定要删除"+name+"吗?

    确定取消
    " + diff --git a/public/stylesheets/syllabus.css b/public/stylesheets/syllabus.css index 3eecc01c6..64640f96f 100644 --- a/public/stylesheets/syllabus.css +++ b/public/stylesheets/syllabus.css @@ -629,9 +629,11 @@ a:hover.sy_class_ltitle{ color:#333;} .sy_class_users_st img{ width:30px;height:30px; border: 1px solid #fff;-webkit-border-radius:50px;-moz-border-radius:50px;-o-border-radius:50px;border-radius:50px;} .sy_fenban_select{height: 28px; background-color: #fff; border: 1px solid #d1d1d1;-webkit-border-radius:3px;-moz-border-radius:3px;-o-border-radius:3px;border-radius:3px; border:1px solid #d3d3d3;padding-left:5px; color:#888; box-shadow: inset 0px 0px 5px #dcdcdc; } .sy_new_table_width tr th.sy_th10{ width: 10%; } -.sy_new_table_width tr th.sy_th0{ width: 12.5%; } +.sy_new_table_width tr th.sy_th0{ width: 12%; } +.sy_new_table_width tr th.sy_th1{ width: 12.5%; } .sy_new_table_width tr th.sy_th15{ width: 15%; } -.sy_new_table_width tr th.sy_th7{ width: 7%;} +.sy_new_table_width tr th.sy_th6{ width: 6%;} +.sy_new_table_width tr th.sy_th3{ width: 3%;} .sy_new_table_width tr th.sy_th13{ width: 13%;} .sy_fenban_tap{ cursor: pointer; position: relative;} .sy_fenban_tap:hover .sy_fenban_show{ display: block;} From d1bfdde26138e68a3d74ae1e290e91d07566cc86 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Nov 2016 15:19:22 +0800 Subject: [PATCH 11/12] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E5=91=BD=E5=90=8D=E5=92=8C=E6=98=BE=E7=A4=BA=E8=A7=84=E8=8C=83?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 10 +++++----- app/views/courses/_recommendation.html.erb | 2 -- app/views/courses/new.html.erb | 6 +++--- app/views/courses/settings.html.erb | 5 +++-- app/views/layouts/_course_base_info.html.erb | 4 +--- app/views/layouts/_user_courses.html.erb | 2 +- .../_homework_post_brief.html.erb | 2 -- .../syllabuses/_syllabus_course_list.html.erb | 4 ---- app/views/users/_course_attachment.html.erb | 2 -- app/views/users/_course_create.html.erb | 2 -- app/views/users/_course_homework.html.erb | 2 -- .../users/_course_journalsformessage.html.erb | 2 -- app/views/users/_course_message.html.erb | 2 -- app/views/users/_course_news.html.erb | 2 -- app/views/users/_course_poll.html.erb | 2 -- .../users/_homework_repository_list.html.erb | 2 -- .../users/_manage_homework_list.html.erb | 2 -- .../users/_receive_homework_list.html.erb | 2 -- .../users/_user_homework_detail.html.erb | 2 -- .../20161111070615_update_course_name.rb | 19 +++++++++++++++++++ db/schema.rb | 16 +++++++++++++++- public/javascripts/course.js | 13 ++++++++++++- 22 files changed, 59 insertions(+), 46 deletions(-) create mode 100644 db/migrate/20161111070615_update_course_name.rb diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index dd31d3778..4af7d6644 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -829,11 +829,11 @@ class CoursesController < ApplicationController end if @course #发送微信消息 - count = ShieldWechatMessage.where("container_type='User' and container_id=#{User.current.id} and shield_type='Course' and shield_id=#{@course.id}").count - if count == 0 - ss = SyllabusesService.new - ss.send_wechat_create_class_notice User.current,@course - end + # count = ShieldWechatMessage.where("container_type='User' and container_id=#{User.current.id} and shield_type='Course' and shield_id=#{@course.id}").count + # if count == 0 + # ss = SyllabusesService.new + # ss.send_wechat_create_class_notice User.current,@course + # end respond_to do |format| flash[:notice] = l(:notice_successful_create) format.html {redirect_to course_url(@course)} diff --git a/app/views/courses/_recommendation.html.erb b/app/views/courses/_recommendation.html.erb index cb31db24f..6dffb1da3 100644 --- a/app/views/courses/_recommendation.html.erb +++ b/app/views/courses/_recommendation.html.erb @@ -5,8 +5,6 @@
  • <%= i+1 %>
    - <%= link_to e_course.syllabus.title, syllabus_path(e_course.syllabus_id), :target => '_blank', :class => "sy_class_ltitle"%> -  ·  <%=link_to e_course.name, course_path(e_course.id), :class => "sy_class_ltitle mb10" %>
    diff --git a/app/views/courses/new.html.erb b/app/views/courses/new.html.erb index da637320e..ec763961b 100644 --- a/app/views/courses/new.html.erb +++ b/app/views/courses/new.html.erb @@ -18,13 +18,13 @@
  • - +
  • -
  • 正确示例:计算机系2016秋季A班
  • -
  • 错误示例:软件工程 - 计算机系2016秋季A班
  • +
  • 正确示例:软件工程计算机系2016秋季A班
  • +
  • 错误示例:计算机系2016秋季A班
  • diff --git a/app/views/courses/settings.html.erb b/app/views/courses/settings.html.erb index 519bef7be..82e55328b 100644 --- a/app/views/courses/settings.html.erb +++ b/app/views/courses/settings.html.erb @@ -39,14 +39,15 @@
  • - <%=@course.syllabus.title %> + <%=@course.syllabus.title %> <%#= select_tag :syllabus_id,options_for_select(course_syllabus_option,@course.syllabus_id), {:id=>"edit_syllabus_id", :class=>"syllabus_input", :style=>'width:210px'} %>
  • - +
    +
  • diff --git a/app/views/layouts/_course_base_info.html.erb b/app/views/layouts/_course_base_info.html.erb index 608f08a58..e3041f92c 100644 --- a/app/views/layouts/_course_base_info.html.erb +++ b/app/views/layouts/_course_base_info.html.erb @@ -6,7 +6,7 @@ <%= link_to(@course.teacher.show_name, user_path(@course.teacher), :class => 'sy_cgrey') %>  >  <% if @course.syllabus %> - <%=link_to @course.syllabus.title, syllabus_path(@course.syllabus_id), :class => 'sy_cgrey' %> + <%=link_to @course.syllabus.title, syllabus_path(@course.syllabus_id), :class => 'sy_cgrey', :title => '课程名称' %>  >  <% end %> <%=link_to @course.name, course_path(@course), :class => 'sy_cgrey' %> @@ -55,8 +55,6 @@

    - <%= link_to @course.syllabus.title, syllabus_path(@course.syllabus_id), :class =>'c_dark', :target => '_blank'%> -  ·  <%=@course.name %>

    diff --git a/app/views/layouts/_user_courses.html.erb b/app/views/layouts/_user_courses.html.erb index 3e9ba3019..1b4f38ec5 100644 --- a/app/views/layouts/_user_courses.html.erb +++ b/app/views/layouts/_user_courses.html.erb @@ -3,7 +3,7 @@ <% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) %>

    - <%= link_to course.syllabus.title + course.name, course_path(course.id,:host=>Setting.host_course), :target => '_blank', :class => 'hidden', :style => 'display:block;'%> + <%= link_to course.name, course_path(course.id,:host=>Setting.host_course), :target => '_blank', :class => 'hidden', :style => 'display:block;'%>

  • 序号序号 姓名 <%= link_to '学号', member_score_sort_course_path(:sort_type => 'student_id', :sort_by => (@score_sort_by == "desc" ? "asc" : "desc"), :group_id => (@group ? (@group == -1 ? -1 : @group.id) : 0), :search_name => (@search_name ? @search_name : nil)), :result => members, method: 'get', remote: true, :style => 'color:#000000;'%> @@ -12,7 +13,7 @@ <% end %> + <%= link_to '作业得分', member_score_sort_course_path(:sort_type => 'score', :sort_by => (@score_sort_by == "desc" ? "asc" : "desc"), :group_id => (@group ? (@group == -1 ? -1 : @group.id) : 0), :search_name => (@search_name ? @search_name : nil)), :result => members, method: 'get', remote: true, :style => 'color:#000000;'%> <% if @sort_type == "score" && @score_sort_by == 'desc' %> @@ -24,7 +25,7 @@ 班级作业的得分总和

    + <%= link_to '测评得分', member_score_sort_course_path(:sort_type => 'ex_score', :sort_by => (@score_sort_by == "desc" ? "asc" : "desc"), :group_id => (@group ? (@group == -1 ? -1 : @group.id) : 0), :search_name => (@search_name ? @search_name : nil)), :result => members, method: 'get', remote: true, :style => 'color:#000000;'%> <% if @sort_type == "ex_score" && @score_sort_by == 'desc' %> @@ -36,7 +37,7 @@ 班级测验的得分总和

    + <%= link_to '社区得分', member_score_sort_course_path(:sort_type => 'act_score', :sort_by => (@score_sort_by == "desc" ? "asc" : "desc"), :group_id => (@group ? (@group == -1 ? -1 : @group.id) : 0),:search_name => (@search_name ? @search_name : nil)) ,:result => members,method: 'get', remote: true, :style => 'color:#000000;'%> <% if @sort_type == "act_score" && @score_sort_by == 'desc' %> @@ -56,13 +57,16 @@

    总得分 + 总得分

    积分规则
    作业得分+测评得分+社区得分

    分班
    <%= format("%0.2f", sum) %> -
    +

    - <%= user.show_name %>
    + <%= user.show_name %>(<%=user.login %>)
    资源    发布数:<%= member.resource_num.nil? ? 0 : member.resource_num %>
    问答    发布数:<%= member.message_num.nil? ? 0 : member.message_num %>回复数:<%= member.message_reply_num.nil? ? 0 : member.message_reply_num %>
    通知    提交数:<%= member.news_num.nil? ? 0 : member.news_num %>留言数:<%= member.news_reply_num.nil? ? 0 : member.news_reply_num %>
    @@ -112,7 +116,7 @@

    - <% if User.current.allowed_to?(:as_teacher, @course) || User.current.admin? || User.current == user %> + <% if is_teacher || User.current == user %> <% if @course.course_groups.empty? %> <%=member.course_group_id == 0 ? "暂无" : member.course_group.name %> <% else %> @@ -130,6 +134,11 @@ <%=member.course_group_id == 0 ? "暂无" : member.course_group.name %> <% end %> + +