在课程 项目 上传资源后跳转到对应的资源库界面

This commit is contained in:
lizanle 2015-11-09 10:03:06 +08:00
parent 3cc9fbe693
commit f229d18776
4 changed files with 35 additions and 19 deletions

View File

@ -332,6 +332,9 @@ class FilesController < ApplicationController
#modify by nwb #modify by nwb
if @project if @project
@addTag=false @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])) container = (params[:version_id].blank? ? @project : @project.versions.find_by_id(params[:version_id]))
attachments = Attachment.attach_filesex(container, params[:attachments], params[:attachment_type]) attachments = Attachment.attach_filesex(container, params[:attachments], params[:attachment_type])
render_attachment_warning_if_needed(container) render_attachment_warning_if_needed(container)
@ -363,6 +366,9 @@ class FilesController < ApplicationController
end end
elsif @course elsif @course
@addTag=false @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]) attachments = Attachment.attach_filesex(@course, params[:attachments], params[:attachment_type])
if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added') if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')

View File

@ -7,7 +7,7 @@
<div id="network_issue" style="color: red; display: none;"><%= l(:label_file_upload_error_messages)%></div> <div id="network_issue" style="color: red; display: none;"><%= l(:label_file_upload_error_messages)%></div>
<%= form_tag(course_files_path(course), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %> <%= form_tag(course_files_path(course), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
<input type="hidden" name="course_attachment_type" value="<%= course_attachment_type%>"> <input type="hidden" name="in_course_toolbar" value="Y">
<!--<p class="c_grey fr mt10 mr5">--> <!--<p class="c_grey fr mt10 mr5">-->
<div class="c_dark"> <div class="c_dark">
<input name="course_attachment_type" type="radio" value="1" checked class="c_dark" >课件</input>&nbsp;<span class="c_grey">|</span>&nbsp; <input name="course_attachment_type" type="radio" value="1" checked class="c_dark" >课件</input>&nbsp;<span class="c_grey">|</span>&nbsp;

View File

@ -8,6 +8,7 @@
<%= form_tag(project_files_path(project), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %> <%= form_tag(project_files_path(project), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
<!-- <label style="margin-top:3px;"><#%= l(:label_file_upload)%></label> --> <!-- <label style="margin-top:3px;"><#%= l(:label_file_upload)%></label> -->
<input type="hidden" name="in_project_toolbar" value="Y">
<%= render :partial => 'files/attachement_list',:locals => {:project => project} %> <%= render :partial => 'files/attachement_list',:locals => {:project => project} %>
<div class="cl"></div> <div class="cl"></div>
<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="hideModal();"><%= l(:button_cancel)%></a> <a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="hideModal();"><%= l(:button_cancel)%></a>

View File

@ -23,26 +23,35 @@ $("#upload_file_count").text("未上传文件");
$('#upload_file_div').slideToggle('slow'); $('#upload_file_div').slideToggle('slow');
<% if @project %> <% if @project %>
hideModal(); hideModal();
$("#resource_list").html('<%= j(render partial: "project_file_new" ,locals: {project: @project}) %>'); <%if @in_project_toolbar%>
$("#project_files_count_info").html("<%= @all_attachments.count%>"); window.location.href = '<%= project_files_path(@project)%>'
$("#project_files_count_nav").html("(<%= @all_attachments.count%>)") <%else%>
// 添加文件上传成功提示
<% unless params[:attachments].nil? %> $("#resource_list").html('<%= j(render partial: "project_file_new" ,locals: {project: @project}) %>');
var div = $('<div id="addBox" class="flash notice">文件上传成功!</div>'); $("#project_files_count_info").html("<%= @all_attachments.count%>");
$("#course_list").prepend(div); $("#project_files_count_nav").html("(<%= @all_attachments.count%>)")
setTimeout( function(){div.remove();},3000) // 添加文件上传成功提示
<% unless params[:attachments].nil? %>
var div = $('<div id="addBox" class="flash notice">文件上传成功!</div>');
$("#course_list").prepend(div);
setTimeout( function(){div.remove();},3000)
<% end %>
<% end %> <% end %>
<%elsif @course%> <%elsif @course%>
closeModal(); hideModal();
$("#resource_list").html('<%= j(render partial: "course_file" ,locals: {course: @course}) %>'); <%if @in_course_toolbar %>
$("#courses_files_count_info").html("<%= @all_attachments.count%>"); window.location.href='<%= course_files_path(@course)%>'
$("#courses_files_count_nav").html("(<%= @all_attachments.count%>)") <%else%>
// 添加文件上传成功提示, $("#resource_list").html('<%= j(render partial: "course_file" ,locals: {course: @course}) %>');
<% unless params[:attachments].nil? %> $("#courses_files_count_info").html("<%= @all_attachments.count%>");
var div = $('<div id="addBox" class="flash notice">文件上传成功!</div>'); $("#courses_files_count_nav").html("(<%= @all_attachments.count%>)")
$("#course_list").prepend(div); // 添加文件上传成功提示,
setTimeout( function(){div.remove();},3000) <% unless params[:attachments].nil? %>
<% end %> var div = $('<div id="addBox" class="flash notice">文件上传成功!</div>');
$("#course_list").prepend(div);
setTimeout( function(){div.remove();},3000)
<% end %>
<%end%>
<% end %> <% end %>
<% end %> <% end %>
$(document).ready(img_thumbnails); $(document).ready(img_thumbnails);