~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/bugs/javascript/bugtask_index.js

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-07-19 20:31:43 UTC
  • mfrom: (13445.1.10 bug777874)
  • Revision ID: launchpad@pqm.canonical.com-20110719203143-uwkz5us2ewbgx50v
[r=gmb][bug=777874] enable autocompletion of "New" bugtasks that
        affect more than one person. Feature-flagged by project/distro.

Show diffs side-by-side

added added

removed removed

Lines of Context:
658
658
    Y.fire('lp:branch-linked', bug_branch_node);
659
659
}
660
660
 
 
661
var status_choice_data = [];
 
662
 
 
663
var update_maybe_confirmed_status = function() {
 
664
    // This would be better done via client-side MVC for the pertinent
 
665
    // bugtasks, but we don't have that yet.
 
666
    Y.Array.each(
 
667
        status_choice_data,
 
668
        function(rowdata) {
 
669
            if (rowdata.widget.get('value') === 'New') {
 
670
                lp_client.get(
 
671
                    rowdata.config.bugtask_path,
 
672
                    // We will silently fail.
 
673
                    // This is not critical functionality.
 
674
                    {on: {success: function(bugtask) {
 
675
                        var status = bugtask.get('status');
 
676
                        if (status !== rowdata.widget.get('value')) {
 
677
                            rowdata.widget.set('value', status);
 
678
                            rowdata.widget.fire('save');
 
679
                        }
 
680
                    }}});
 
681
            }
 
682
        }
 
683
    );
 
684
};
661
685
 
662
686
/**
663
687
 * Set up a bug task table row.
664
688
 *
665
 
 * Called once, on load, to initialize the page.
 
689
 * Called once per row, on load, to initialize the page.
666
690
 *
667
691
 * @method setup_bugtasks_row
668
692
 */
740
764
                        patch: 'status',
741
765
                        resource: conf.bugtask_path}});
742
766
            status_choice_edit.render();
 
767
            status_choice_data.push(
 
768
                {widget: status_choice_edit, config: conf});
743
769
        }
744
770
        if (conf.user_can_edit_importance) {
745
771
            var importance_choice_edit = new Y.ChoiceSource({
1086
1112
                    widget._uiClearWaiting();
1087
1113
                    MeTooChoiceSource.superclass._saveData.call(
1088
1114
                        widget, value);
 
1115
                    if (value && widget.get('others_affected_count') > 0) {
 
1116
                        // If we increased the affected count to 2 or more,
 
1117
                        // maybe update the statuses of our bugtasks.
 
1118
                        update_maybe_confirmed_status();
 
1119
                    }
1089
1120
                },
1090
1121
                failure: this.error_handler.getFailureHandler()
1091
1122
            },