公共资源库添加资源多个发送功能,修复项目、课程多个发送的bug
This commit is contained in:
parent
457cf72263
commit
0a7d1f1efc
|
@ -2105,7 +2105,8 @@ class UsersController < ApplicationController
|
|||
project_ids.each do |project_id|
|
||||
next if ori.blank?
|
||||
@exist = false
|
||||
Project.find(project_id).attachments.each do |att| #如果课程中包含该资源
|
||||
# 如果对象中包含该资源
|
||||
Project.find(project_id).attachments.each do |att|
|
||||
if att.id == ori.id || (!att.copy_from.nil? && !ori.copy_from.nil? && att.copy_from == ori.copy_from) || att.copy_from == ori.id || att.id == ori.copy_from
|
||||
att.created_on = Time.now
|
||||
att.save
|
||||
|
@ -3126,6 +3127,7 @@ class UsersController < ApplicationController
|
|||
@orgs = @user.organizations.select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0}
|
||||
end
|
||||
end
|
||||
@type = params[:type]
|
||||
@search = params[:search]
|
||||
#这里仅仅是传递需要发送的资源id
|
||||
@send_id = params[:send_id]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%= form_tag add_exist_file_to_org_user_path(user, :type => defined?(type) ? type : "6" ),:remote=>true,:id=>'orgs_list_form' do %>
|
||||
<%= form_tag add_exist_file_to_org_user_path(user, :type => @type ),:remote=>true,:id=>'orgs_list_form' do %>
|
||||
<%= hidden_field_tag(:send_id, send_id) %>
|
||||
<%= hidden_field_tag(:send_ids, send_ids) %>
|
||||
<div class="sectionWrap fl mr15">
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%= form_tag add_exist_file_to_project_user_path(user, :type => defined?(type) ? type : "6" ), :remote => true, :id => 'projects_list_form' %>
|
||||
<%= form_tag add_exist_file_to_project_user_path(user, :type => @type ), :remote => true, :id => 'projects_list_form' %>
|
||||
<div>
|
||||
<%= hidden_field_tag(:send_id, send_id) %>
|
||||
<%= hidden_field_tag(:send_ids, send_ids) %>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<option value="3" selected>组织</option>
|
||||
</select>
|
||||
</div>
|
||||
<%= form_tag search_user_org_user_path(user),:method => 'get',
|
||||
<%= form_tag search_user_org_user_path(user, :type => @type),:method => 'get',
|
||||
:remote=>true,:id=>'search_user_org_form' do %>
|
||||
<%= hidden_field_tag(:send_id, send_id) %>
|
||||
<%= hidden_field_tag(:send_ids, send_ids) %>
|
||||
|
@ -19,5 +19,5 @@
|
|||
<div class="cl"></div>
|
||||
</div>
|
||||
<div id="org_file_form">
|
||||
<%= render :partial => 'users/org_file_form', :locals => {:user => user, :orgs => @orgs, :send_id => send_id, :send_ids => send_ids, :type => type} %>
|
||||
<%= render :partial => 'users/org_file_form', :locals => {:user => user, :orgs => @orgs, :send_id => send_id, :send_ids => send_ids, :type => @type} %>
|
||||
</div>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
</div>
|
||||
<!--<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose" onclick="closeModal();"></a></div>-->
|
||||
<div class="fl">
|
||||
<%= form_tag search_user_project_user_path(user),:method => 'get',
|
||||
<%= form_tag search_user_project_user_path(user, :type => @type),:method => 'get',
|
||||
:remote=>true,:id=>'search_user_project_form',:class=>'resourcesSearchBox' do %>
|
||||
<%= hidden_field_tag(:send_id, send_id) %>
|
||||
<%= hidden_field_tag(:send_ids, send_ids) %>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<div>
|
||||
<div class="sendText fl mr10" style="width: auto">发送到</div>
|
||||
<div class="resourcesSendTo">
|
||||
<select class="resourcesSendType" onclick="chooseSendType('<%= send_id%>','<%= send_ids%>','<%= User.current.id %>','file');">
|
||||
<select class="resourcesSendType" onclick="chooseSendType2('<%= send_id %>','<%= send_ids%>','<%= User.current.id %>','file', '<%= @type %>');">
|
||||
<option value="1">课程</option>
|
||||
<option value="2">项目</option>
|
||||
<option value="3">组织</option>
|
||||
|
@ -14,8 +14,7 @@
|
|||
</div>
|
||||
<!--<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose" onclick="closeModal();"></a></div>-->
|
||||
<div class="fl">
|
||||
<%= form_tag search_user_course_user_path(user),:method => 'get',
|
||||
:remote=>true,:id=>'search_user_course_form',:class=>'resourcesSearchBox' do %>
|
||||
<%= form_tag search_user_course_user_path(user),:method => 'get', :remote=>true, :id=> 'search_user_course_form', :class=> 'resourcesSearchBox' do %>
|
||||
<%= hidden_field_tag(:send_id, send_id) %>
|
||||
<%= hidden_field_tag(:send_ids, send_ids) %>
|
||||
<input type="text" id="search_course_input" value="<%= @search %>" name="search" placeholder="输入课程ID或者名称搜索" class="searchResourcePopup" />
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<div class="cl"></div>
|
||||
<form id="resources_list_form">
|
||||
<div id="resources_list">
|
||||
<%= render :partial => 'users/resources_list' , :locals => { :attachments => @attachments} %>
|
||||
<%= render :partial => 'users/resources_list' , :locals => { :attachments => @attachments, :type => @type} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
<% if params[:is_observe].nil? %>
|
||||
<% if params[:send_type].present? && params[:send_type] == 'news' %>
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_project', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>');
|
||||
|
|
|
@ -1178,6 +1178,36 @@ function chooseSendType(res_id,res_ids, user_id, send_type){
|
|||
lastSendType = sendType;
|
||||
}
|
||||
|
||||
|
||||
function chooseSendType2(res_id,res_ids, user_id, send_type, type){
|
||||
console.log(res_ids);
|
||||
sendType = $(".resourcesSendType").val();
|
||||
if (sendType === lastSendType) {
|
||||
return;
|
||||
} else if(lastSendType != null) { //不是第一次点击的时候
|
||||
if (sendType == '1') {
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '/users/' + user_id + '/search_user_course' + '?' + "&type=" + type,
|
||||
data:{send_id:res_id, send_ids:res_ids ,send_type:send_type}
|
||||
});
|
||||
} else if(sendType == '2') {
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '/users/' + user_id + '/search_user_project' + '?' + "&type=" + type,
|
||||
data:{send_id:res_id, send_ids:res_ids, send_type:send_type}
|
||||
});
|
||||
}else if(sendType == '3'){
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '/users/' + user_id + '/search_user_org' + '?' + "&type=" + type,
|
||||
data:{send_id:res_id, send_ids:res_ids, send_type:send_type}
|
||||
});
|
||||
}
|
||||
}
|
||||
lastSendType = sendType;
|
||||
}
|
||||
|
||||
//组织新建和配置中,选择组织为私有后,disbled掉允许游客下载选项
|
||||
function disable_down(source, des, hint){
|
||||
if (source.attr("checked")){
|
||||
|
|
Loading…
Reference in New Issue