From 0a881f14e81e7ff356465f6128abafb494f724c7 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 16 Mar 2016 17:06:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E6=B7=BB=E5=8A=A0=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 10 ++++-- .../users/_import_resource_info.html.erb | 34 ++++++------------- .../users/_user_import_resource_list.html.erb | 19 +++++++++++ .../_user_import_resource_search.html.erb | 29 ++++++++++++++++ .../users/import_resources_search.js.erb | 28 ++------------- 5 files changed, 69 insertions(+), 51 deletions(-) create mode 100644 app/views/users/_user_import_resource_list.html.erb create mode 100644 app/views/users/_user_import_resource_search.html.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 7ba756806..cf591d6a8 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2544,7 +2544,11 @@ class UsersController < ApplicationController end def import_resources_search - search = "%#{params[:search].strip.downcase}%" + @order, @b_sort = params[:order] || "created_on", params[:sort] || "asc" + @score = @b_sort == "desc" ? "asc" : "desc" + @user = User.current + @switch_search = params[:name].nil? ? " " : params[:name] + search = "%#{@switch_search.strip.downcase}%" # 别人的资源库是没有权限去看的 if User.current.id.to_i != params[:id].to_i render_403 @@ -2567,10 +2571,10 @@ class UsersController < ApplicationController @atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1 @offset ||= @atta_pages.offset #@curse_attachments_all = @all_attachments[@offset, @limit] - @attachments = paginateHelper @attachments,10 + @attachments = paginateHelper @attachments, 10 respond_to do |format| format.js - format.html {render :layout => 'new_base'} + # format.html {render :layout => 'new_base'} end end diff --git a/app/views/users/_import_resource_info.html.erb b/app/views/users/_import_resource_info.html.erb index bc1152ce4..4ea56ad9f 100644 --- a/app/views/users/_import_resource_info.html.erb +++ b/app/views/users/_import_resource_info.html.erb @@ -26,11 +26,14 @@ 公共资源 我的资源 <% end %> - <%#= form_tag( url_for(:controller => 'users', :action => 'import_resources_search', :id => User.current.id, :type => 1), - :remote => true , :method => 'get', :id => 'resource_search_form') do %> + + - <%#= hidden_field_tag(:type,type.nil? ? 1 : type) %> - <%# end %> + + +
@@ -42,25 +45,10 @@
  • 上传者
  • 上传时间
  • - <%= form_tag( url_for({:controller => 'users', :action => 'import_into_container', - :mul_id => params[:project_id].nil? ? (params[:course_id].nil? ? params[:subfield_file_id] : params[:course_id]) : params[:project_id], - :mul_type => params[:project_id].nil? ? (params[:course_id].nil? ? "SubfieldFile" : "Course") : "Project"}), - :method => 'post', :id => 'resource_import_container_form') do %> - <% @attachments.each do |attach| %> - - <% end %> - <% end %> +
    + <%= render :partial => 'users/user_import_resource_list',:locals => {:project_id => params[:project_id], :subfield_file_id => params[:subfield_file_id], :course_id => params[:course_id]} %> +
    +
    选用
    diff --git a/app/views/users/_user_import_resource_list.html.erb b/app/views/users/_user_import_resource_list.html.erb new file mode 100644 index 000000000..57dac6ad0 --- /dev/null +++ b/app/views/users/_user_import_resource_list.html.erb @@ -0,0 +1,19 @@ +<%= 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"}), + :method => 'post', :id => 'resource_import_container_form') do %> + <% @attachments.each do |attach| %> + + <% end %> +<% end %> \ No newline at end of file diff --git a/app/views/users/_user_import_resource_search.html.erb b/app/views/users/_user_import_resource_search.html.erb new file mode 100644 index 000000000..b048675dd --- /dev/null +++ b/app/views/users/_user_import_resource_search.html.erb @@ -0,0 +1,29 @@ + + \ No newline at end of file diff --git a/app/views/users/import_resources_search.js.erb b/app/views/users/import_resources_search.js.erb index 549cf6329..ea527ab6b 100644 --- a/app/views/users/import_resources_search.js.erb +++ b/app/views/users/import_resources_search.js.erb @@ -1,25 +1,3 @@ -//$("#resources_list").html('<%#= escape_javascript( render :partial => 'users/import_resource_info' ,:locals=>{ :attachments => @attachments, :type => @type})%>'); -//$("#pages").html('<%#= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>'); -//$("#res_all_count").html(<%#= @atta_count%>); -//$("#res_count").html(0); -//$("#checkboxAll").attr('checked',false); - - -<% if params[:project_id] %> -$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => 1, :project_id => params[:project_id]} ) %>'); -<% elsif params[:course_id] %> -$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => 1, :course_id => params[:course_id]} ) %>'); -<% elsif params[:subfield_file_id] %> -$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => 1, :subfield_file_id => params[:subfield_file_id]} ) %>'); -<% end %> -showModal('ajax-modal', '615px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before(""); -<% if params[:project_id] %> -$('#ajax-modal').parent().css("top","10%").css("left","34%").css("border","3px solid #269ac9"); -<% else %> -$('#ajax-modal').parent().css("top","20%").css("left","42%").css("border","3px solid #269ac9"); -<% end %> -$('#ajax-modal').parent().addClass("popbox_polls"); - - +$("#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]} ) %>'); +$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');