From 356fbfe792d612f381a8b1369eb81c90493537ca Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 7 Nov 2016 15:44:40 +0800 Subject: [PATCH 01/40] =?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/40] =?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/40] =?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/40] =?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/40] =?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 43e72813b4d46b05799484ea0869191f72d97fac Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 10 Nov 2016 11:11:28 +0800 Subject: [PATCH 06/40] =?UTF-8?q?=E5=BD=93=E6=8C=87=E6=B4=BE=E7=9D=80?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E6=97=B6=EF=BC=8C=E5=AF=BC=E5=87=BA=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E4=B8=BA=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/issues_controller.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 8ba2ce20f..a137b7cd1 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -235,7 +235,9 @@ class IssuesController < ApplicationController # 给该issue在它所在的项目中所有的issues中所在的位置给一个序号 @issue.project_issues_index = @issue.project.issues.last.nil? ? 1 : @issue.project.issues.last.project_issues_index + 1 @issue.fixed_version_id = nil if @issue.fixed_version_id == 0 + @issue.assigned_to_id = nil if @issue.assigned_to_id == 0 if @issue.save + #params[:issue][:assigned_to_id] = nil if params[:issue][:assigned_to_id].to_i == 0 senduser = User.find(params[:issue][:assigned_to_id]) issue_id = @issue.id issue_title = params[:issue][:subject] @@ -282,15 +284,18 @@ class IssuesController < ApplicationController # 用户编辑更改issue def update + # params[:assigned_to_id] = nil if params[:assigned_to_id].to_i == 0 if params[:issue_detail] issue = Issue.find(params[:id]) issue = update_user_issue_detail(issue, params) + @issue.assigned_to_id = nil if @issue.assigned_to_id == 0 @saved = update_user_issue_detail(issue, params) return else # 修改实例变量的值 return unless update_issue_from_params @issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads])) + @issue.assigned_to_id = nil if @issue.assigned_to_id == 0 saved = false begin @saved = @issue.save_issue_with_child_records(params, @time_entry) From 4fc98308bcc5f3337055acf05ab47a29a7157f34 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 10 Nov 2016 13:34:43 +0800 Subject: [PATCH 07/40] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=AE=80=E4=BB=8B?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/mailer/send_for_user_activities.html.erb | 2 +- public/stylesheets/css/project.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb index 7fdd737e3..53e20dab0 100644 --- a/app/views/mailer/send_for_user_activities.html.erb +++ b/app/views/mailer/send_for_user_activities.html.erb @@ -189,7 +189,7 @@ <% if @issues.first || @project_messages.first || @issues_journals.first || @wiki_contents.first || @project_news.first || @project_news_comments.first || @project_journal_messages.first || @project_attachments.first %>
    -

    <%= l(:label_project_overview_new)%>

    +

    <%= l(:label_project_overview_new) %>

    <% if !@issues.first.nil? || !@issues_journals.first.nil? %>
      diff --git a/public/stylesheets/css/project.css b/public/stylesheets/css/project.css index 09dced2ad..3096afbab 100644 --- a/public/stylesheets/css/project.css +++ b/public/stylesheets/css/project.css @@ -880,7 +880,7 @@ a:hover.btn_newpro_grey,a:active.btn_newpro_grey{ background: #eaeaea;} /*项目简介*/ .pro_new_info{ border:1px solid #ddd; background-color:#fff; width: 998px;} .pro_new_info h2{ background: #fff; font-size: 14px; color: #333; height: 40px; line-height: 40px; padding-left: 15px; border-bottom:1px solid #e5e5e5;} -.pro_new_info p{ padding:15px; color: #666;} +.pro_new_info p{ padding:5px; color: #666;} .pro_new_info_weight{ font-size: 16px; font-weight: bold;} /* 新版项目配置*/ .pro_new_setting_leftnav{ width: 162px; border:1px solid #ddd; background-color:#fff; padding:3px; padding-bottom: 0;} From 5bf519bbf7c29b4d3b0287376e2b18437ec7325d Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 10 Nov 2016 14:18:53 +0800 Subject: [PATCH 08/40] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=87=8C=E7=A8=8B?= =?UTF-8?q?=E7=A2=91=EF=BC=8C=E6=96=B0=E5=BB=BA=E9=87=8C=E7=A8=8B=E7=A2=91?= =?UTF-8?q?=E5=BC=B9=E6=A1=86=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/versions/_new_milestone.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/versions/_new_milestone.html.erb b/app/views/versions/_new_milestone.html.erb index 47c1d2b39..40fff71f2 100644 --- a/app/views/versions/_new_milestone.html.erb +++ b/app/views/versions/_new_milestone.html.erb @@ -22,7 +22,7 @@
    • -
    - + - + From 6cc38ee51e3a69ae870b16f4f8d0a4f900099346 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 10 Nov 2016 17:12:04 +0800 Subject: [PATCH 11/40] =?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 ae84afe43efb163f013504434b4cae544f9888e5 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 10 Nov 2016 17:16:54 +0800 Subject: [PATCH 12/40] =?UTF-8?q?=E9=A1=B9=E7=9B=AEissue=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E5=BB=BA=E5=92=8C=E7=BC=96=E8=BE=91issue=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E9=99=84=E4=BB=B6=E6=97=B6=EF=BC=8C=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E6=8C=89=E9=92=AE=E4=B8=8D=E5=8F=AF=E7=82=B9=E5=87=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/attachments/upload.js.erb | 3 +++ app/views/issues/_form.html.erb | 3 ++- public/javascripts/attachments.js | 4 ++++ public/stylesheets/css/project.css | 15 +++++++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/app/views/attachments/upload.js.erb b/app/views/attachments/upload.js.erb index 62db5ebfd..7a0a195ad 100644 --- a/app/views/attachments/upload.js.erb +++ b/app/views/attachments/upload.js.erb @@ -1,3 +1,6 @@ +$('#issue_confirm').removeAttr("disabled"); +$('#issue_confirm').css('background-color', '#3b94d6'); +$('#issue_confirm').css('cursor','pointer'); var fileSpan = $('#attachments_<%= j params[:attachment_id] %>'); <% if(!@attachment.nil? && @attachment.new_record?) %> fileSpan.hide(); diff --git a/app/views/issues/_form.html.erb b/app/views/issues/_form.html.erb index 649965b97..390d1d6f5 100644 --- a/app/views/issues/_form.html.erb +++ b/app/views/issues/_form.html.erb @@ -62,7 +62,8 @@ 取消 <% end %> - 保存 + +
      diff --git a/public/javascripts/attachments.js b/public/javascripts/attachments.js index 7c3e513f7..27d03ab0b 100644 --- a/public/javascripts/attachments.js +++ b/public/javascripts/attachments.js @@ -91,6 +91,10 @@ function addFile_board(inputEl, file, eagerUpload, id,btnId) { function addFile(inputEl, file, eagerUpload,btnId) { var attachments_frame = '#attachments_fields'; + // $("#issue_confirm").attr('href', '#'); + $('#issue_confirm').attr("disabled",true); + $('#issue_confirm').css('background-color','#c1c1c1'); + $('#issue_confirm').css('cursor','default'); if (true) { deleteallfiles = $(inputEl).data('deleteAllFiles'); var attachmentId = addFile.nextAttachmentId++; diff --git a/public/stylesheets/css/project.css b/public/stylesheets/css/project.css index 3096afbab..e82d524c7 100644 --- a/public/stylesheets/css/project.css +++ b/public/stylesheets/css/project.css @@ -704,6 +704,21 @@ a.sy_btn_blue{ -o-border-radius:3px; border-radius:3px; } +input.sy_btn_blue{ + display: inline-block; + color: #fff; + background: #3b94d6; + text-align: center; + font-size: 12px; + padding:0 15px; + height: 30px; + line-height: 30px; + -webkit-border-radius:3px; + -moz-border-radius:3px; + -o-border-radius:3px; + border-radius:3px; + cursor:pointer; +} a:hover.sy_btn_blue{ background: #2788d0;} a.hw_btn_blue{ display: inline-block; From 4a5e350615122752ad98c7c2fa9314daa5b2c72e Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 10 Nov 2016 17:24:00 +0800 Subject: [PATCH 13/40] =?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 14/40] =?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 9bdc76b6e37bef00c23f470a5ac30f0ea48b57f8 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 10 Nov 2016 17:34:58 +0800 Subject: [PATCH 15/40] =?UTF-8?q?=E9=A1=B9=E7=9B=AEissue=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=EF=BC=8C=E7=82=B9=E5=87=BB=E6=8C=87=E6=B4=BE?= =?UTF-8?q?=E7=BB=99=E8=B7=B3=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/issues/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 4408f041b..5df730cdb 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -61,7 +61,7 @@
    • 指派给 - <%= @issue.assigned_to ? @issue.assigned_to.show_name : "--" %> + " class="c_blue" ><%= @issue.assigned_to ? @issue.assigned_to.show_name : "--" %>
    • <% end %> <% unless @issue.disabled_core_fields.include?('fixed_version_id') %> From 0d8d2fbc90b2f1a68326be1e02bda8db1c772259 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Nov 2016 09:29:29 +0800 Subject: [PATCH 16/40] =?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 aab24ea34a64504019a938165fcbe6721be6ff40 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 11 Nov 2016 10:37:20 +0800 Subject: [PATCH 17/40] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E9=A1=B6=E9=83=A8fork?= =?UTF-8?q?=E8=B7=AF=E7=94=B1=E9=94=99=E8=AF=AF=EF=BC=8C=E5=B7=B2=E7=BB=8F?= =?UTF-8?q?fork=E8=BF=87=E8=AF=A5=E9=A1=B9=E7=9B=AE=E7=9A=84=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 2 +- app/helpers/application_helper.rb | 12 ++++++++++++ app/models/journals_for_message.rb | 2 +- app/views/projects/_applied_status.html.erb | 2 +- app/views/repositories/_forked_popbox.html.erb | 9 ++++++--- 5 files changed, 21 insertions(+), 6 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 107f2ff88..a2a78fd9d 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -27,7 +27,7 @@ class ProjectsController < ApplicationController menu_item :feedback, :only => :feedback menu_item :share, :only => :share - before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches,:join_project, :forked_pop] + before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches,:join_project] before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen,:view_homework_attaches,:course] before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches] before_filter :require_admin, :only => [ :copy, :unarchive, :destroy, :calendar] diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c32f6c175..e8cb002a8 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -54,6 +54,18 @@ module ApplicationHelper Project.find(forked_from_project_id) end + # 判断当前用户是否已经fork过当前项目 + # project: current_project + def has_forked_cur_project project + cur_user_projects = Project.where(:user_id => User.current.id) + if cur_user_projects.count == 0 + false + else + has_forked = cur_user_projects.select{|cur_user_project| cur_user_project.forked_from_project_id == project.id} + has_forked.length > 0 ? true : false + end + end + # 通过系统外部邮箱查找用户,如果用户不存在则用邮箱替换 def get_user_by_mail mail user = User.find_by_mail(mail) diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 2a432d42f..4a9601d07 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -78,7 +78,7 @@ class JournalsForMessage < ActiveRecord::Base :act_as_principal_activity, :act_as_student_score after_create :reset_counters! #after_update :update_activity - after_destroy :reset_counters! + # after_destroy :reset_counters! after_save :be_user_score after_destroy :down_user_score, :down_course_score diff --git a/app/views/projects/_applied_status.html.erb b/app/views/projects/_applied_status.html.erb index 17392f2c5..41bb08cbc 100644 --- a/app/views/projects/_applied_status.html.erb +++ b/app/views/projects/_applied_status.html.erb @@ -33,7 +33,7 @@
  • -->
  • - <%= link_to "".html_safe+"Fork", {:controller => 'projects', :action => 'forked_pop'}, + <%= link_to "".html_safe+"Fork", forked_pop_project_path(@project), :class=>"pro_new_topbtn_left fl", :remote => true %> <%= @project.forked_count.to_i %>
  • diff --git a/app/views/repositories/_forked_popbox.html.erb b/app/views/repositories/_forked_popbox.html.erb index bb277e46f..a8c249b3a 100644 --- a/app/views/repositories/_forked_popbox.html.erb +++ b/app/views/repositories/_forked_popbox.html.erb @@ -7,14 +7,17 @@
    • - Fork将在后台执行
      平台将为您创建一个新的同名项目和版本库,请问是否继续? + <% if has_forked_cur_project(@project) %> + 您已经Fork过该项目,点击“确定”将会跳入您Fork的项目主页,请问是否继续? + <% else %> + Fork将在后台执行
      平台将为您创建一个新的同名项目和版本库,请问是否继续? + <% end %>
    • 取  消 - <%= link_to "确 定", {:controller => 'repositories', :action => 'forked'}, - :class=>"sy_btn_blue fl ml20", :onclick=>"hideModal();" %> + <%= link_to "确 定", {:controller => 'repositories', :action => 'forked'}, :class => "sy_btn_blue fl ml20", :onclick => "hideModal();" %>
    From 14178b0f8f06c97cb2d54855887113ab05d61255 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 11 Nov 2016 13:33:06 +0800 Subject: [PATCH 18/40] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E4=B8=AD=E6=88=90=E5=91=98=E5=88=97=E8=A1=A8=E7=94=A8=E6=88=B7?= =?UTF-8?q?url=E4=B8=BAID=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_org_members.html.erb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/views/organizations/_org_members.html.erb b/app/views/organizations/_org_members.html.erb index 343466362..18bbb94bb 100644 --- a/app/views/organizations/_org_members.html.erb +++ b/app/views/organizations/_org_members.html.erb @@ -10,11 +10,9 @@ <% members.each do |member| %>
    - - <%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :width => 32, :height => 32)) %> - + <%= member.user.nil? ? '' : (link_to image_tag(url_to_avatar(member.user), :width => 32, :height => 32), user_path(member.user), :class => "st_img") %> <%= l(:label_username)%> - <%= link_to(member.user.show_name, user_url_in_org(member.user_id),:class => "ml5 c_blue02") %>
    + <%= link_to(member.user.show_name, user_url_in_org(member.user),:class => "ml5 c_blue02") %>
    身份:<%= member.user.admin_of_org?(organization)?"组织管理员":"组织成员" %> <% if member.created_at %> <%= format_time(member.created_at) %> From a44170217ce2bb9c57190e8710b3ed18ec1ce741 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 11 Nov 2016 13:37:50 +0800 Subject: [PATCH 19/40] =?UTF-8?q?=E7=BB=84=E7=BB=87=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=A4=B4=E5=83=8F=E9=93=BE=E6=8E=A5=E4=B8=AD=E5=B8=A6=E7=94=A8?= =?UTF-8?q?=E6=88=B7ID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_show_org_document.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/organizations/_show_org_document.html.erb b/app/views/organizations/_show_org_document.html.erb index 5fa498c63..ca0993709 100644 --- a/app/views/organizations/_show_org_document.html.erb +++ b/app/views/organizations/_show_org_document.html.erb @@ -1,12 +1,12 @@
    - <%= link_to image_tag(url_to_avatar(User.find(document.creator_id)), :width => 45, :heigth => 45), user_url_in_org(document.creator_id) %> + <%= link_to image_tag(url_to_avatar(User.find(document.creator)), :width => 45, :heigth => 45), user_url_in_org(document.creator) %> <%= render :partial => 'users/show_detail_info', :locals => {:user => User.find(document.creator_id)} %>
    - <%= link_to document.creator.show_name, user_url_in_org(document.creator.id), :class => "newsBlue mr15" %> + <%= link_to document.creator.show_name, user_url_in_org(document.creator), :class => "newsBlue mr15" %> TO  <%= link_to document.organization.name, organization_path(document.organization), :class => "newsBlue" %> | <%= document.org_subfield_id.nil? ? "组织文章" :"#{OrgSubfield.find(document.org_subfield_id).name}" %> From ae6821f2521a9dbaf0f4d63d719572d3aa2d350a Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 11 Nov 2016 13:43:11 +0800 Subject: [PATCH 20/40] =?UTF-8?q?=E7=BB=84=E7=BB=87=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=B8=AD=E7=94=A8=E6=88=B7url=E4=B8=BAID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_org_member_list.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/organizations/_org_member_list.html.erb b/app/views/organizations/_org_member_list.html.erb index fd9e50732..12add3d69 100644 --- a/app/views/organizations/_org_member_list.html.erb +++ b/app/views/organizations/_org_member_list.html.erb @@ -1,7 +1,7 @@ <% members.each do |member|%>
      <% username = User.find(member.user_id).realname.blank? ? User.find(member.user_id).login : User.find(member.user_id).realname %> - +
    • <%= get_org_member_role_name member %> <%= form_for(member, {:as => :org_member, :remote => true, :url => Setting.protocol + "://" + Setting.host_name + "/org_member/" + member.id.to_s, From 5742a9951e530fc334f4aae3219f438be23b5bd7 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 11 Nov 2016 13:44:39 +0800 Subject: [PATCH 21/40] =?UTF-8?q?=E9=A1=B9=E7=9B=AE-=E9=85=8D=E7=BD=AE-?= =?UTF-8?q?=E6=88=90=E5=91=98=EF=BC=8C=E7=BF=BB=E9=A1=B5=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E5=BD=93=E5=89=8D=E9=A1=B5=E7=94=A8=E8=93=9D=E8=89=B2=E9=A2=9C?= =?UTF-8?q?=E8=89=B2=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/members_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/members_helper.rb b/app/helpers/members_helper.rb index 58f270332..9dd0bed8c 100644 --- a/app/helpers/members_helper.rb +++ b/app/helpers/members_helper.rb @@ -39,7 +39,7 @@ module MembersHelper end principals = paginateHelper scope,10 s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :class => 'mb5', :id => 'principals') - links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true){|text, parameters, options| + links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true){|text, parameters, options| link_to text, autocomplete_project_memberships_path(project, parameters.merge(:q => params[:q],:flag => true, :format => 'js')), :remote => true } s + content_tag('ul', links,:class => 'wlist', :id => "course_member_pagination_links" ) From 42503fa6c60d733fc8b410e0fdefad8d80ba9f43 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 11 Nov 2016 13:55:38 +0800 Subject: [PATCH 22/40] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=A4=A7=E7=BA=B2?= =?UTF-8?q?=E4=B8=AD=E7=94=A8=E6=88=B7url=E7=9A=84id=E6=94=B9=E6=88=90logi?= =?UTF-8?q?n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_news_contents.html.erb | 2 +- app/views/users/_news_replies.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/users/_news_contents.html.erb b/app/views/users/_news_contents.html.erb index 8b07de887..7897abe83 100644 --- a/app/views/users/_news_contents.html.erb +++ b/app/views/users/_news_contents.html.erb @@ -1,5 +1,5 @@
      - <%= link_to comment.creator_user.show_name, user_url_in_org(comment.creator_user.id), :class => "newsBlue mr10 f14" %> + <%= link_to comment.creator_user.show_name, user_url_in_org(comment.creator_user), :class => "newsBlue mr10 f14" %> <%= time_from_now(comment.respond_to?(:created_on) ? comment.created_on : comment.created_at) %>
      <% if !comment.parent.nil? %> diff --git a/app/views/users/_news_replies.html.erb b/app/views/users/_news_replies.html.erb index 0b5464946..50a2e192b 100644 --- a/app/views/users/_news_replies.html.erb +++ b/app/views/users/_news_replies.html.erb @@ -8,7 +8,7 @@
    • - <%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %> + <%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user) %>
      <%= render :partial => 'users/news_contents', :locals => {:comment => comment}%> From 07b97c8eb988ed620c8adaa460ef9739640865d2 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Nov 2016 13:58:07 +0800 Subject: [PATCH 23/40] =?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? %>
    #<%= issue.id %>

    <%= issue.subject %>

    <%= issue.subject %> <%= issue.tracker %>

    <%= User.find(issue.try(:assigned_to_id)).show_name %>

    " class="new_roadmap_info_name" target="_blank"> + <%= User.find(issue.try(:assigned_to_id)).nil? ? "" : User.find(issue.try(:assigned_to_id)).show_name %> + <%= format_time issue.updated_on %> <%= issue.status.name %> " ><%= issue.done_ratio %>%
    - + - - - - + <% 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 846ef5f72c825ef3a88b74de688dc9d9d946802f Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 11 Nov 2016 14:03:09 +0800 Subject: [PATCH 24/40] =?UTF-8?q?=E5=8D=9A=E5=AE=A2=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E4=B8=AD=E7=94=A8=E6=88=B7id=E6=94=B9=E6=88=90login?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/blogs/_article.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/blogs/_article.html.erb b/app/views/blogs/_article.html.erb index e6136ecfa..8ddc3062d 100644 --- a/app/views/blogs/_article.html.erb +++ b/app/views/blogs/_article.html.erb @@ -21,9 +21,9 @@
    • <% if activity.parent_id.nil? %> - <%= link_to activity.title.to_s.html_safe, user_blog_blog_comment_path(:user_id=>activity.author_id, :blog_id=>activity.blog.id,:id=>activity), :class=> "list-title fl" %> + <%= link_to activity.title.to_s.html_safe, user_blog_blog_comment_path(:user_id=> activity.author, :blog_id=>activity.blog.id,:id=>activity), :class=> "list-title fl" %> <% else %> - <%= link_to activity.title.subject.to_s.html_safe, user_blog_blog_comment_path(:user_id=>activity.author_id, :blog_id=>activity.blog.id,:id=>activity), :class=> "list-title fl"%> + <%= link_to activity.title.subject.to_s.html_safe, user_blog_blog_comment_path(:user_id=>activity.author, :blog_id=>activity.blog.id,:id=>activity), :class=> "list-title fl"%> <% end %> <%# if activity.blog.homepage_id and activity.id == activity.blog.homepage_id %> From 4d1d6506fe1d9b777aab7b0e63d0341e83203ca8 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 11 Nov 2016 14:13:56 +0800 Subject: [PATCH 25/40] =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E5=90=8E=E7=82=B9=E5=B7=A6=E4=BE=A7=E4=B8=AA=E4=BA=BA=E4=B8=BB?= =?UTF-8?q?=E9=A1=B5url=E8=B7=AF=E5=BE=84=E9=97=AE=E9=A2=98=E5=8F=8A?= =?UTF-8?q?=E7=94=A8=E8=AF=BE=E7=A8=8B=E5=8A=A8=E6=80=81=E4=B8=ADurl?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=E6=88=90login?= 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/_course_create.html.erb | 6 +++--- app/views/users/_course_homework.html.erb | 4 ++-- app/views/users/_course_journalsformessage.html.erb | 4 ++-- app/views/users/_course_message.html.erb | 4 ++-- app/views/users/_course_news.html.erb | 4 ++-- app/views/users/_course_poll.html.erb | 6 +++--- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/views/layouts/_user_watch_btn.html.erb b/app/views/layouts/_user_watch_btn.html.erb index da46154ee..0e0ae1e1f 100644 --- a/app/views/layouts/_user_watch_btn.html.erb +++ b/app/views/layouts/_user_watch_btn.html.erb @@ -2,7 +2,7 @@ <% if User.current.logged?%> <% if User.current == target%>
    • <%= link_to("个人资料", my_account_path, :class => "user_editinfo") %>
    • -
    • <%= link_to '个人主页', homepage_user_path(@user.login), :class => "user_editinfo", :target => '_blank' %>
    • +
    • <%= link_to '个人主页', homepage_user_path(@user), :class => "user_editinfo", :target => '_blank' %>
    • <% else%>
    • diff --git a/app/views/users/_course_create.html.erb b/app/views/users/_course_create.html.erb index 7cddd09a7..908929ff0 100644 --- a/app/views/users/_course_create.html.erb +++ b/app/views/users/_course_create.html.erb @@ -1,15 +1,15 @@
      - <%= link_to image_tag(url_to_avatar(activity.teacher), :width => "50", :height => "50"), user_path(activity.tea_id), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(activity.teacher), :width => "50", :height => "50"), user_path(activity.teacher), :alt => "用户头像" %> <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.teacher} %>
      <% if activity.try(:teacher).try(:realname) == ' ' %> - <%= link_to activity.try(:teacher), user_path(activity.tea_id), :class => "newsBlue mr15" %> + <%= link_to activity.try(:teacher), user_path(activity.teacher), :class => "newsBlue mr15" %> <% else %> - <%= link_to activity.try(:teacher).try(:realname), user_path(activity.tea_id), :class => "newsBlue mr15" %> + <%= link_to activity.try(:teacher).try(:realname), user_path(activity.teacher), :class => "newsBlue mr15" %> <% end %> TO <%=link_to activity.syllabus.title, syllabus_path(activity.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %> diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index f234a383a..7a5dd54f2 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -2,12 +2,12 @@
      - <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user), :alt => "用户头像" %> <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %>
      - <%= link_to activity.user.show_name, user_path(activity.user_id,:host=>Setting.host_user), :class => "newsBlue mr15" %> + <%= link_to activity.user.show_name, user_path(activity.user,:host=>Setting.host_user), :class => "newsBlue mr15" %> TO <%=link_to activity.course.syllabus.title, syllabus_path(activity.course.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %> diff --git a/app/views/users/_course_journalsformessage.html.erb b/app/views/users/_course_journalsformessage.html.erb index c4bdedb11..805e4d654 100644 --- a/app/views/users/_course_journalsformessage.html.erb +++ b/app/views/users/_course_journalsformessage.html.erb @@ -1,12 +1,12 @@
      - <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user), :alt => "用户头像" %> <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %>
      - <%= link_to activity.user.show_name, user_path(activity.user_id), :class => "newsBlue mr15" %> + <%= link_to activity.user.show_name, user_path(activity.user), :class => "newsBlue mr15" %> TO <% course=Course.find(activity.jour_id) %> <%=link_to course.syllabus.title, syllabus_path(course.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %> diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index e92d7afcf..9b0d5ac32 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -1,12 +1,12 @@
      - <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id,:host=>Setting.host_user), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author, :host => Setting.host_user), :alt => "用户头像" %> <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
      - <%= link_to activity.author.show_name, user_path(activity.author_id, :host=>Setting.host_user), :class => "newsBlue mr15" %> + <%= link_to activity.author.show_name, user_path(activity.author, :host=>Setting.host_user), :class => "newsBlue mr15" %> TO <%=link_to activity.course.syllabus.title, syllabus_path(activity.course.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %> diff --git a/app/views/users/_course_news.html.erb b/app/views/users/_course_news.html.erb index b3bd6438a..a252a45da 100644 --- a/app/views/users/_course_news.html.erb +++ b/app/views/users/_course_news.html.erb @@ -1,12 +1,12 @@
      - <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author), :alt => "用户头像" %> <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
      - <%= link_to activity.author.show_name, user_path(activity.author_id), :class => "newsBlue mr15" %> + <%= link_to activity.author.show_name, user_path(activity.author), :class => "newsBlue mr15" %> TO <%=link_to activity.course.syllabus.title, syllabus_path(activity.course.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %> diff --git a/app/views/users/_course_poll.html.erb b/app/views/users/_course_poll.html.erb index ca8b49cd3..94b22488c 100644 --- a/app/views/users/_course_poll.html.erb +++ b/app/views/users/_course_poll.html.erb @@ -5,15 +5,15 @@
      - <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user), :alt => "用户头像" %> <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %>
      <% if activity.try(:user).try(:realname) == ' ' %> - <%= link_to activity.try(:user), user_path(activity.user_id), :class => "newsBlue mr15" %> + <%= link_to activity.try(:user), user_path(activity.user), :class => "newsBlue mr15" %> <% else %> - <%= link_to activity.try(:user).try(:realname), user_path(activity.user_id), :class => "newsBlue mr15" %> + <%= link_to activity.try(:user).try(:realname), user_path(activity.user), :class => "newsBlue mr15" %> <% end %> TO <% course = Course.find(activity.polls_group_id) %> From 50a14ad5fe70e4d6216dc833b7cf2bbace0add1b Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 11 Nov 2016 14:26:58 +0800 Subject: [PATCH 26/40] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E6=95=B4=E6=95=B0=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/user.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 8f7939bb3..96f0c5c3b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -322,8 +322,9 @@ class User < Principal end # id 转换成 登录名 + # 如果是整数就去ID,否则就取login def to_param - self.login.to_i > 0 ? id : login + self.login.to_i.to_s == self.login ? id : login end From 629770a7030b19a698d7d86078c3007d32e83428 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 11 Nov 2016 14:50:49 +0800 Subject: [PATCH 27/40] =?UTF-8?q?Issue=E6=8C=87=E6=B4=BE=E7=BB=99=E4=B8=BA?= =?UTF-8?q?0=E7=9A=84=E6=97=B6=E5=80=99=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/migrate/20161111064007_update_assgin_to_id.rb | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 db/migrate/20161111064007_update_assgin_to_id.rb diff --git a/db/migrate/20161111064007_update_assgin_to_id.rb b/db/migrate/20161111064007_update_assgin_to_id.rb new file mode 100644 index 000000000..1dceec312 --- /dev/null +++ b/db/migrate/20161111064007_update_assgin_to_id.rb @@ -0,0 +1,8 @@ +class UpdateAssginToId < ActiveRecord::Migration + def up + Issue.find_by_sql("update `issues` set assigned_to_id = null where assigned_to_id = 0;") + end + + def down + end +end From 1fdf6e20532487a64ce3b1a762a4a575b9d3f8e3 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 11 Nov 2016 14:55:19 +0800 Subject: [PATCH 28/40] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E4=B8=AD=E4=B8=80=E4=BA=9B=E7=94=A8=E6=88=B7=E7=9A=84url?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=99=BB=E5=BD=95=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_project_issue.html.erb | 6 +++--- app/views/users/_project_message.html.erb | 4 ++-- app/views/users/_user_blog.html.erb | 8 ++++---- app/views/users/_user_journalsformessage.html.erb | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index 8a860723e..e2cf4540c 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -2,15 +2,15 @@
      - <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author), :alt => "用户头像" %> <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
      <% if activity.try(:author).try(:realname) == ' ' %> - <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> + <%= link_to activity.try(:author), user_path(activity.author), :class => "newsBlue mr15" %> <% else %> - <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> + <%= link_to activity.try(:author).try(:realname), user_path(activity.author), :class => "newsBlue mr15" %> <% end %> TO <%= link_to activity.project.name.to_s+" | 项目问题", project_issues_path(activity.project), :class => "newsBlue ml15"%>
      diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb index e3e16605e..e57de6b6f 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -1,12 +1,12 @@
      - <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author), :alt => "用户头像" %> <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
      - <%= link_to activity.author.show_name, user_path(activity.author_id), :class => "newsBlue mr15" %> + <%= link_to activity.author.show_name, user_path(activity.author), :class => "newsBlue mr15" %> TO <%= link_to activity.project.name.to_s+" | 项目讨论区",project_boards_path(activity.project), :class => "newsBlue ml15 mr5"%> diff --git a/app/views/users/_user_blog.html.erb b/app/views/users/_user_blog.html.erb index d2eb57b83..5b11d5436 100644 --- a/app/views/users/_user_blog.html.erb +++ b/app/views/users/_user_blog.html.erb @@ -1,18 +1,18 @@
      - <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author), :alt => "用户头像" %> <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
      - <%= link_to activity.author.show_name, user_path(activity.author_id), :class => "newsBlue mr15" %> + <%= link_to activity.author.show_name, user_path(activity.author), :class => "newsBlue mr15" %> TO - <%= link_to activity.author.name.to_s+" | 博客", user_blogs_path(:user_id=>activity.author_id), :class => "newsBlue ml15" %> + <%= link_to activity.author.name.to_s+" | 博客", user_blogs_path(:user_id=>activity.author), :class => "newsBlue ml15" %>
      - <%= link_to activity.title.to_s, user_blog_blog_comment_path(:user_id=>activity.author_id,:blog_id=>activity.blog_id,:id=>activity.id,:in_act => true), :class => "postGrey" %> + <%= link_to activity.title.to_s, user_blog_blog_comment_path(:user_id => activity.author_id,:blog_id=>activity.blog_id,:id=>activity.id,:in_act => true), :class => "postGrey" %> <% if activity.locked%>       <% end%> diff --git a/app/views/users/_user_journalsformessage.html.erb b/app/views/users/_user_journalsformessage.html.erb index 67fbbf494..a84ec8218 100644 --- a/app/views/users/_user_journalsformessage.html.erb +++ b/app/views/users/_user_journalsformessage.html.erb @@ -1,12 +1,12 @@
      - <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user), :alt => "用户头像" %> <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %>
      - <%= link_to activity.user.show_name, user_path(activity.user_id), :class => "newsBlue mr15" %> + <%= link_to activity.user.show_name, user_path(activity.user), :class => "newsBlue mr15" %> TO <% if activity.jour %> <%= link_to activity.jour.show_name+"("+(activity.jour.login ? activity.jour.login : activity.jour.show_name ).to_s+")的"+ (activity.private == 1? "私信":"留言"), From d1bfdde26138e68a3d74ae1e290e91d07566cc86 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Nov 2016 15:19:22 +0800 Subject: [PATCH 29/40] =?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;'%>

    • - 已加入 + 已加入 <%= Member.where(:project_id => @project.id).count %>
    • <%#= link_to "#{Member.where(:project_id => @project.id).count}", project_member_path(@project), :class => 'pro_new_topbtn fl', :title => "项目成员" %> diff --git a/app/views/projects/member_forked.html.erb b/app/views/projects/member_forked.html.erb index 45f783f69..488952057 100644 --- a/app/views/projects/member_forked.html.erb +++ b/app/views/projects/member_forked.html.erb @@ -1,3 +1,17 @@ -<% @members_forked.each do |id| %> - <% %> -<% end %> \ No newline at end of file +
      +

      成员本页面展示Fork了 <%= link_to @project.owner.try(:show_name), user_path(@project.owner) %>/<%= link_to @project.name, project_path(@project) %> 的用户

      +
        + <% @forked_projects.each do |project| %> +
      • + <%= link_to image_tag(url_to_avatar(project.owner), :width => "50", :height => "50"), user_path(project.owner), :alt => "用户头像", :class => "pro_new_users fl mr5" %> +
        + <%= link_to project.owner.try(:show_name), user_path(project.owner), :class => "pro_new_users mt5 fl" %> + / + <%= link_to project.name, project_path(project), :class => "pro_new_users mt5 fl" %> +
        + <%=h time_tag(project.created_on) %>前 +
        +
      • + <% end %> +
      +
      diff --git a/db/schema.rb b/db/schema.rb index 3bf495cd9..7a00237f6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20161028053000) do +ActiveRecord::Schema.define(:version => 20161111064007) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -325,14 +325,16 @@ ActiveRecord::Schema.define(:version => 20161028053000) do add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids" create_table "changesets", :force => true do |t| - t.integer "repository_id", :null => false - t.string "revision", :null => false + t.integer "repository_id", :null => false + t.string "revision", :null => false t.string "committer" - t.datetime "committed_on", :null => false + t.datetime "committed_on", :null => false t.text "comments" t.date "commit_date" t.string "scmid" t.integer "user_id" + t.integer "project_id" + t.integer "type", :default => 0 end add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on" @@ -993,6 +995,10 @@ ActiveRecord::Schema.define(:version => 20161028053000) do t.datetime "updated_at", :null => false end + create_table "innodb_monitor", :id => false, :force => true do |t| + t.integer "a" + end + create_table "invite_lists", :force => true do |t| t.integer "project_id" t.integer "user_id" diff --git a/public/stylesheets/css/project.css b/public/stylesheets/css/project.css index e82d524c7..c400ea7c3 100644 --- a/public/stylesheets/css/project.css +++ b/public/stylesheets/css/project.css @@ -1029,4 +1029,13 @@ textarea.muban_textarea{ width: 98.5%;border:1px solid #ddd; background:#fff; co /* 课程大纲 */ .icons_tishi{ width: 110px; height: 110px;margin: 135px auto 20px;} -.sy_tab_con_p{ font-size: 16px;text-align: center; margin-bottom:100px; color:#888;} \ No newline at end of file +.sy_tab_con_p{ font-size: 16px;text-align: center; margin-bottom:100px; color:#888;} +/* 成员列表20161101byLB*/ +.pro_new_font{ font-weight: normal; color: #666; font-size: 12px;} +.pro_new_users_box{ margin:0 10px;} +.pro_new_users_box li{ width:25%; float: left; margin:10px 0;} +.pro_new_users{ } +a.pro_new_users { max-width:80px; overflow:hidden;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; word-break:break-all; display: inline-block; font-weight: bold; color: #666;} +a:hover.pro_new_users {color: #3b94d6} +.pro_new_users img{ width:40px;height:40px; border: 3px solid #fff;-webkit-border-radius:50px;-moz-border-radius:50px;-o-border-radius:50px;border-radius:50px;} +.pro_new_users img:hover{border: 3px solid #e6e6e6;} \ No newline at end of file From 92531ce487e9cd20a645b9ed04122c47f59c320a Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 11 Nov 2016 16:35:26 +0800 Subject: [PATCH 34/40] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=AE=80=E4=BB=8B?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/show.html.erb | 2 +- public/stylesheets/css/project.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index 8fc960e3b..b32ec6a3a 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -1,5 +1,5 @@ -
      +
      <%= render :partial => 'projects/invite_code' %>
      <% if @project.description.blank? %>

      <%= @project.name %>

      diff --git a/public/stylesheets/css/project.css b/public/stylesheets/css/project.css index e82d524c7..e04e57e3e 100644 --- a/public/stylesheets/css/project.css +++ b/public/stylesheets/css/project.css @@ -895,7 +895,7 @@ a:hover.btn_newpro_grey,a:active.btn_newpro_grey{ background: #eaeaea;} /*项目简介*/ .pro_new_info{ border:1px solid #ddd; background-color:#fff; width: 998px;} .pro_new_info h2{ background: #fff; font-size: 14px; color: #333; height: 40px; line-height: 40px; padding-left: 15px; border-bottom:1px solid #e5e5e5;} -.pro_new_info p{ padding:5px; color: #666;} +.pro_new_info p{ padding-bottom:2px; padding-left: 5px; color: #666; padding-right: 5px} .pro_new_info_weight{ font-size: 16px; font-weight: bold;} /* 新版项目配置*/ .pro_new_setting_leftnav{ width: 162px; border:1px solid #ddd; background-color:#fff; padding:3px; padding-bottom: 0;} From f41a36557ab83cb81e21e3848d69d15a5858ee82 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 11 Nov 2016 16:45:43 +0800 Subject: [PATCH 35/40] =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E8=8B=B1=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/versions/index.html.erb | 2 +- app/views/versions/new.js.erb | 5 +++-- app/views/versions/show.html.erb | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/views/versions/index.html.erb b/app/views/versions/index.html.erb index 1201ed36e..494fcc916 100644 --- a/app/views/versions/index.html.erb +++ b/app/views/versions/index.html.erb @@ -1,4 +1,4 @@ - +
      diff --git a/app/views/versions/new.js.erb b/app/views/versions/new.js.erb index 437dae2ca..1f6832266 100644 --- a/app/views/versions/new.js.erb +++ b/app/views/versions/new.js.erb @@ -2,5 +2,6 @@ var htmlvalue = "<%= escape_javascript(render :partial => 'versions/new_mileston pop_box_new(htmlvalue,820,316); var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: 0, showOn: 'button', buttonImageOnly: true, buttonImage: '/images/public_icon.png', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true}; $(function() { $('#version_index_create_name').datepicker(datepickerOptions); -// $('#evaluation_end_time').datepicker(datepickerOptions); -}); \ No newline at end of file + $('#version_index_create_name').datepicker(datepickerOptions); +}); + diff --git a/app/views/versions/show.html.erb b/app/views/versions/show.html.erb index 8fd672a14..20544e957 100644 --- a/app/views/versions/show.html.erb +++ b/app/views/versions/show.html.erb @@ -1,3 +1,4 @@ +
      From 16c51e1eaa0b47c0981bbc014966de67219791e3 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Nov 2016 16:50:25 +0800 Subject: [PATCH 36/40] =?UTF-8?q?=E5=9F=BA=E4=BA=8E=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=9A=84=E5=88=86=E7=BB=84=E4=BD=9C=E4=B8=9A=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=A1=B9=E7=9B=AE=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 9 +++--- app/models/course.rb | 1 + app/models/user.rb | 15 +++++++-- .../_evaluation_un_group_work.html.erb | 4 +-- .../student_work/_relate_projects.html.erb | 31 +++++++++++++++++++ app/views/student_work/index.html.erb | 22 +++++++++++-- app/views/users/_homework_opr.html.erb | 4 +-- .../20161111081619_add_course_id_to_swp.rb | 15 +++++++++ public/stylesheets/css/project.css | 8 ----- public/stylesheets/css/public.css | 10 +++++- 10 files changed, 97 insertions(+), 22 deletions(-) create mode 100644 app/views/student_work/_relate_projects.html.erb create mode 100644 db/migrate/20161111081619_add_course_id_to_swp.rb diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 8a5441647..f788efd3f 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -597,14 +597,14 @@ class StudentWorkController < ApplicationController @student_work_project.student_work_id = student_work.id @student_work_project.save elsif @homework.homework_detail_group.base_on_project == 0 - stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => student_work.id, :project_id => student_work.project_id, :user_id => student_work.user_id, :is_leader => 1) + stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => student_work.id, :project_id => student_work.project_id, :user_id => student_work.user_id, :is_leader => 1, :course_id => @homework.course_id) stu_project.save end members = params[:group_member_ids].split(',') for i in 1 .. members.count-1 stu_work = StudentWork.new(:name => student_work.name, :description => student_work.description,:user_id =>members[i].to_i, :homework_common_id => @homework.id,:project_id => student_work.project_id, :late_penalty => student_work.late_penalty,:work_status => 3, :commit_time => student_work.commit_time) if stu_work.save - stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => student_work.id, :project_id => stu_work.project_id == 0 ? -1 : stu_work.project_id, :user_id => members[i].to_i, :is_leader => 0) + stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => student_work.id, :project_id => stu_work.project_id == 0 ? -1 : stu_work.project_id, :user_id => members[i].to_i, :is_leader => 0, :course_id => @homework.course_id) stu_project.save end end @@ -662,7 +662,7 @@ class StudentWorkController < ApplicationController for i in 1 .. members.count-1 stu_work = StudentWork.new(:name => @work.name, :description => @work.description,:user_id=> members[i].to_i, :homework_common_id => @homework.id, :project_id => @work.project_id, :late_penalty => @work.late_penalty,:work_status => 3, :commit_time => @work.commit_time) if stu_work.save - stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => @work.id, :project_id => stu_work.project_id == 0 ? -1 : stu_work.project_id, :user_id => members[i].to_i, :is_leader => 0) + stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => @work.id, :project_id => stu_work.project_id == 0 ? -1 : stu_work.project_id, :user_id => members[i].to_i, :is_leader => 0, :course_id => @homework.course_id) stu_project.save end end @@ -1095,6 +1095,7 @@ class StudentWorkController < ApplicationController @project.project_id = params[:projectName].to_i @project.user_id = User.current.id @project.is_leader = 1 + @project.course_id = @homework.course_id if @project.save @user_activity_id = params[:user_activity_id].to_i @hw_status = params[:hw_status].to_i @@ -1180,7 +1181,7 @@ class StudentWorkController < ApplicationController unless work stu_work = StudentWork.new(:name => student_work.name, :description => student_work.description,:user_id =>params[:member_id][i].to_i, :homework_common_id => @homework.id,:project_id => student_work.project_id, :late_penalty => student_work.late_penalty,:work_status => 3, :commit_time => Time.now) if stu_work.save - stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => student_work.id, :project_id => stu_work.project_id == 0 ? -1 : stu_work.project_id, :user_id => params[:member_id][i].to_i, :is_leader => 0) + stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => student_work.id, :project_id => stu_work.project_id == 0 ? -1 : stu_work.project_id, :user_id => params[:member_id][i].to_i, :is_leader => 0, :course_id => @homework.course_id) stu_project.save end end diff --git a/app/models/course.rb b/app/models/course.rb index 13050ddbe..f974d0e93 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -49,6 +49,7 @@ class Course < ActiveRecord::Base #has_many :course_journals_for_messages, :class_name => 'CourseJournalsForMessage', :as => :jour, :dependent => :destroy has_many :news, :dependent => :destroy, :include => :author has_one :course_status, :class_name => "CourseStatus", :dependent => :destroy + has_many :student_work_projects, :dependent => :destroy has_many :homework_commons, :dependent => :destroy has_many :student_works, :through => :homework_commons, :dependent => :destroy diff --git a/app/models/user.rb b/app/models/user.rb index c226e2a52..0ea0eaf15 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -965,8 +965,12 @@ class User < Principal #是否具有老师角色 def has_teacher_role(course) member = course.members.where("user_id = #{self.id}").first - role = MemberRole.where("member_id = #{member.id} and role_id in (3, 7, 9)") - !role.blank? + if !member.nil? + role = MemberRole.where("member_id = #{member.id} and role_id in (3, 7, 9)") + !role.blank? + else + return false + end end #是否具有学生角色 @@ -991,6 +995,13 @@ class User < Principal # Admin users are authorized for anything else return true if admin? + course_ids = context.student_work_projects.blank? ? "(-1)" : "(" + context.student_work_projects.map{|swp| swp.course_id}.join(",") + ")" + courses = Course.where("id in #{course_ids}") + courses.each do |course| + if self.has_teacher_role(course) + return true + end + end roles = roles_for_project(context) return false unless roles roles.any? {|role| diff --git a/app/views/student_work/_evaluation_un_group_work.html.erb b/app/views/student_work/_evaluation_un_group_work.html.erb index a3f8b7f3b..99b0bb827 100644 --- a/app/views/student_work/_evaluation_un_group_work.html.erb +++ b/app/views/student_work/_evaluation_un_group_work.html.erb @@ -13,10 +13,8 @@
      关联项目:
      - <% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %> + <% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? || User.current.allowed_to?(:as_teacher, @homework.course) %> <%= link_to student_work.project.name, project_path(student_work.project.id), :class => 'link-blue fl hidden', :style => "max-width:550px;", :title => "项目名称", :target => "_blank" %> - <% elsif User.current.allowed_to?(:as_teacher, @homework.course) %> - <%= link_to student_work.project.name, applied_join_project_path(:object_id => student_work.project.id, :is_teacher => 1), :remote => true, :method => "post", :class => 'link-blue fl hidden', :style => "max-width:550px;", :title => "项目名称" %> <% else %> <% end %> diff --git a/app/views/student_work/_relate_projects.html.erb b/app/views/student_work/_relate_projects.html.erb new file mode 100644 index 000000000..8b977b47a --- /dev/null +++ b/app/views/student_work/_relate_projects.html.erb @@ -0,0 +1,31 @@ +
      + <% projects.each do |project|%> + <% allow_visit = project.is_public || User.current.member_of?(project) || User.current.admin? || User.current.allowed_to?(:as_teacher, @homework.course) %> +
      +
      +

      + <% if allow_visit %> + <%= link_to "#{project.name}", project_path(project.id,:host=>Setting.host_name), :target => '_blank', :class => "new_project_title fl",:id => "show_project_#{project.id}", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%> + <% else %> + <%=project.name %> + <% end %> +

      + <%= project.is_public? ? '公开' : '私有' %> + <% projectUser = User.where("id=?",project.user_id).first %> + <%=link_to "创建者:#{projectUser.try(:realname) != " " ? projectUser.lastname + projectUser.firstname : projectUser.try(:login)}".html_safe, user_path(projectUser) %> +
      +
      +
      +

      更新时间:<%= format_date(project.updated_on) %>

      +
      +

      + <%= link_to project.members.count, allow_visit ? member_project_path(project) : 'javascript:void(0)', :class => "c_blue" %>成员  | + <%= link_to project.project_score.issue_num, allow_visit ? project_issues_path(project) : 'javascript:void(0)', :class => "c_blue" %>问题  | + <%= link_to project.project_score.attach_num, allow_visit ? file_project_path(project) : 'javascript:void(0)', :class => "c_blue" %>资源 +

      +
      +
      +
      +
      + <% end %> +
      \ No newline at end of file diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index ab69f0c4b..8750a35a7 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -4,6 +4,7 @@ <%= stylesheet_link_tag "/assets/codemirror/codemirror" %> <%= import_ke(enable_at: true, prettify: false, init_activity: true) %> <% end %> +<% is_group_project_homework = @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
    序号序号 姓名 <%= 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 %> + +