From 395fb8fae6227ad12f50c15bf994a35a1e427c67 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Mon, 28 Mar 2016 22:37:01 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9pagination,=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E5=8C=BAbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 2 + app/views/users/_resources_list.html.erb | 343 ------------------ app/views/users/_user_resource_info.html.erb | 350 ++++++++++++++++++- app/views/users/user_resource_create.js.erb | 29 +- lib/redmine/pagination.rb | 8 +- 5 files changed, 372 insertions(+), 360 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index f885c5c1c..1cf4534bb 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1618,8 +1618,10 @@ class UsersController < ApplicationController @attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score) end end + @status = params[:status] @type = params[:type] + @path = user_resource_user_path(User.current, :type => @type) @limit = 25 @is_remote = true @atta_count = @attachments.count diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb index a545038f1..69b512653 100644 --- a/app/views/users/_resources_list.html.erb +++ b/app/views/users/_resources_list.html.erb @@ -27,348 +27,5 @@ <% end %> diff --git a/app/views/users/_user_resource_info.html.erb b/app/views/users/_user_resource_info.html.erb index bea78130a..0a3f94bb3 100644 --- a/app/views/users/_user_resource_info.html.erb +++ b/app/views/users/_user_resource_info.html.erb @@ -42,7 +42,353 @@
  • 预览
  • 重命名
  • -
  • 发送
  • +
  • 发送
  • 删除
  • - \ No newline at end of file + + + \ No newline at end of file diff --git a/app/views/users/user_resource_create.js.erb b/app/views/users/user_resource_create.js.erb index e818f2870..cc7e543c8 100644 --- a/app/views/users/user_resource_create.js.erb +++ b/app/views/users/user_resource_create.js.erb @@ -1,15 +1,16 @@ -closeModal(); -$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>'); -$("#resource_tip_list").html('<%= escape_javascript( render :partial => 'users/user_resource_tip_list', :locals => {:user => @user, :type => @type, :status => @status}) %>'); -$("#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); -//更新状态 -$("#public_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '6') %>'); -$("#my_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '1') %>'); -$("#resource_type_all").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 1, :search => @switch_search) %>'); -$("#resource_type_course").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 2, :search => @switch_search) %>'); -$("#resource_type_project").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 3, :search => @switch_search) %>'); -$("#resource_type_user").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 5, :search => @switch_search) %>'); +closeModal(); +$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>'); +$("#resource_tip_list").html('<%= escape_javascript( render :partial => 'users/user_resource_tip_list', :locals => {:user => @user, :type => @type, :status => @status}) %>'); +debugger +$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true, :path => @path %>'); +$("#res_all_count").html(<%= @atta_count%>); +$("#res_count").html(0); +$("#checkboxAll").attr('checked',false); +//更新状态 +$("#public_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '6') %>'); +$("#my_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '1') %>'); +$("#resource_type_all").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 1, :search => @switch_search) %>'); +$("#resource_type_course").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 2, :search => @switch_search) %>'); +$("#resource_type_project").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 3, :search => @switch_search) %>'); +$("#resource_type_user").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 5, :search => @switch_search) %>'); $("#resource_type_file").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 4, :search => @switch_search) %>'); \ No newline at end of file diff --git a/lib/redmine/pagination.rb b/lib/redmine/pagination.rb index 41702e2ce..4f1e8ac46 100644 --- a/lib/redmine/pagination.rb +++ b/lib/redmine/pagination.rb @@ -163,11 +163,17 @@ module Redmine # :per_page_links if set to false, the "Per page" links are not rendered # def pagination_links_full(*args) + page = "" pagination_links_each(*args) do |text, parameters, options| if block_given? yield text, parameters, options else - link_to text, params.merge(parameters), options + if args[2][:path].nil? + link_to text, params.merge(parameters), options + else + page = "&page" + parameters[:page].to_s unless parameters[:page].nil? + link_to text, args[2][:path].to_s + page, options + end end end end From 90fd52970bff03449fcf179cfde7d77afeff85c3 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Tue, 29 Mar 2016 10:15:18 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix=20bugger=20on=20=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 7 + .../users/_resource_share_for_orgs.html.erb | 2 +- ..._resource_share_for_project_popup.html.erb | 108 ++++++------ .../users/_resource_share_popup.html.erb | 112 ++++++------ app/views/users/_resources_list.html.erb | 164 ++++++++++++++++++ app/views/users/_user_resource_info.html.erb | 163 ----------------- .../users/add_exist_file_to_course.js.erb | 1 + app/views/users/add_exist_file_to_org.js.erb | 1 + .../users/add_exist_file_to_project.js.erb | 1 + app/views/users/search_user_course.js.erb | 2 +- app/views/users/search_user_org.js.erb | 28 +-- app/views/users/search_user_project.js.erb | 32 ++-- app/views/users/user_resource_create.js.erb | 1 - app/views/users/user_resource_delete.js.erb | 26 +-- 14 files changed, 329 insertions(+), 319 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 1cf4534bb..efe968d3b 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1679,6 +1679,7 @@ class UsersController < ApplicationController end @status = params[:status] @type = params[:type] + @path = user_resource_user_path(User.current, :type => @type) @limit = 25 @is_remote = true @atta_count = @attachments.count @@ -1703,6 +1704,7 @@ class UsersController < ApplicationController .select { |course| @user.allowed_to?(:as_teacher,course) and course.is_delete == 0 } end @search = params[:search] + @type = params[:type] #这里仅仅是传递需要发送的资源id @send_id = params[:send_id] @send_ids = params[:checkbox1] || params[:send_ids] @@ -1721,6 +1723,7 @@ class UsersController < ApplicationController @projects = @user.projects.visible end @search = params[:search] + @type = params[:type] #这里仅仅是传递需要发送的资源id @send_id = params[:send_id] @send_ids = params[:checkbox1] || params[:send_ids] #搜索的时候 和 直接 用表格提交的时候的send_ids @@ -1822,6 +1825,7 @@ class UsersController < ApplicationController "or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc") @type = params[:type] @limit = 25 + @path = user_resource_user_path(User.current, :type => @type) @user = User.current @is_remote = true @atta_count = @attachments.count @@ -1933,6 +1937,7 @@ class UsersController < ApplicationController "or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc") @type = params[:type] @limit = 25 + @path = user_resource_user_path(User.current, :type => @type) @user = User.current @is_remote = true @atta_count = @attachments.count @@ -2031,6 +2036,7 @@ class UsersController < ApplicationController "or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc") @type = params[:type] @limit = 25 + @path = user_resource_user_path(User.current, :type => @type) @user = User.current @is_remote = true @atta_count = @attachments.count @@ -2723,6 +2729,7 @@ class UsersController < ApplicationController name = "%"+name+"%" @orgs = User.current.organizations.where("name like ?", name) @user = User.current + @type = params[:type] respond_to do |format| format.html {render :layout => 'static_base'} format.js diff --git a/app/views/users/_resource_share_for_orgs.html.erb b/app/views/users/_resource_share_for_orgs.html.erb index 792db7546..166d0f82b 100644 --- a/app/views/users/_resource_share_for_orgs.html.erb +++ b/app/views/users/_resource_share_for_orgs.html.erb @@ -18,7 +18,7 @@ <% end %>
    -<%= form_tag add_exist_file_to_org_user_path(user),: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) %>
    diff --git a/app/views/users/_resource_share_for_project_popup.html.erb b/app/views/users/_resource_share_for_project_popup.html.erb index 33fa03061..aa42b22cc 100644 --- a/app/views/users/_resource_share_for_project_popup.html.erb +++ b/app/views/users/_resource_share_for_project_popup.html.erb @@ -1,54 +1,54 @@ -
    -
    -
    发送到
    -
    - -
    -
    -
    - -
    - <%= form_tag search_user_project_user_path(user),: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) %> - - - - <%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %> - <% end %> -
    - <%= form_tag add_exist_file_to_project_user_path(user), :remote => true, :id=>'projects_list_form' %> -
    - - <%= hidden_field_tag(:send_id, send_id) %> - <%= hidden_field_tag(:send_ids, send_ids) %> -
    - <% if !projects.empty? %> - <% projects.each do |project| %> -
      -
    • - -
    • -
    • <%= project.name%>
    • -
    - <% end %> -
    -
    -
    -
    - - <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %> -
    - -
    -
    - <% end %> -
    - +
    +
    +
    发送到
    +
    + +
    +
    +
    + +
    + <%= form_tag search_user_project_user_path(user),: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) %> + + + + <%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %> + <% end %> +
    + <%= form_tag add_exist_file_to_project_user_path(user, :type => type), :remote => true, :id=>'projects_list_form' %> +
    + + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> +
    + <% if !projects.empty? %> + <% projects.each do |project| %> +
      +
    • + +
    • +
    • <%= project.name%>
    • +
    + <% end %> +
    +
    +
    +
    + + <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %> +
    + +
    +
    + <% end %> +
    + diff --git a/app/views/users/_resource_share_popup.html.erb b/app/views/users/_resource_share_popup.html.erb index 74265cabb..ba0eeb21e 100644 --- a/app/views/users/_resource_share_popup.html.erb +++ b/app/views/users/_resource_share_popup.html.erb @@ -1,56 +1,56 @@ - - -
    -
    -
    发送到
    -
    - -
    -
    -
    - -
    - <%= 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) %> - - - - <%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %> - <% end %> -
    - <%= form_tag add_exist_file_to_course_user_path(user),:remote=>true,:id=>'course_list_form' %> -
    - - <%= hidden_field_tag(:send_id, send_id) %> - <%= hidden_field_tag(:send_ids, send_ids) %> -
    - <% if !courses.empty? %> - <% courses.each do |course| %> -
      -
    • - -
    • -
    • <%= truncate(course.name,:lendght=>25) + '['+course.time.to_s+course.term + ']'%>
    • -
    - <% end %> -
    -
    -
    -
    - - <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %> -
    - -
    -
    - <% end %> -
    - + + +
    +
    +
    发送到
    +
    + +
    +
    +
    + +
    + <%= 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) %> + + + + <%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %> + <% end %> +
    + <%= form_tag add_exist_file_to_course_user_path(user, :type => type),:remote=>true,:id=>'course_list_form' %> +
    + + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> +
    + <% if !courses.empty? %> + <% courses.each do |course| %> +
      +
    • + +
    • +
    • <%= truncate(course.name,:lendght=>25) + '['+course.time.to_s+course.term + ']'%>
    • +
    + <% end %> +
    +
    +
    +
    + + <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %> +
    + +
    +
    + <% end %> +
    + diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb index 69b512653..b8551f7c5 100644 --- a/app/views/users/_resources_list.html.erb +++ b/app/views/users/_resources_list.html.erb @@ -28,4 +28,168 @@ diff --git a/app/views/users/_user_resource_info.html.erb b/app/views/users/_user_resource_info.html.erb index 0a3f94bb3..a3bc45481 100644 --- a/app/views/users/_user_resource_info.html.erb +++ b/app/views/users/_user_resource_info.html.erb @@ -207,93 +207,6 @@ $("#res_count").html(0); } } - - function show_upload(){ - $("#ajax-modal").html('<%= escape_javascript( render :partial => 'upload_resource' ,:locals => {:user=>User.current.id,:type=>@type,:status=>@status})%>'); - showModal('ajax-modal', '452px'); - $('#ajax-modal').siblings().remove(); - $('#ajax-modal').before(""); - $('#ajax-modal').parent().css("top","50%").css("left","50%").css("position","absolute"); - $('#ajax-modal').parent().addClass("resourceUploadPopup"); - $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); - } - //批量删除 - function batch_delete(){ - var data = $("#resources_list_form").serialize(); - if($("input[type=checkbox][data-has-history=Y]:checked").length != 0){ - alert("您只能删除没有历史记录的资源,请重新选择后再删除。"); - return; - } - if($("input[type=checkbox][data-deleteble=N]:checked").length != 0){ - alert("您只能删除自己上传的资源,请重新选择后再删除。"); - return; - } - - if(data != "" && confirm('确认要删除这些资源吗?')) { - $.post( - '<%= user_resource_delete_user_path(User.current.id,:type=>@type,:status=>@status)%>', - $("#resources_list_form").serialize(),//只会对选中的控件进行序列化提交 - function (data) { - - } - ); - } - } - - - - function show_send(){ - $("#contextMenu").hide(); - document.oncontextmenu = function() {return true;} - line.children().css("background-color",'white'); - id = line.children().last().html(); - if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。 - $.ajax({ - type: 'get', - url: '<%= search_user_project_user_path(User.current.id)%>' + '?send_id=' + id, - data:{send_type:'file'} - }); - }else{ - $.ajax({ - type: 'get', - url: '<%= search_user_course_user_path(User.current.id)%>' + '?send_id=' + id, - data:{send_type:'file'} - }); - } - } - - function batch_send(){ - if($("#resources_list_form").serialize() == ""){ - alert('暂时不支持多页选择,您当前页没有选择任何资源'); - return ; - } - if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。 - $.ajax({ - type: 'get', - url: '<%= search_user_project_user_path(User.current.id)%>' + '?' + $("#resources_list_form").serialize(), - data:{send_type:'file'} - }); - }else{ - $.ajax({ - type: 'get', - url: '<%= search_user_course_user_path(User.current.id)%>' + '?'+ $("#resources_list_form").serialize(), - data:{send_type:'file'} - }); - - } - } - - function preview(){ - $("#contextMenu").hide(); - document.oncontextmenu = function() {return true;} - line.children().css("background-color",'white'); - id = line.children().last().html(); - $.ajax({ - type:'get', - url:'<%= resource_preview_user_path(User.current.id)%>'+"?resource_id="+id - }); - } - function rename(){ $("#contextMenu").hide(); document.oncontextmenu = function() {return true;} @@ -315,80 +228,4 @@ alert('您无法修改此资源!') } } - String.prototype.trim = function() { - var str = this, - str = str.replace(/^\s\s*/, ''), - ws = /\s/, - i = str.length; - while (ws.test(str.charAt(--i))); - return str.slice(0, i + 1); - } - - - - //恢复编辑状态到链接状态 - //如果当前是编辑状态,任何的不在输入框里的单击右键事件都需要将编辑状态变回链接状态 - //如果是编辑状态,且做了修改,那么久要进行修改,并且将修改值经过处理替换到页面显示 - function restore(){ - //上一行不为空 且链接不为空 - if( last_line != null && res_link != null && res_link != '') { - name = $("#res_name").lenght != 0 && $("#res_name").val() != undefined ? $("#res_name").val().trim() : undefined ; - if (name == undefined || name === 'undefined' ){ //只要res_name没有值,那么就不是编辑状态 - return; - } - if( name && name != res_name.trim()){ - - if(confirm('确定修改为 '+name)){ - $.ajax({ - url: '<%=rename_resource_user_path(User.current.id) %>'+ "?res_name="+$('#res_name').val() + "&res_id=" + $("#res_id").val(), - type:'get', - success:function (data) - { - if (data != 'fail' && name != undefined && name != 'undefined') {//修改成功,那么将链接恢复,并且将链接的显示内容改变。链接可以不变 - last_line.children().eq(1).html(res_link); - last_line.children().eq(1).children().attr('title', name); - last_line.children().eq(1).children().attr('href', data); - last_line.children().eq(1).children().html(name.length > 17 ? name.substring(0, 17) + '...' : name); - } else { - last_line.children().eq(1).html(res_link); - res_link = null; //如果修改失败,恢复之后将res_link置空 - } - } - } ); - }else{ - last_line.children().eq(1).html(res_link); - res_link = null; //如果没有做修改,恢复之后将res_link置空 - } - }else { - last_line.children().eq(1).html(res_link); - res_link = null;//如果没有做修改,恢复之后将res_link置空 - } - - - } - } - - function delete_file() { - $("#contextMenu").hide(); - document.oncontextmenu = function () { - return true; - } - line.children().css("background-color", 'white'); - id = line.children().last().html(); - user_id = line.children().eq(5).html(); - if(line.children().first().children().data('hasHistory') == 'Y'){ - alert('该资源存在历史版本,不能删除'); - return; - } - if(user_id === '<%= User.current.id%>') { - if (confirm('确定要删除资源"' + line.children().eq(1).children().attr('title').trim() + '"么?')) { - $.ajax({ - type: 'post', - url: '<%= user_resource_delete_user_path(User.current.id)%>' + '?resource_id=' + id + '&type=<%=@type %>&status=<%=@status %>' - }); - } - }else{ - alert('您无法删除此资源!') - } - } \ No newline at end of file diff --git a/app/views/users/add_exist_file_to_course.js.erb b/app/views/users/add_exist_file_to_course.js.erb index c05a2ebd0..8db83aefc 100644 --- a/app/views/users/add_exist_file_to_course.js.erb +++ b/app/views/users/add_exist_file_to_course.js.erb @@ -1,6 +1,7 @@ <% if @flag == true%> $("#search_div").html('<%= escape_javascript( render :partial => 'resource_search_form',:locals => {:user=>@user,:type=>@type} ) %>'); $("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>'); +$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true, :path => @path %>'); $("#res_count").html(0); $("#checkboxAll").attr('checked',false); $("#res_all_count").html(<%= @atta_count%>); diff --git a/app/views/users/add_exist_file_to_org.js.erb b/app/views/users/add_exist_file_to_org.js.erb index 9bfe1230a..c6e7f4011 100644 --- a/app/views/users/add_exist_file_to_org.js.erb +++ b/app/views/users/add_exist_file_to_org.js.erb @@ -1,6 +1,7 @@ <% if @flag == true%> $("#search_div").html('<%= escape_javascript( render :partial => 'resource_search_form',:locals => {:user=>@user,:type=>@type} ) %>'); $("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>'); +$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true, :path => @path %>'); $("#res_count").html(0); $("#checkboxAll").attr('checked',false); $("#res_all_count").html(<%= @atta_count%>); diff --git a/app/views/users/add_exist_file_to_project.js.erb b/app/views/users/add_exist_file_to_project.js.erb index ed38fa066..4c24f4932 100644 --- a/app/views/users/add_exist_file_to_project.js.erb +++ b/app/views/users/add_exist_file_to_project.js.erb @@ -1,6 +1,7 @@ <% if @flag == true%> $("#search_div").html('<%= escape_javascript( render :partial => 'resource_search_form',:locals => {:user=>@user,:type=>@type} ) %>'); $("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>'); +$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true, :path => @path %>'); $("#res_count").html(0); $("#checkboxAll").attr('checked',false); $("#res_all_count").html(<%= @atta_count%>); diff --git a/app/views/users/search_user_course.js.erb b/app/views/users/search_user_course.js.erb index f4509987f..5556d3c92 100644 --- a/app/views/users/search_user_course.js.erb +++ b/app/views/users/search_user_course.js.erb @@ -12,7 +12,7 @@ <% if params[:send_type].present? && params[:send_type] == 'news' %> $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_course' , :locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); <% elsif params[:send_type] == 'file' %> -$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_popup' , :locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); +$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_popup' , :locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids, :type => @type}) %>'); <% elsif params[:send_type] == 'message' %> $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_course' ,:locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); <% end %> diff --git a/app/views/users/search_user_org.js.erb b/app/views/users/search_user_org.js.erb index ee12e9439..7461dbfda 100644 --- a/app/views/users/search_user_org.js.erb +++ b/app/views/users/search_user_org.js.erb @@ -1,15 +1,15 @@ -<% if params[:send_type].present? && params[:send_type] == 'news' %> -$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_org' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); -<% elsif params[:send_type] == 'file' %> -$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_orgs' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); -<% elsif params[:send_type] == 'message' %> -$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_org' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); -<% end %> -showModal('ajax-modal', '452px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before(""); -$('#ajax-modal').parent().css("top","50%").css("left","50%"); -$('#ajax-modal').parent().addClass("popbox").addClass("shareDP"); -$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); -var val = $("#search_org_input").val(); +<% if params[:send_type].present? && params[:send_type] == 'news' %> +$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_org' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); +<% elsif params[:send_type] == 'file' %> +$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_orgs' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids, :type => @type})%>'); +<% elsif params[:send_type] == 'message' %> +$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_org' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); +<% end %> +showModal('ajax-modal', '452px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before(""); +$('#ajax-modal').parent().css("top","50%").css("left","50%"); +$('#ajax-modal').parent().addClass("popbox").addClass("shareDP"); +$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); +var val = $("#search_org_input").val(); $("#search_org_input").val("").focus().val(val); \ No newline at end of file diff --git a/app/views/users/search_user_project.js.erb b/app/views/users/search_user_project.js.erb index d58c56ca9..50a194814 100644 --- a/app/views/users/search_user_project.js.erb +++ b/app/views/users/search_user_project.js.erb @@ -1,16 +1,16 @@ -<% 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}) %>'); -<% elsif params[:send_type] == 'file' %> -$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_project_popup', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); -<% elsif params[:send_type] == 'message' %> -$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_project', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); -<% end %> -showModal('ajax-modal', '452px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before(""); -$('#ajax-modal').parent().css("top","50%").css("left","50%"); -$('#ajax-modal').parent().addClass("resourceUploadPopup").addClass("popbox") -$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); -//$("#search_project_input").focus(); -var val = $("#search_project_input").val(); -$("#search_project_input").val("").focus().val(val); +<% 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}) %>'); +<% elsif params[:send_type] == 'file' %> +$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_project_popup', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids, :type => @type}) %>'); +<% elsif params[:send_type] == 'message' %> +$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_project', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); +<% end %> +showModal('ajax-modal', '452px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before(""); +$('#ajax-modal').parent().css("top","50%").css("left","50%"); +$('#ajax-modal').parent().addClass("resourceUploadPopup").addClass("popbox") +$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); +//$("#search_project_input").focus(); +var val = $("#search_project_input").val(); +$("#search_project_input").val("").focus().val(val); diff --git a/app/views/users/user_resource_create.js.erb b/app/views/users/user_resource_create.js.erb index cc7e543c8..d28898e0a 100644 --- a/app/views/users/user_resource_create.js.erb +++ b/app/views/users/user_resource_create.js.erb @@ -1,7 +1,6 @@ closeModal(); $("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>'); $("#resource_tip_list").html('<%= escape_javascript( render :partial => 'users/user_resource_tip_list', :locals => {:user => @user, :type => @type, :status => @status}) %>'); -debugger $("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true, :path => @path %>'); $("#res_all_count").html(<%= @atta_count%>); $("#res_count").html(0); diff --git a/app/views/users/user_resource_delete.js.erb b/app/views/users/user_resource_delete.js.erb index 9583274c6..ffb056e28 100644 --- a/app/views/users/user_resource_delete.js.erb +++ b/app/views/users/user_resource_delete.js.erb @@ -1,14 +1,14 @@ -$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>'); -$("#resource_tip_list").html('<%= escape_javascript( render :partial => 'users/user_resource_tip_list', :locals => {:user => @user, :type => @type, :status => @status}) %>'); -$("#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); -//更新状态 -$("#public_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '6') %>'); -$("#my_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '1') %>'); -$("#resource_type_all").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 1, :search => @switch_search) %>'); -$("#resource_type_course").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 2, :search => @switch_search) %>'); -$("#resource_type_project").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 3, :search => @switch_search) %>'); -$("#resource_type_user").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 5, :search => @switch_search) %>'); +$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>'); +$("#resource_tip_list").html('<%= escape_javascript( render :partial => 'users/user_resource_tip_list', :locals => {:user => @user, :type => @type, :status => @status}) %>'); +$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true, :path => @path %>'); +$("#res_all_count").html(<%= @atta_count%>); +$("#res_count").html(0); +$("#checkboxAll").attr('checked',false); +//更新状态 +$("#public_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '6') %>'); +$("#my_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '1') %>'); +$("#resource_type_all").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 1, :search => @switch_search) %>'); +$("#resource_type_course").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 2, :search => @switch_search) %>'); +$("#resource_type_project").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 3, :search => @switch_search) %>'); +$("#resource_type_user").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 5, :search => @switch_search) %>'); $("#resource_type_file").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 4, :search => @switch_search) %>'); \ No newline at end of file