launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #03425
[Merge] lp:~henninge/launchpad/devel-759606-ajaxify-delete-link into lp:launchpad
Deryck Hodge has proposed merging lp:~henninge/launchpad/devel-759606-ajaxify-delete-link into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~henninge/launchpad/devel-759606-ajaxify-delete-link/+merge/58831
I'm putting this up for Henning, so I can review and land it for him, considering he'll be unavailable for a few days.
--
https://code.launchpad.net/~henninge/launchpad/devel-759606-ajaxify-delete-link/+merge/58831
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~henninge/launchpad/devel-759606-ajaxify-delete-link into lp:launchpad.
=== modified file 'lib/lp/translations/javascript/sourcepackage_sharing_details.js'
--- lib/lp/translations/javascript/sourcepackage_sharing_details.js 2011-04-18 13:39:13 +0000
+++ lib/lp/translations/javascript/sourcepackage_sharing_details.js 2011-04-22 17:16:41 +0000
@@ -183,6 +183,15 @@
}
+function update_unlink_form(overlay, productseries) {
+ overlay.get('form_content')
+ .one('a')
+ .set('href', Y.lp.get_url_path(productseries.get('web_link')))
+ .set('text', productseries.get('title'));
+ overlay.render();
+}
+
+
function submit_form(config, form_data, entry, view_name, action) {
var form_data_entries = [];
var key;
@@ -304,10 +313,11 @@
* @param branch_summary {Object} An object containing api_url, css,
* description, value, title
*/
- configure: function(config, branch_picker_config, import_overlay,
- usage_overlay) {
+ configure: function(config, branch_picker_config, unlink_overlay,
+ import_overlay, usage_overlay) {
this.set('branch_picker_config', branch_picker_config);
this.set('source_package', config.context);
+ this.set('unlink_overlay', unlink_overlay);
this.set('import_overlay', import_overlay);
this.set('usage_overlay', usage_overlay);
this.replace_productseries(config.productseries);
@@ -315,16 +325,23 @@
this.set_branch(config.upstream_branch);
},
set_productseries: function(productseries) {
+ var check = this.get('tsconfig').get('product_series');
if (Y.Lang.isValue(productseries)){
this.set('productseries', productseries);
- this.get('tsconfig').get('product_series').set_link(
+ check.set_link(
productseries.get('title'), productseries.get('web_link'));
}
+ else {
+ check.clear_link();
+ }
},
replace_productseries: function(productseries) {
this.set_productseries(productseries);
var autoimport_mode = namespace.autoimport_modes.no_import;
if (!Y.Lang.isNull(productseries)){
+ var unlink_overlay = this.get('unlink_overlay');
+ update_unlink_form(unlink_overlay, productseries);
+
autoimport_mode = productseries.get(
'translations_autoimport_mode');
var import_overlay = this.get('import_overlay');
@@ -411,6 +428,26 @@
save_productseries(io_handler.chain_config(
get_productseries, cache_productseries, cache_branch, set_usage));
},
+ remove_productseries: function(productseries_summary) {
+ var that = this;
+ var productseries_check = that.get('tsconfig').get('product_series');
+ var lp_client = new Y.lp.client.Launchpad();
+ function delete_packaging(config) {
+ productseries_check.set('pending', true);
+ var source_package = that.get('source_package');
+ source_package.named_post('deletePackaging', config);
+ }
+ function set_checks() {
+ that.replace_productseries(null);
+ that.replace_product(null);
+ that.set_branch(null);
+ productseries_check.set('pending', false);
+ that.update();
+ that.flash_check_green(productseries_check);
+ }
+ var io_handler = new IOHandler(this, productseries_check);
+ delete_packaging(io_handler.chain_config(set_checks));
+ },
select_branch: function(branch_summary) {
var that = this;
var lp_client = new Y.lp.client.Launchpad();
@@ -545,6 +582,19 @@
'ProductSeries', productseries_picker_config);
/* Picker can't normally be activated by two different elements. */
add_activator(productseries_picker, '#packaging-incomplete-picker a');
+ var unlink_overlay = create_form_overlay(
+ '<h2>Unlink an upstream project<h2>', function(form_data) {
+ Y.log('Unlinking.');
+ sharing_controller.remove_productseries();
+ });
+ unlink_overlay.set(
+ 'form_content', Y.Node.create(
+ '<p>This will remove the upstream link to '+
+ '<a href="">foo</a>.</p>'));
+ Y.one('#remove-packaging').on('click', function(e) {
+ e.preventDefault();
+ this.show();
+ }, unlink_overlay);
var import_overlay = create_form_overlay(
'<h2>Import settings<h2>', function(form_data) {
Y.log(form_data['field.translations_autoimport_mode']);
@@ -611,7 +661,8 @@
});
sharing_controller.set_check_picker(usage, usage_overlay);
sharing_controller.configure(
- cache, branch_picker_config, import_overlay, usage_overlay);
+ cache, branch_picker_config,
+ unlink_overlay, import_overlay, usage_overlay);
sharing_controller.update();
};
}, "0.1", {"requires": [