socialforge/app/views/attachments/_batch_setting_resources.ht...

60 lines
2.3 KiB
Plaintext

<table class="sy_new_table clear sy_new_table_width" cellpadding="0" cellspacing="0" id="student_list_table" style="border: none;text-align: left;">
<thead>
<tr class="clear">
<th style="width: 80%;"><input type="checkbox" name="check_all" class="fl mr5 mt8" />资源名称</th>
<th class="t_c">上传者</th>
</tr>
</thead>
<tbody>
<% @attachments.each do |attachment| %>
<tr>
<td style="text-align: left;">
<input type="checkbox" name="attachments[]" value="<%= attachment.id %>" id="attachment_<%= attachment.id %>" class="fl mr5 mt8" />
<label for="attachment_<%= attachment.id %>"><%= attachment.filename %></label>
</td>
<td class="t_c"><%= attachment.author.show_name %></td>
</tr>
<% end %>
</tbody>
</table>
<div class="clear">
<span class="c_red f12 none" style="margin-top: 4px;" id="atta_check_notice_batch">请至少选择一个资源</span>
<div class="cl"></div>
<div class="resourcesSelectSendButton fl mt10 mr15 inactive-border">
<a href="javascript:void(0);" class="sendButtonBlue db inactive-text" onclick="delete_resources()">删除</a>
</div>
<div class="pageRoll fr mt15">
<ul class="wlist" style="margin-top: 0px;">
<%= pagination_links_full @attachment_pages, @attachment_count, :per_page_links => false, :remote => true, :flag => true %>
</ul>
</div>
</div>
<script>
$(function(){
if($("#choose_resource_ids").val() != ""){
var choose_ids = $("#choose_resource_ids").val().split(",");
for (var i = 0; i < choose_ids.length; i++){
$("#attachment_" + choose_ids[i]).attr("checked", "checked");
}
}
if($("input[name='all_check']").val() == '1'){
$("input[name='check_all']").attr('checked', true);
$("input[name='attachments[]']").attr('checked', true);
}
$("input[name='check_all']").on('change', function(){
if($("input[name='check_all']").is(':checked')){
$("input[name='all_check']").val(1);
$("#choose_resource_ids").val("<%= @all_attachment_ids %>");
$("input[name='attachments[]']").attr('checked', true);
} else{
$("input[name='all_check']").val(0);
$("#choose_resource_ids").val("");
$("input[name='attachments[]']").attr('checked', false);
}
});
});
</script>