|
|
|
@ -82,22 +82,26 @@
|
|
|
|
|
<li class="resourcesListTime fl">上传时间</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<form id="resources_list_form">
|
|
|
|
|
<div id="resources_list" class="resourcesList">
|
|
|
|
|
|
|
|
|
|
<%= render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments} %>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
<div class="resourcesListOption">
|
|
|
|
|
<div class="resourcesCheckAll">
|
|
|
|
|
<input id="checkboxAll" type="checkbox" value="" class="resourcesCheckbox" />
|
|
|
|
|
<input id="checkboxAll" type="checkbox" value="" onclick="all_select();" class="resourcesCheckbox" />
|
|
|
|
|
</div>
|
|
|
|
|
<a href="javascript:void(0);" class="replyGrey mr15">全选</a>
|
|
|
|
|
<a href="javascript:void(0);" class="replyGrey">删除</a>
|
|
|
|
|
<a href="javascript:void(0);" class="replyGrey mr15" onclick="all_select();">全选</a>
|
|
|
|
|
<a href="javascript:void(0);" class="replyGrey" onclick="batch_delete();">删除</a>
|
|
|
|
|
<div class="resourcesSelectSend">
|
|
|
|
|
<div class="fl">选择 <span class="c_red" id="res_count">0</span> 个资源</div>
|
|
|
|
|
<div class="resourcesSelectSendButton">
|
|
|
|
|
<a href="javascript:void(0);" class="c_blue db">发送</a>
|
|
|
|
|
<a href="javascript:void(0);" class="c_blue db" onclick="batch_send();">发送</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="upload_box" style="display: none">
|
|
|
|
|
<%= render :partial => 'upload_resource' ,:locals => {:user=>@user}%>
|
|
|
|
@ -182,7 +186,7 @@ $(".resourcesList").click(function(e) {
|
|
|
|
|
//只要有一个选中了就是true
|
|
|
|
|
function checkboxSelected(){
|
|
|
|
|
selected = false;
|
|
|
|
|
$("#resources_list").find("input[name='checkbox1']").each(function(){
|
|
|
|
|
$("#resources_list").find("input[name='checkbox1[]']").each(function(){
|
|
|
|
|
if($(this).attr('checked') == true){
|
|
|
|
|
selected = true;
|
|
|
|
|
}
|
|
|
|
@ -192,7 +196,7 @@ $(".resourcesList").click(function(e) {
|
|
|
|
|
//只有全选才是true
|
|
|
|
|
function checkboxAllSelected(){
|
|
|
|
|
allSelected = true;
|
|
|
|
|
$("#resources_list").find("input[name='checkbox1']").each(function(){
|
|
|
|
|
$("#resources_list").find("input[name='checkbox1[]']").each(function(){
|
|
|
|
|
if($(this).attr('checked') == undefined){
|
|
|
|
|
allSelected = false;
|
|
|
|
|
}
|
|
|
|
@ -202,7 +206,7 @@ $(".resourcesList").click(function(e) {
|
|
|
|
|
//只有全部不选才是true
|
|
|
|
|
function checkboxAllDeselected(){
|
|
|
|
|
allDeselected = true;
|
|
|
|
|
$("#resources_list").find("input[name='checkbox1']").each(function(){
|
|
|
|
|
$("#resources_list").find("input[name='checkbox1[]']").each(function(){
|
|
|
|
|
if($(this).attr('checked') == 'checked'){
|
|
|
|
|
allDeselected = false;
|
|
|
|
|
}
|
|
|
|
@ -223,27 +227,42 @@ $(".resourcesList").click(function(e) {
|
|
|
|
|
//获取当前checkbox选中的数目
|
|
|
|
|
function getCheckBoxSeletedCount(){
|
|
|
|
|
var i = 0;
|
|
|
|
|
$("#resources_list").find("input[name='checkbox1']").each(function(){
|
|
|
|
|
$("#resources_list").find("input[name='checkbox1[]']").each(function(){
|
|
|
|
|
if($(this).attr('checked') == 'checked'){
|
|
|
|
|
i ++;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
$("#checkboxAll").click(function(e){
|
|
|
|
|
//全选反选
|
|
|
|
|
function all_select(){
|
|
|
|
|
|
|
|
|
|
if($(this).attr('checked')){
|
|
|
|
|
$("#resources_list").find("input[name='checkbox1']").each(function(){
|
|
|
|
|
if($("#checkboxAll").attr('checked')){
|
|
|
|
|
$("#resources_list").find("input[name='checkbox1[]']").each(function(){
|
|
|
|
|
$(this).attr('checked',true);
|
|
|
|
|
});
|
|
|
|
|
$("#res_count").html('<%= @attachments.size%>');
|
|
|
|
|
$("#res_count").html(getCheckBoxSeletedCount());
|
|
|
|
|
}else{
|
|
|
|
|
$("#resources_list").find("input[name='checkbox1']").each(function(){
|
|
|
|
|
$("#resources_list").find("input[name='checkbox1[]']").each(function(){
|
|
|
|
|
$(this).attr('checked',false);
|
|
|
|
|
});
|
|
|
|
|
$("#res_count").html(0);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//批量删除
|
|
|
|
|
function batch_delete(){
|
|
|
|
|
var data = $("#resources_list_form").serialize();
|
|
|
|
|
if(data != "" && confirm('确认要删除这些资源吗?')) {
|
|
|
|
|
$.post(
|
|
|
|
|
'<%= user_resource_delete_user_path(@user)%>',
|
|
|
|
|
$("#resources_list_form").serialize(),//只会对选中的控件进行序列化提交
|
|
|
|
|
function (data) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function show_send(){
|
|
|
|
|
$("#contextMenu").hide();
|
|
|
|
|