From a35abf1f1f7257949a6d562357ba17673fcbfa27 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Wed, 20 May 2015 11:56:34 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug#2180:=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E8=B5=84=E6=BA=90=E5=BA=93=EF=BC=9A=E6=88=90=E5=8A=9F?= =?UTF-8?q?=E5=BC=95=E5=85=A5=E8=B5=84=E6=BA=90=E5=90=8E=EF=BC=8C=E2=80=9C?= =?UTF-8?q?=E9=80=89=E4=BA=BA=E6=88=91=E7=9A=84=E8=AF=BE=E7=A8=8B=E2=80=9D?= =?UTF-8?q?=E6=9C=AA=E8=87=AA=E5=8A=A8=E5=88=B7=E6=96=B0=E4=B8=BA=E2=80=9C?= =?UTF-8?q?=E9=80=89=E5=85=A5=E6=88=91=E7=9A=84=E5=85=B6=E4=BB=96=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 9 +- .../add_exist_file_to_courses.js.erb | 1 + app/views/files/_course_file.html.erb | 11 +++ app/views/files/_course_list.html.erb | 82 +++++++++---------- app/views/files/searchone4reload.html.erb | 39 +++++++++ config/routes.rb | 1 + 6 files changed, 101 insertions(+), 42 deletions(-) create mode 100644 app/views/files/searchone4reload.html.erb diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 69e7105aa..aa2c9574b 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -23,7 +23,7 @@ class FilesController < ApplicationController before_filter :auth_login1, :only => [:index] before_filter :logged_user_by_apptoken,:only => [:index] before_filter :find_project_by_project_id#, :except => [:getattachtype] - before_filter :authorize, :except => [:getattachtype,:quote_resource_show,:search,:search_project,:quote_resource_show_project,:search_tag_attachment] + before_filter :authorize, :except => [:getattachtype,:quote_resource_show,:search,:searchone4reload,:search_project,:quote_resource_show_project,:search_tag_attachment] helper :sort include SortHelper @@ -46,6 +46,13 @@ class FilesController < ApplicationController @obj_attachments = paginateHelper @all_attachments,10 end + def searchone4reload + attachment = Attachment.find_by_id(params[:fileid]); + respond_to do |format| + format.html{render :layout => nil,:locals=>{:file=>attachment,:course=>@course}} + end + end + def search sort = "" @sort = "" diff --git a/app/views/attachments/add_exist_file_to_courses.js.erb b/app/views/attachments/add_exist_file_to_courses.js.erb index eec1e255a..c84a89184 100644 --- a/app/views/attachments/add_exist_file_to_courses.js.erb +++ b/app/views/attachments/add_exist_file_to_courses.js.erb @@ -4,4 +4,5 @@ $("#error_show").html("<%= @message.html_safe %>"); <% else %> closeModal(); + searchone4reload('<%=params[:file_id]%>'); <% end %> diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb index 1769b1a45..ebccfcaf4 100644 --- a/app/views/files/_course_file.html.erb +++ b/app/views/files/_course_file.html.erb @@ -1,4 +1,15 @@ @@ -21,7 +21,7 @@ -
+