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

View File

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