Sha256: 1748d7f14a29a588eb4440e68220ede170e05ff54152fb304f595ac1da62ec03
Contents?: true
Size: 1.37 KB
Versions: 84
Compression:
Stored size: 1.37 KB
Contents
Blacklight.onLoad(function () { // add the batch ids to any submit of a batch update var batch_ids = null; $('input.updates-batches').on('click', function() { var form = $(this).closest("form"); var hash, id; // pull the ids from the url if (!batch_ids) { batch_ids = []; // pull the ids from the url var q = document.URL.split('?')[1]; if(q != undefined){ q = q.split('&'); for(var i = 0; i < q.length; i++){ hash = q[i].split('='); if (hash[0] == "batch_document_ids%5B%5D") batch_ids.push(unescape(hash[1])); } } } // push the ids in the form for(var j = 0; j < batch_ids.length; j++){ if (form.children("input[value='"+batch_ids[j]+"']").length == 0) form.append('<input type="hidden" multiple="multiple" name="batch_document_ids[]" value="'+batch_ids[j]+'" />'); } }); $('input.submits-batches').on('click', function() { var form = $(this).closest("form"); $.map( $(".batch_document_selector:checked"), function(document, i) { var id = document.id.substring("batch_document_".length); if (form.children("input[value='"+id+"']").length == 0) form.append('<input type="hidden" multiple="multiple" name="batch_document_ids[]" value="'+id+'" />'); }); }); });
Version data entries
84 entries across 84 versions & 3 rubygems