Merge lp:~stevenk/launchpad/bugs-information_type-ui-portlet into lp:launchpad
Proposed by
Steve Kowalik
on 2012-04-24
| Status: | Merged |
|---|---|
| Approved by: | Steve Kowalik on 2012-04-24 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | 15141 |
| Proposed branch: | lp:~stevenk/launchpad/bugs-information_type-ui-portlet |
| Merge into: | lp:launchpad |
| Diff against target: |
419 lines (+312/-22) 7 files modified
lib/lp/bugs/browser/bug.py (+9/-2) lib/lp/bugs/browser/tests/test_bugview.py (+17/-0) lib/lp/bugs/javascript/bugtask_index.js (+6/-2) lib/lp/bugs/javascript/information_type_choice.js (+69/-0) lib/lp/bugs/javascript/tests/test_information_type_choice.html (+80/-0) lib/lp/bugs/javascript/tests/test_information_type_choice.js (+106/-0) lib/lp/bugs/templates/bug-portlet-privacy.pt (+25/-18) |
| To merge this branch: | bzr merge lp:~stevenk/launchpad/bugs-information_type-ui-portlet |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Ian Booth (community) | 2012-04-24 | Approve on 2012-04-24 | |
|
Review via email:
|
|||
Commit Message
Show information_type in the privacy portlet and allow it to be edited via JS if a feature flag is set.
Description of the Change
Building on the changes introduced in https:/
This branch sort of closes bug 249112, but I'd rather not do so until the feature flag is enabled on production.
As before, I have left the existing tests and added new ones. I have done a drive-by that corrects a capitalization failure introduced by a previous branch.
To post a comment you must log in.

Looks good but I would prefer the code in the callbacks (info type click and xhr success) to be broken out as separate functions. This achieves the correct separation of concerns, allows for much better, cleaner unit tests (eg code to make xhr call tested standalone without having to invoke ui code, code to test ui update after success tested without having to make xhr call etc), and allows for subsequent refactoring to a more mvc style approach. One of the reasons bugtask_index is untested is because it didn't take this more modular approach and it would be a shame to continue old habits from the past. The core logic is all there, it just needs some minor changes and 2 extra tests. Strictly speaking there should also be a test for the setup function. Also, the new test_informatio n_type_ choice. js file doesn't follow the test template eg it's missing the test_library_exists test.
eg
namespace. setup_informati on_type_ choice = function() { type_edit. on("save" , function(e) { .perform_ info_type_ save(
information_ type_edit. get('value' ));
information_
namespace
});
}
namespace. perform_ info_type_ save = function(value) {
namespace. info_type_ save_success( ); named_post( xxxxx);
var config = {
on: {
success: function(id, response) {
}
}
......
};
lp_client.
};
namespace. info_type_ save_success = function() { n_ns.update_ subscription_ status( ); replaceClass( 'public' , 'private'); ns.display_ privacy_ notification( ); replaceClass( 'private' , 'public'); ns.hide_ privacy_ notification( );
subscriptio
if (private_type) {
body.
privacy_
} else {
body.
privacy_
}
}
Unit tests would monkey patch the relevant functions to ensure they are called as expected. This is a common pattern in our current yui tests.