资源导入,搜索条件中导入400问题
This commit is contained in:
parent
bff20ee072
commit
fc6210eada
|
@ -2533,6 +2533,8 @@ class UsersController < ApplicationController
|
|||
render_403
|
||||
return
|
||||
end
|
||||
@resource_id = params[:project_id].nil? ? (params[:course_id].nil? ? params[:subfield_file_id] : params[:course_id]) : params[:project_id]
|
||||
@resource_type = params[:project_id].nil? ? (params[:course_id].nil? ? "SubfieldFile" : "Course") : "Project"
|
||||
@user = User.find(params[:id])
|
||||
@order, @b_sort = params[:order] || "created_on", params[:sort] || "asc"
|
||||
@score = @b_sort == "desc" ? "asc" : "desc"
|
||||
|
@ -2561,6 +2563,8 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def import_resources_search
|
||||
@resource_id = params[:mul_id]
|
||||
@resource_type = params[:mul_type]
|
||||
@order, @b_sort = params[:order] || "created_on", params[:sort] || "asc"
|
||||
@score = @b_sort == "desc" ? "asc" : "desc"
|
||||
@user = User.current
|
||||
|
@ -2571,6 +2575,7 @@ class UsersController < ApplicationController
|
|||
render_403
|
||||
return
|
||||
end
|
||||
@resource_id = params[:mul_id]
|
||||
if(params[:type].blank? || params[:type] == "1") # 我的资源
|
||||
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
|
||||
user_course_ids = User.current.courses.map { |c| c.id}
|
||||
|
|
|
@ -116,7 +116,7 @@
|
|||
<div class="cl"></div>
|
||||
</div>
|
||||
<div id="course_list">
|
||||
<%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %>
|
||||
<%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %>
|
||||
</div>
|
||||
</div>
|
||||
<%# html_title(l(:label_attachment_plural)) -%>
|
|
@ -27,7 +27,7 @@
|
|||
<a href="<%= import_resources_user_path(User.current, :type => '1', :subfield_file_id => params[:subfield_file_id]) %>" id="my_resources_choose" class="subject-choose fl" data-remote="true">我的资源</a>
|
||||
<% end %>
|
||||
<div id="user_import_resource_search">
|
||||
<%=render :partial=>'users/user_import_resource_search', :locals => {:type => @type, :search => ''} %>
|
||||
<%=render :partial=>'users/user_import_resource_search', :locals => {:type => @type, :search => '', :mul_id => @resource_id, :mul_type => @resource_type} %>
|
||||
</div>
|
||||
<!--<%#= form_tag( url_for(:controller => 'users', :action => 'import_resources_search', :id => User.current.id), :remote => true , :method => 'get', :id => 'resource_search_form') do %>-->
|
||||
<!--<input type="text" name="search" placeholder="输入资源关键词进行搜索" class="subjectSearch fr" />-->
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<%= form_tag( url_for({:controller => 'users', :action => 'import_into_container',
|
||||
:mul_id => project_id.nil? ? (course_id.nil? ? subfield_file_id : course_id) : project_id,
|
||||
:mul_type => project_id.nil? ? (course_id.nil? ? "SubfieldFile" : "Course") : "Project"}),
|
||||
:mul_id => @resource_id,
|
||||
:mul_type => @resource_type}),
|
||||
:method => 'post', :id => 'resource_import_container_form') do %>
|
||||
<% @attachments.each do |attach| %>
|
||||
<ul class="subjectRow">
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
}
|
||||
lastSearchCondition = $(e.target).val().trim();
|
||||
$.ajax({
|
||||
url: '<%= url_for(:controller => 'users', :action => 'import_resources_search', :id => User.current.id) %>'+'?name='+ e.target.value+'&type=<%=type %>',
|
||||
url: '<%= url_for({:controller => 'users', :action => 'import_resources_search', :id => User.current.id}) %>'+'?name='+ e.target.value+'&type=<%=type %>'+'&mul_id=<%=@resource_id %>'+'&mul_type=<%=@resource_type %>',
|
||||
type:'get'
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<% if params[:project_id] %>
|
||||
$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => @type, :project_id => params[:project_id]} ) %>');
|
||||
$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => @type, :project_id => params[:project_id], :mul_id => @resource_id, :mul_type => @resource_type}) %>');
|
||||
<% elsif params[:course_id] %>
|
||||
$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => @type, :course_id => params[:course_id]} ) %>');
|
||||
$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => @type, :course_id => params[:course_id], :mul_id => @resource_id, :mul_type => @resource_type}) %>');
|
||||
<% elsif params[:subfield_file_id] %>
|
||||
$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => @type, :subfield_file_id => params[:subfield_file_id]} ) %>');
|
||||
$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => @type, :subfield_file_id => params[:subfield_file_id], :mul_id => @resource_id, :mul_type => @resource_type}) %>');
|
||||
<% end %>
|
||||
showModal('ajax-modal', '615px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
$("#import_resource_info_list").html('<%= escape_javascript( render :partial => 'user_import_resource_list',
|
||||
:locals => {:user => @user, :type => @type, :project_id => params[:project_id], :subfield_file_id => params[:subfield_file_id], :course_id => params[:course_id]} ) %>');
|
||||
:locals => {:user => @user, :type => @type,
|
||||
:mul_id => @resource_id,
|
||||
:mul_type => @resource_type}) %>');
|
||||
$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
|
||||
|
|
Loading…
Reference in New Issue