diff --git a/app/controllers/syllabuses_controller.rb b/app/controllers/syllabuses_controller.rb index cad65f88d..13bacbd4b 100644 --- a/app/controllers/syllabuses_controller.rb +++ b/app/controllers/syllabuses_controller.rb @@ -92,7 +92,7 @@ class SyllabusesController < ApplicationController def destroy if @syllabus && @syllabus.courses.not_deleted.empty? @syllabus.destroy - redirect_to user_courselist_user_path(User.current.id) + redirect_to user_courselist_user_path(User.current) end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 1a8c7f7f0..04a3df24a 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -3476,7 +3476,7 @@ class UsersController < ApplicationController #归档班级列表 def user_archive_courses if User.current.logged? - @order, @c_sort, @type, @list_type = params[:order] || 1, params[:sort] || 1, params[:type] || 1, params[:list_type] || 1 + @order, @c_sort, @type = params[:order] || 1, params[:sort] || 1, params[:type] || 1 #确定 sort_type if @order.to_i == @type.to_i @@ -3485,6 +3485,7 @@ class UsersController < ApplicationController @c_sort = 2 end + @user = User.current sort_name = "updated_at" archive_ids = Course.where("tea_id = #{@user.id} and is_delete = 1").blank? ? "(-1)" : "(" + Course.where("tea_id = #{@user.id} and is_delete = 1").map{|course| course.syllabus_id}.join(",") + ")" @archive_syllabuses = Syllabus.where("id in #{archive_ids}") @@ -3503,13 +3504,14 @@ class UsersController < ApplicationController end syllabus[:infocount] = count end - @c_sort == 1 ? (@archive_syllabuses = @syllabuses.sort{|x,y| x[:infocount] <=> y[:infocount] }) : (@archive_syllabuses = @archive_syllabuses.sort{|x,y| y[:infocount] <=> x[:infocount]}) + @c_sort == 1 ? (@archive_syllabuses = @archive_syllabuses.sort{|x,y| x[:infocount] <=> y[:infocount] }) : (@archive_syllabuses = @archive_syllabuses.sort{|x,y| y[:infocount] <=> x[:infocount]}) @archive_syllabuses = sortby_time_countcommon_nosticky @archive_syllabuses,sort_name else @type = 1 end respond_to do |format| - format.html + format.js + format.html {render :layout => 'new_base_user'} end end end @@ -3518,7 +3520,11 @@ class UsersController < ApplicationController def expand_courses @syllabus = Syllabus.where("id = #{params[:syllabus_id]}").first unless @syllabus.nil? - @courses = @syllabus.courses.not_deleted.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc") + if params[:is_delete] && params[:is_delete] == '1' + @courses = @syllabus.courses.where("is_delete = 1").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc") + else + @courses = @syllabus.courses.not_deleted.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc") + end respond_to do |format| format.js end diff --git a/app/views/courses/archive_course.js.erb b/app/views/courses/archive_course.js.erb index c7cd0f729..a5ef39035 100644 --- a/app/views/courses/archive_course.js.erb +++ b/app/views/courses/archive_course.js.erb @@ -13,7 +13,11 @@ function click_OK(){ hideModal(); <% if params[:source] == "1" %> window.location.href = "<%=syllabus_courselist_syllabus_path(@syllabus, :list_type => params[:type].to_i) %>"; - <% else params[:source] == "0" %> - window.location.href = "<%=user_courselist_path(User.current) %>"; + <% elsif params[:source] == "0" %> + <% if params[:type] == "0" %> + window.location.href = "<%=user_courselist_user_path(User.current) %>"; + <% else %> + window.location.href = "<%=user_archive_courses_users_path() %>"; + <% end %> <% end %> } \ No newline at end of file diff --git a/app/views/layouts/base_users_new.html.erb b/app/views/layouts/base_users_new.html.erb index 2f3ef2928..316d10c4c 100644 --- a/app/views/layouts/base_users_new.html.erb +++ b/app/views/layouts/base_users_new.html.erb @@ -140,25 +140,25 @@