~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

Merged bug-824435-failure-reporting-2 into bug-824435-failure-reporting-3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
 
38
38
    var null_display_value = 'None';
39
39
    var show_search_box = true;
 
40
    var vocabulary_filters;
40
41
 
41
42
    resource_uri = Y.lp.client.normalize_uri(resource_uri);
42
43
 
47
48
        if (config.show_search_box !== undefined) {
48
49
            show_search_box = config.show_search_box;
49
50
        }
 
51
        vocabulary_filters = config.vocabulary_filters;
50
52
    }
51
53
 
52
54
    var content_box = Y.one('#' + content_box_id);
97
99
    };
98
100
 
99
101
    config.save = save;
100
 
    var picker = namespace.create(vocabulary, config);
 
102
    var picker = namespace.create(
 
103
        vocabulary, config, undefined, vocabulary_filters);
101
104
    picker._resource_uri = resource_uri;
102
105
 
103
106
    // If we are to pre-load the vocab, we need a spinner.
266
269
  * @param {String} associated_field_id Optional Id of the text field to
267
270
  *                        to be updated with the value selected by the
268
271
  *                        picker.
 
272
  * @param {Object} vocabulary_filters Optional List of filters which are
 
273
  *                        supported by the vocabulary. Filter objects are a
 
274
 *                         dict of name, title, description values.
 
275
  *
269
276
  */
270
 
namespace.create = function (vocabulary, config, associated_field_id) {
 
277
namespace.create = function (vocabulary, config, associated_field_id,
 
278
                             vocabulary_filters) {
271
279
    if (Y.UA.ie) {
272
280
        return;
273
281
    }
313
321
        headerContent: "<h2>" + header + "</h2>",
314
322
        steptitle: step_title,
315
323
        zIndex: 1000,
316
 
        visible: false
 
324
        visible: false,
 
325
        filter_options: vocabulary_filters
317
326
        });
318
327
 
319
328
    var picker = null;
378
387
        // Was this search initiated automatically, perhaps to load
379
388
        // suggestions?
380
389
        var automated_search = e.details[2] || false;
 
390
        var search_filter = e.details[3];
381
391
        var start = BATCH_SIZE * selected_batch;
382
392
        var batch = 0;
383
393
 
461
471
            var qs = '';
462
472
            qs = Y.lp.client.append_qs(qs, 'name', vocabulary);
463
473
            qs = Y.lp.client.append_qs(qs, 'search_text', search_text);
 
474
            if (Y.Lang.isValue(search_filter)) {
 
475
                qs = Y.lp.client.append_qs(
 
476
                    qs, 'search_filter', search_filter);
 
477
            }
464
478
            qs = Y.lp.client.append_qs(qs, 'batch', BATCH_SIZE);
465
479
            qs = Y.lp.client.append_qs(qs, 'start', start);
466
480