Add ui-state to save and delete buttons

Switch buttons between enabled and disabled as necessary
This commit is contained in:
colymba 2013-01-17 23:32:54 +02:00
parent a0ebac8f7d
commit 67958b4e37
2 changed files with 18 additions and 4 deletions

View File

@ -166,6 +166,7 @@ class GridFieldBulkImageUpload_Request extends RequestHandler {
->setAttribute('data-icon', 'accept')
->setAttribute('data-url', $this->Link('update'))
->setUseButtonTag(true)
->setDisabled(true)
);
/*
if($crumbs && $crumbs->count()>=2)
@ -188,6 +189,7 @@ class GridFieldBulkImageUpload_Request extends RequestHandler {
->setAttribute('data-icon', 'decline')
->setAttribute('data-url', $this->Link('cancel'))
->setUseButtonTag(true)
->setDisabled(true)
);

View File

@ -14,7 +14,7 @@
onmatch: function(){
if( !$(this).hasClass('opened') ){
$(this).addClass('opened');
}
}
},
onunmatch: function(){
@ -63,10 +63,11 @@
if ( !$(itemInfo).hasClass('dirty') ) $(itemInfo).addClass('dirty');
$('#bulkImageUploadUpdateFinishBtn').addClass('dirty');
$('#bulkImageUploadUpdateBtn').removeClass('ui-state-disabled');
}
});
$('#bulkImageUploadUpdateBtn').entwine({
$('#bulkImageUploadUpdateBtn:not(.ui-state-disabled)').entwine({
onmatch: function(){
$(this).data('completedForms', 0);
},
@ -114,10 +115,11 @@
$('#bulkImageUploadUpdateFinishBtn').removeClass('dirty');
$('#bulkImageUploadUpdateBtn').data('completedForms', 0);
$('#bulkImageUploadUpdateBtn').removeClass('loading');
$('#bulkImageUploadUpdateBtn').addClass('ui-state-disabled');
if ( $('#bulkImageUploadUpdateBtn').hasClass('doFinish') ) {
//@TODO find a way to pass this as CMS navigation through AJAX
window.location = $('#bulkImageUploadUpdateFinishBtn').data('return-url');
}
}
}
});
@ -135,7 +137,16 @@
}
});
$('#bulkImageUploadUpdateCancelBtn').entwine({
$('.ss-uploadfield-item-editform').entwine({
onmatch: function(e){
console.log(this);
$('#bulkImageUploadUpdateCancelBtn').removeClass('ui-state-disabled');
},
onunmatch: function(){
}
});
$('#bulkImageUploadUpdateCancelBtn:not(.ui-state-disabled)').entwine({
onclick: function(e){
var url = $(this).data('url');
@ -156,6 +167,7 @@
if ( $('li.ss-uploadfield-item').length == 0 ) {
$('.ss-uploadfield-editandorganize').css('display', 'none');
$('#Form_bulkImageUploadForm').removeClass('loading');
$('#bulkImageUploadUpdateCancelBtn').addClass('ui-state-disabled');
}
});