~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

[r=abentley][bug=801388,
        806179] Re-lands wallyworlds fix to keep the assign me button from
        appearing in goofy places,
        and fixes a problem that prevented personpickers from rendering.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
        var show_assign_me_button = true;
25
25
        var show_remove_button = true;
 
26
        var assign_button_text = 'Pick Me';
 
27
        var remove_button_text = 'Remove Person';
26
28
 
27
29
        if (cfg !== undefined) {
28
30
            if (cfg.show_assign_me_button !== undefined) {
31
33
            if (cfg.show_remove_button !== undefined) {
32
34
                show_remove_button = cfg.show_remove_button;
33
35
            }
 
36
            if (cfg.assign_button_text !== undefined) {
 
37
                assign_button_text = cfg.assign_button_text;
 
38
            }
 
39
            if (cfg.remove_button_text !== undefined) {
 
40
                remove_button_text = cfg.remove_button_text;
 
41
            }
34
42
        }
35
43
        this._show_assign_me_button = show_assign_me_button;
36
44
        this._show_remove_button = show_remove_button;
 
45
        this._assign_me_button_text = assign_button_text;
 
46
        this._remove_button_text = remove_button_text;
37
47
    },
38
48
 
39
49
    hide: function() {
57
67
 
58
68
    _renderPersonPickerUI: function() {
59
69
        var remove_button, assign_me_button;
60
 
        var remove_button_text = "Remove assignee";
61
 
        var assign_me_button_text = "Assign to me";
62
70
 
63
71
        if (this._show_remove_button) {
64
72
            remove_button = Y.Node.create(
65
73
                '<a class="yui-picker-remove-button bg-image" ' +
66
74
                'href="javascript:void(0)" ' +
67
75
                'style="background-image: url(/@@/remove); padding-right: ' +
68
 
                '1em">' + remove_button_text + '</a>');
 
76
                '1em">' + this._remove_button_text + '</a>');
69
77
            remove_button.on('click', this.remove, this);
70
78
            this._extra_buttons.appendChild(remove_button);
71
79
            this.remove_button = remove_button;
76
84
                '<a class="yui-picker-assign-me-button bg-image" ' +
77
85
                'href="javascript:void(0)" ' +
78
86
                'style="background-image: url(/@@/person)">' +
79
 
                assign_me_button_text + '</a>');
 
87
                this._assign_me_button_text + '</a>');
80
88
            assign_me_button.on('click', this.assign_me, this);
81
89
            this._extra_buttons.appendChild(assign_me_button);
82
90
            this.assign_me_button = assign_me_button;