From 4e30c42a6090ea226f6c68a820fc0f599e554a47 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 15 Sep 2017 22:59:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E7=BB=93=E6=9E=9C=E5=BC=B9?= =?UTF-8?q?=E6=A1=86=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 2 +- .../settings/_import_students_result.html.erb | 12 ++++++++++++ app/views/courses/sync_students.js.erb | 6 +++++- 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 app/views/courses/settings/_import_students_result.html.erb diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 28b395fc2..739288379 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -108,9 +108,9 @@ class CoursesController < ApplicationController school_id = User.find(@course.tea_id).try(:user_extensions).try(:school_id) @import_attachments = Attachment.where(:container_id => @course.id, :container_type => "ImportStudent") @had_import_count = 0 + @list_count = 0 if @import_attachments.present? @import_attachments.each do |attachment| - @list_count = 0 path = attachment.disk_directory name = attachment.disk_filename if name.split(".").last == "xls" || name.split(".").last == "xlsx" diff --git a/app/views/courses/settings/_import_students_result.html.erb b/app/views/courses/settings/_import_students_result.html.erb new file mode 100644 index 000000000..6dbbc7330 --- /dev/null +++ b/app/views/courses/settings/_import_students_result.html.erb @@ -0,0 +1,12 @@ + +
+
+

上传文件

+ +
+
+
+ 本次新加入<%= @had_import_count %>个学生,还有<%= @list_count - @had_import_count %>个学生没有加入 +
+
+
diff --git a/app/views/courses/sync_students.js.erb b/app/views/courses/sync_students.js.erb index c49456425..c4dea436f 100644 --- a/app/views/courses/sync_students.js.erb +++ b/app/views/courses/sync_students.js.erb @@ -1,2 +1,6 @@ $("#setting_teacher_list").hide(); -$("#setting_student_list").html("<%= j(render :partial => 'courses/settings/all_student_list') %>").show(); \ No newline at end of file +$("#setting_student_list").html("<%= j(render :partial => 'courses/settings/all_student_list') %>").show(); +<% if @had_import_count > 0 %> +var htmlvalue = '<%= escape_javascript(render :partial => 'courses/settings/import_students_result', :locals => {:course => @course}) %>'; +pop_box_new(htmlvalue, 440, 490); +<% end %> \ No newline at end of file