~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

  • Committer: Jelmer Vernooij
  • Date: 2011-09-21 14:28:02 UTC
  • mfrom: (14006 devel)
  • mto: This revision was merged to the branch mainline in revision 14010.
  • Revision ID: jelmer@canonical.com-20110921142802-7ggkc204igsy532w
MergeĀ lp:launchpad

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
    CURRENT_FILTER_VALUE = 'current_filter_value';
67
67
 
68
68
 
69
 
var Picker = function () {
 
69
var Picker;
 
70
Picker = function () {
70
71
    Picker.superclass.constructor.apply(this, arguments);
71
72
 
72
73
    Y.after(this._renderUIPicker, this, RENDERUI);
389
390
     * @param data a json data object with the details to render
390
391
     */
391
392
    _renderTitleUI: function(data) {
392
 
        var li_title = Y.Node.create(
393
 
            '<span></span>').addClass(C_RESULT_TITLE);
 
393
        var li_title = Y.Node.create('<a href="#"></a>')
 
394
            .addClass(C_RESULT_TITLE)
 
395
            .addClass('js-action');
 
396
        li_title.on('click', function (e, value) {
 
397
                e.preventDefault();
 
398
                }, this, data);
394
399
        if (data.title === undefined) {
395
400
            // Display an empty element if data is empty.
396
401
            return li_title;
438
443
     * @param data a json data object with the details to render
439
444
     */
440
445
    _renderTitleBadgesUI: function(data) {
 
446
        var badges = null;
441
447
        if (data.badges) {
442
 
            var badges = Y.Node.create('<div>Affiliation:</div>')
 
448
            badges = Y.Node.create('<div>Affiliation:</div>')
443
449
                .addClass('badge');
444
450
            var already_processed = [];
445
451
            Y.each(data.badges, function(badge_info) {
454
460
                    badges.appendChild(badge);
455
461
                }
456
462
            });
457
 
            return badges;
 
463
        } else if (data.target_type) {
 
464
            badges = Y.Node.create('<div></div>')
 
465
                .set('text', data.target_type)
 
466
                .addClass('badge');
458
467
        }
459
 
        return null;
 
468
        return badges
460
469
    },
461
470
 
462
471
    /**
583
592
                li.appendChild(li_details);
584
593
                li.expander = new Y.lp.app.widgets.expander.Expander(
585
594
                    li_desc, li_details, {group_id: expander_id});
586
 
                li.expander.setUp();
 
595
                li.expander.setUp(true);
587
596
                li_title.on('click', function (e, value) {
588
597
                    this.fire(SAVE, value);
589
598
                    }, this, data);
957
966
     */
958
967
    _defaultCancel : function(e) {
959
968
        Picker.superclass._defaultCancel.apply(this, arguments);
 
969
        this.set(SEARCH_MODE, false);
960
970
        if ( this.get('clear_on_cancel') ) {
961
971
            this._clear();
962
972
        }