From f229d18776be27caed0cdda006bd0797fce718c6 Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Mon, 9 Nov 2015 10:03:06 +0800
Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E8=AF=BE=E7=A8=8B=20=E9=A1=B9?=
=?UTF-8?q?=E7=9B=AE=20=E4=B8=8A=E4=BC=A0=E8=B5=84=E6=BA=90=E5=90=8E?=
=?UTF-8?q?=E8=B7=B3=E8=BD=AC=E5=88=B0=E5=AF=B9=E5=BA=94=E7=9A=84=E8=B5=84?=
=?UTF-8?q?=E6=BA=90=E5=BA=93=E7=95=8C=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/files_controller.rb | 6 +++
app/views/files/_upload_course_files.erb | 2 +-
app/views/files/_upload_show_project.html.erb | 1 +
app/views/files/create.js.erb | 45 +++++++++++--------
4 files changed, 35 insertions(+), 19 deletions(-)
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 @@
课件
|
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);