GridFieldBulkEditingTools/bulkManager/javascript/GridFieldBulkEditingForm.js

62 lines
1.3 KiB
JavaScript
Raw Normal View History

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