+
+
+ <%= select( :project, :project_id, options_for_issue_project_list(@issues_filter),
+ { :include_blank => false,:selected => @project_id ? @project_id : 0 },
+ { :onchange => "remote_function();add_style();",:id => "proeject_id", :name => "project_id",:class => "fl mr10"}
+ )%>
发布人
@@ -243,14 +246,14 @@
排序
-
+
<% end %>
<% if @issues.empty? %>
<%= l(:label_no_data) %>
<% else %>
- <%#= render :partial => 'users/all_issue_list', :locals => {:issues => @issues, :issue_pages => @issue_pages,:issue_count => @issue_count, :subject => @subject } %>
+ <%= render :partial => 'users/all_issue_list', :locals => {:issues => @issues, :issue_pages => @issue_pages,:issue_count => @issue_count, :subject => @subject } %>
<% end %>
diff --git a/app/views/users/user_issues.js.erb b/app/views/users/user_issues.js.erb
index 97b9f760d..0c7f67ac1 100644
--- a/app/views/users/user_issues.js.erb
+++ b/app/views/users/user_issues.js.erb
@@ -1,3 +1,3 @@
-/*$("#issue_filter_all").html("<%#= escape_javascript(render :partial => 'issues/issue_filter_all') %>");*/
+$("#issue_filter_all").html("<%= escape_javascript(render :partial => 'users/my_issue_filter_all') %>");
$("#issue_list").html("<%= escape_javascript(render :partial => 'users/all_issue_list',:locals => {:issues => @issues, :issue_pages=> @issue_pages, :issue_count => @issue_count })%>");
$("#issue_list_pagination").html('<%= pagination_links_full @issue_pages, @issue_count, :issues => @issues, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>');
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 48fc637b8..df7bdb3b1 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -638,7 +638,7 @@ RedmineApp::Application.routes.draw do
get 'edit_brief_introduction'
get "user_resource"
- get "user_issues", :to => 'users#user_issues', :via => :get, :as => "user_issues"
+ match "user_issues", :to => 'users#user_issues', :via => [:get, :post], :as => "user_issues"
get "import_resources"
get "import_resources_search"
post "import_into_container"
diff --git a/public/stylesheets/css/common.css b/public/stylesheets/css/common.css
index 973f7a7b9..4ca947af4 100644
--- a/public/stylesheets/css/common.css
+++ b/public/stylesheets/css/common.css
@@ -718,9 +718,9 @@ input.issues_calendar_input{ padding-left:5px; color:#444; border-right:none;}
a.issues_list_title{ color:#444; max-width:260px; overflow:hidden; text-overflow:ellipsis; -o-text-overflow:ellipsis; white-space:nowrap; }
a:hover.issues_list_title{color:#3b94d6;}
.issues_list_titlebox span{ font-size: 12px;color: #888; font-weight: normal; }
-.issues_ciricons_01{ width: 22px; height: 22px; display: inline-block; background: url("../images/project/icons_issue.png") 0 0 no-repeat;}
-.issues_ciricons_02{ width: 22px; height: 22px; display: inline-block; background: url("../images/project/icons_issue.png") 0 -30px no-repeat;}
-.issues_icons_mes{width: 17px; height: 17px; display: inline-block; background: url("../images/project/icons_issue.png") 0 -57px no-repeat; }
+.issues_ciricons_01{ width: 22px; height: 22px; display: inline-block; background: url("/images/new_project/icons_issue.png") 0 0 no-repeat;}
+.issues_ciricons_02{ width: 22px; height: 22px; display: inline-block; background: url("/images/new_project/icons_issue.png") 0 -30px no-repeat;}
+.issues_icons_mes{width: 17px; height: 17px; display: inline-block; background: url("/images/new_project/icons_issue.png") 0 -57px no-repeat; }
.issues_list_name{ font-size: 12px;}
.issues_list_name:hover{ color: #3b94d6;}
.issues_list_small{ font-size: 12px; color: #666;}
From efd0bf6707f32084b555c186f614ab2974ab0bc7 Mon Sep 17 00:00:00 2001
From: cxt
Date: Thu, 17 Nov 2016 10:23:13 +0800
Subject: [PATCH 20/52] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=AD=A6=E7=94=9F/?=
=?UTF-8?q?=E9=80=80=E5=87=BA=E7=8F=AD=E7=BA=A7=E6=97=B6=E9=9A=90=E8=97=8F?=
=?UTF-8?q?=E5=AD=A6=E7=94=9F=E4=BD=9C=E5=93=81=E3=80=81=E9=80=80=E5=87=BA?=
=?UTF-8?q?=E7=8F=AD=E7=BA=A7=E6=8C=89=E9=92=AE=E4=BD=8D=E7=BD=AE=E8=B0=83?=
=?UTF-8?q?=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/courses_controller.rb | 4 +++-
app/models/homework_common.rb | 2 +-
app/models/students_for_course.rb | 12 +++++++++++-
app/services/courses_service.rb | 14 +++++++++++---
app/views/courses/_set_join.js.erb | 1 +
app/views/layouts/_course_base_info.html.erb | 14 +++++++++++++-
app/views/layouts/base_courses.html.erb | 7 +++++++
...0161117015856_add_is_delete_to_student_works.rb | 5 +++++
db/schema.rb | 3 ++-
public/stylesheets/css/common.css | 1 +
10 files changed, 55 insertions(+), 8 deletions(-)
create mode 100644 db/migrate/20161117015856_add_is_delete_to_student_works.rb
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index 0bb027153..e3d7c9d06 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -561,6 +561,7 @@ class CoursesController < ApplicationController
def delete_member
member = @course.members.find params[:member_id]
student_role = member.member_roles.where("role_id = 10").first
+ teacher_role = member.member_roles.where("role_id = 7 || role_id = 9").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
@@ -569,8 +570,9 @@ class CoursesController < ApplicationController
joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,@course.id)
joined.destroy_all
- if member.member_roles.count > 1
+ if member.member_roles.count > 1&& student_role && teacher_role
student_role.destroy
+ teacher_role.update_attribute("is_current", 1)
member.update_attribute("course_group_id", 0)
else
member.destroy
diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb
index c87cd3d42..3690df1f3 100644
--- a/app/models/homework_common.rb
+++ b/app/models/homework_common.rb
@@ -15,7 +15,7 @@ class HomeworkCommon < ActiveRecord::Base
has_one :homework_detail_group, :dependent => :destroy
has_many :student_work_projects, :dependent => :destroy
has_many :homework_tests, :dependent => :destroy
- has_many :student_works, :dependent => :destroy, :conditions => "is_test=0"
+ has_many :student_works, :dependent => :destroy, :conditions => "is_test=0 and is_delete != 1"
has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
has_many :apply_homeworks, :dependent => :destroy
diff --git a/app/models/students_for_course.rb b/app/models/students_for_course.rb
index 767d65b10..d9bf96770 100644
--- a/app/models/students_for_course.rb
+++ b/app/models/students_for_course.rb
@@ -9,11 +9,21 @@ class StudentsForCourse < ActiveRecord::Base
validates_uniqueness_of :student_id, :scope => :course_id
after_destroy :delete_student_works
+ after_create :recovery_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
+ student_works.update_all(:is_delete => 1)
+ end
+
+ #加入班级时还原作品
+ def recovery_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.update_all(:is_delete => 0)
end
end
diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb
index f72623d84..43bdf9e09 100644
--- a/app/services/courses_service.rb
+++ b/app/services/courses_service.rb
@@ -452,12 +452,20 @@ class CoursesService
@state = 2
return @state
end
- @member = Member.where('course_id = ? and user_id = ?', params[:object_id], user.id)
- if @member.nil? || @member.count == 0
+ @member = Member.where('course_id = ? and user_id = ?', params[:object_id], user.id).first
+ if @member.nil?
@state = 1
return @state
end
- @member.first.destroy
+ student_role = @member.member_roles.where("role_id = 10").first
+ teacher_role = @member.member_roles.where("role_id = 7 || role_id = 9").first
+ if @member.member_roles.count > 1 && student_role && teacher_role
+ student_role.destroy
+ teacher_role.update_attribute("is_current", 1)
+ @member.update_attribute("course_group_id", 0)
+ else
+ @member.destroy
+ end
joined = StudentsForCourse.where('student_id = ? and course_id = ?', user.id, params[:object_id])
joined.each do |join|
join.destroy
diff --git a/app/views/courses/_set_join.js.erb b/app/views/courses/_set_join.js.erb
index 822757dfe..7c395e54e 100644
--- a/app/views/courses/_set_join.js.erb
+++ b/app/views/courses/_set_join.js.erb
@@ -1,3 +1,4 @@
+hideModal();
<% if object_id && @state != 6%>
$("#join_in_course_header").html("<%= escape_javascript(join_in_course_header(course, user)) %>");
<% end %>
diff --git a/app/views/layouts/_course_base_info.html.erb b/app/views/layouts/_course_base_info.html.erb
index e3041f92c..3b1c70fe8 100644
--- a/app/views/layouts/_course_base_info.html.erb
+++ b/app/views/layouts/_course_base_info.html.erb
@@ -26,6 +26,18 @@
+<% elsif User.current.logged? && User.current.member_of_course?(@course) %>
+