Merge lp:~rvb/launchpad/confirmationoverlay-button-optional into lp:launchpad
Status: | Merged |
---|---|
Approved by: | Raphaël Badin |
Approved revision: | no longer in the source branch. |
Merged at revision: | 13944 |
Proposed branch: | lp:~rvb/launchpad/confirmationoverlay-button-optional |
Merge into: | lp:launchpad |
Diff against target: |
140 lines (+65/-20) 2 files modified
lib/lp/app/javascript/confirmationoverlay/confirmationoverlay.js (+34/-20) lib/lp/app/javascript/confirmationoverlay/tests/test_confirmationoverlay.js (+31/-0) |
To merge this branch: | bzr merge lp:~rvb/launchpad/confirmationoverlay-button-optional |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Graham Binns (community) | code | Approve | |
Review via email: mp+75154@code.launchpad.net |
Commit message
[r=gmb][no-qa] The 'button' parameter is optional when creating a ConfirmationOve
Description of the change
This branch improves the ConfirmationOverlay so that it can be used without providing a button to the constructor. This way, ConfirmationOverlay can be used in pure Javascript environments to only protect method calls like this:
/// JS
var method = function() {
alert('This was a joke!');
};
var co = new Y.lp.app.
submit_fn: method,
form_content: 'Are you *really* sure? This will kill kittens!',
headerContent: 'Confirm?'
});
co.show();
/// \JS
= Tests =
lib/lp/
= QA =
None.
Hi Raphaël,
Nice branch; I've only got one minor tweak for you to make before this lands:
[1]
48 + if (button !== null) {
Since we're in a YUI environment, you should use if(Y.Lang. isValue( button) ) here rather than checking for !== null.