GridFieldBulkEditingTools/bulkManager/javascript/GridFieldBulkEditingForm.js
Thierry François 1ceee59360 NEW Rewrite of bulk editing save FIX #76
Bulk editing now use the normal Form submission system and handles all
field type, including ajax dependent
2014-09-14 18:44:30 +03:00

62 lines
1.3 KiB
JavaScript

(function($) {
$.entwine('colymba', function($) {
/**
* Toggle all accordion forms
* open or closed
*/
$('#bulkEditToggle') .entwine({
onmatch: function(){},
onunmatch: function(){},
onclick: function(e)
{
var toggleFields = this.parents('form').find('.ss-toggle .ui-accordion-header'),
state = this.data('state')
;
if ( !state || state === 'close' )
{
state = 'open';
}
else {
state = 'close';
}
toggleFields.each(function()
{
var $this = $(this);
if ( state === 'open' && !$this.hasClass('ui-state-active') )
{
$this.click();
}
if ( state === 'close' && $this.hasClass('ui-state-active') )
{
$this.click();
}
});
this.data('state', state);
}
});
/**
* Contains each rocrds editing fields,
* tracks changes and updates...
*/
$('.bulkEditingFieldHolder').entwine({
onmatch: function(){},
onunmatch: function(){},
onchange: function(){
this.removeClass('updated');
if ( !this.hasClass('hasUpdate') )
{
this.addClass('hasUpdate');
}
}
});
});
}(jQuery));