forked from PrestaShop/PrestaShop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request PrestaShop#5479 from mickaelandrieu/boom-371-2-imp…
…rovements [-] BO : added missing delete confirmation poppin on product page form
- Loading branch information
Showing
5 changed files
with
87 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/** | ||
* modal confirmation management | ||
*/ | ||
var modalConfirmation = (function() { | ||
var modal = $('#confirmation_modal'); | ||
|
||
if(!modal) { | ||
throw new Error('Modal confirmation is not available'); | ||
} | ||
|
||
var actionsCallbacks = { | ||
onCancel: function() { | ||
console.log('modal canceled'); | ||
return; | ||
}, | ||
onContinue: function() { | ||
console.log('modal continued'); | ||
return; | ||
} | ||
}; | ||
|
||
modal.find('button.cancel').click(function() { | ||
if (typeof actionsCallbacks.onCancel === 'function') { | ||
actionsCallbacks.onCancel(); | ||
} | ||
modalConfirmation.hide(); | ||
}); | ||
|
||
modal.find('button.continue').click(function() { | ||
if (typeof actionsCallbacks.onContinue === 'function') { | ||
actionsCallbacks.onContinue(); | ||
} | ||
modalConfirmation.hide(); | ||
}); | ||
return { | ||
'init': function init() { | ||
console.log('modal initialised'); | ||
}, | ||
'create': function create(content, title, callbacks) { | ||
if(title != null){ | ||
modal.find('.modal-title').html(title); | ||
} | ||
if(content != null){ | ||
modal.find('.modal-body').html(content); | ||
} | ||
|
||
actionsCallbacks = callbacks; | ||
return this; | ||
}, | ||
'show': function show() { | ||
modal.modal('show'); | ||
}, | ||
'hide': function hide() { | ||
modal.modal('hide'); | ||
} | ||
}; | ||
})(); | ||
|
||
BOEvent.on("Modal confirmation started", function initModalConfirmationSystem() { | ||
modalConfirmation.init(); | ||
}, "Back office"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters