diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 1cd5b0f15..dd8dc84c4 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -332,6 +332,9 @@ class FilesController < ApplicationController #modify by nwb if @project @addTag=false + if params[:in_project_toolbar] + @in_project_toolbar = params[:in_project_toolbar] + end container = (params[:version_id].blank? ? @project : @project.versions.find_by_id(params[:version_id])) attachments = Attachment.attach_filesex(container, params[:attachments], params[:attachment_type]) render_attachment_warning_if_needed(container) @@ -363,6 +366,9 @@ class FilesController < ApplicationController end elsif @course @addTag=false + if params[:in_course_toolbar] + @in_course_toolbar = params[:in_course_toolbar] + end attachments = Attachment.attach_filesex(@course, params[:attachments], params[:attachment_type]) if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added') diff --git a/app/views/files/_upload_course_files.erb b/app/views/files/_upload_course_files.erb index 62d5c68e4..3578d4eb9 100644 --- a/app/views/files/_upload_course_files.erb +++ b/app/views/files/_upload_course_files.erb @@ -7,7 +7,7 @@ <%= form_tag(course_files_path(course), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %> - +
课件 |  diff --git a/app/views/files/_upload_show_project.html.erb b/app/views/files/_upload_show_project.html.erb index 8223f071e..53c57b3c6 100644 --- a/app/views/files/_upload_show_project.html.erb +++ b/app/views/files/_upload_show_project.html.erb @@ -8,6 +8,7 @@ <%= form_tag(project_files_path(project), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %> + <%= render :partial => 'files/attachement_list',:locals => {:project => project} %>
<%= l(:button_cancel)%> diff --git a/app/views/files/create.js.erb b/app/views/files/create.js.erb index f24d60811..9de7aa042 100644 --- a/app/views/files/create.js.erb +++ b/app/views/files/create.js.erb @@ -23,26 +23,35 @@ $("#upload_file_count").text("未上传文件"); $('#upload_file_div').slideToggle('slow'); <% if @project %> hideModal(); - $("#resource_list").html('<%= j(render partial: "project_file_new" ,locals: {project: @project}) %>'); - $("#project_files_count_info").html("<%= @all_attachments.count%>"); - $("#project_files_count_nav").html("(<%= @all_attachments.count%>)") -// 添加文件上传成功提示 - <% unless params[:attachments].nil? %> - var div = $('
文件上传成功!
'); - $("#course_list").prepend(div); - setTimeout( function(){div.remove();},3000) + <%if @in_project_toolbar%> + window.location.href = '<%= project_files_path(@project)%>' + <%else%> + + $("#resource_list").html('<%= j(render partial: "project_file_new" ,locals: {project: @project}) %>'); + $("#project_files_count_info").html("<%= @all_attachments.count%>"); + $("#project_files_count_nav").html("(<%= @all_attachments.count%>)") + // 添加文件上传成功提示 + <% unless params[:attachments].nil? %> + var div = $('
文件上传成功!
'); + $("#course_list").prepend(div); + setTimeout( function(){div.remove();},3000) + <% end %> <% end %> <%elsif @course%> - closeModal(); - $("#resource_list").html('<%= j(render partial: "course_file" ,locals: {course: @course}) %>'); - $("#courses_files_count_info").html("<%= @all_attachments.count%>"); - $("#courses_files_count_nav").html("(<%= @all_attachments.count%>)") - // 添加文件上传成功提示, - <% unless params[:attachments].nil? %> - var div = $('
文件上传成功!
'); - $("#course_list").prepend(div); - setTimeout( function(){div.remove();},3000) - <% end %> + hideModal(); + <%if @in_course_toolbar %> + window.location.href='<%= course_files_path(@course)%>' + <%else%> + $("#resource_list").html('<%= j(render partial: "course_file" ,locals: {course: @course}) %>'); + $("#courses_files_count_info").html("<%= @all_attachments.count%>"); + $("#courses_files_count_nav").html("(<%= @all_attachments.count%>)") + // 添加文件上传成功提示, + <% unless params[:attachments].nil? %> + var div = $('
文件上传成功!
'); + $("#course_list").prepend(div); + setTimeout( function(){div.remove();},3000) + <% end %> + <%end%> <% end %> <% end %> $(document).ready(img_thumbnails);