New batch system! Hopefully nothing else broke...

Attempt number 5,176 at a decent batch system, we'll see.
This commit is contained in:
Lance Edgar 2015-01-19 00:52:40 -06:00
parent c4a19f279b
commit b05f30d9fe
15 changed files with 1213 additions and 32 deletions

View file

@ -115,7 +115,7 @@ $(function() {
/*
* When filter labels are clicked, (un)check the associated checkbox.
*/
$('div.grid-wrapper div.filter label').on('click', function() {
$('body').on('click', '.grid-wrapper .filter label', function() {
var checkbox = $(this).prev('input[type="checkbox"]');
if (checkbox.prop('checked')) {
checkbox.prop('checked', false);
@ -130,7 +130,7 @@ $(function() {
* element. If all available filters have been displayed, the "add filter"
* dropdown will be hidden.
*/
$('#add-filter').on('change', function() {
$('body').on('change', '#add-filter', function() {
var select = $(this);
var filters = select.parents('div.filters:first');
var filter = filters.find('#filter-' + select.val());
@ -156,7 +156,7 @@ $(function() {
* When user clicks the grid filters search button, perform the search in
* the background and reload the grid in-place.
*/
$('div.filters form').submit(function() {
$('body').on('submit', '.filters form', function() {
var form = $(this);
var wrapper = form.parents('div.grid-wrapper');
var grid = wrapper.find('div.grid');
@ -174,7 +174,7 @@ $(function() {
* When user clicks the grid filters reset button, manually clear all
* filter input elements, and submit a new search.
*/
$('div.filters form button[type="reset"]').click(function() {
$('body').on('click', '.filters form button[type="reset"]', function() {
var form = $(this).parents('form');
form.find('div.filter').each(function() {
$(this).find('div.value input').val('');
@ -183,7 +183,7 @@ $(function() {
return false;
});
$('div.grid-wrapper').on('click', 'div.grid th.sortable a', function() {
$('body').on('click', '.grid thead th.sortable a', function() {
var th = $(this).parent();
var wrapper = th.parents('div.grid-wrapper');
var grid = wrapper.find('div.grid');
@ -201,29 +201,29 @@ $(function() {
return false;
});
$('#body').on('mouseenter', 'div.grid.hoverable table tbody tr', function() {
$('body').on('mouseenter', '.grid.hoverable tbody tr', function() {
$(this).addClass('hovering');
});
$('#body').on('mouseleave', 'div.grid.hoverable table tbody tr', function() {
$('body').on('mouseleave', '.grid.hoverable tbody tr', function() {
$(this).removeClass('hovering');
});
$('div.grid-wrapper').on('click', 'div.grid table tbody td.view', function() {
$('body').on('click', '.grid tbody td.view', function() {
var url = $(this).attr('url');
if (url) {
location.href = url;
}
});
$('div.grid-wrapper').on('click', 'div.grid table tbody td.edit', function() {
$('body').on('click', '.grid tbody td.edit', function() {
var url = $(this).attr('url');
if (url) {
location.href = url;
}
});
$('div.grid-wrapper').on('click', 'div.grid table tbody td.delete', function() {
$('body').on('click', '.grid tbody td.delete', function() {
var url = $(this).attr('url');
if (url) {
if (confirm("Do you really wish to delete this object?")) {
@ -232,7 +232,8 @@ $(function() {
}
});
$('div.grid-wrapper').on('change', 'div.grid div.pager select#grid-page-count', function() {
// $('div.grid-wrapper').on('change', 'div.grid div.pager select#grid-page-count', function() {
$('body').on('change', '.grid .pager #grid-page-count', function() {
var select = $(this);
var wrapper = select.parents('div.grid-wrapper');
var grid = wrapper.find('div.grid');
@ -269,7 +270,7 @@ $(function() {
/*
* Add "check all" functionality to tables with checkboxes.
*/
$('body').on('click', 'div.grid table thead th.checkbox input[type="checkbox"]', function() {
$('body').on('click', '.grid thead th.checkbox input[type="checkbox"]', function() {
var table = $(this).parents('table:first');
var checked = $(this).prop('checked');
table.find('tbody tr').each(function() {