~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/app/javascript/picker/picker_patcher.js

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-12-19 19:13:35 UTC
  • mfrom: (14522.2.10 public-private-warnings)
  • Revision ID: launchpad@pqm.canonical.com-20111219191335-7olxp3ir7d3ddf6f
[r=sinzui][bug=898702] Warns the user when they are assigning a
        private team to a public role in Launchpad.

Show diffs side-by-side

added added

removed removed

Lines of Context:
197
197
};
198
198
 
199
199
/*
 
200
 * A specific instantiation of the yesno warning for private teams, used in
 
201
 * multiple places.
 
202
 */
 
203
namespace.public_private_warning = function(
 
204
    picker, picker_result, do_save, do_cancel) {
 
205
 
 
206
    var client = new Y.lp.client.Launchpad();
 
207
    config = {
 
208
        on: {
 
209
            success: function (person) {
 
210
                var private_person = person.get('private');
 
211
                var public_context = true;
 
212
                if (LP.cache.context.private !== undefined) {
 
213
                    public_context = !(LP.cache.context.private);
 
214
                }
 
215
 
 
216
                if (private_person && public_context) {
 
217
                    var yesno_content =
 
218
                        '<p>This action will reveal this team\'s name to ' +
 
219
                        'the public.</p>' 
 
220
                    Y.lp.app.picker.yesno_save_confirmation(
 
221
                            picker, yesno_content, 'Continue', 'Choose Again',
 
222
                            do_save, do_cancel);
 
223
                } else {
 
224
                    do_save();
 
225
                }
 
226
            }
 
227
        }
 
228
    };
 
229
    client.get(picker_result.api_uri, config);
 
230
};
 
231
 
 
232
/*
200
233
 * Insert the validation content into the form and animate its appearance.
201
234
 */
202
235
function animate_validation_content(picker, validation_content) {