BigW Consortium Gitlab

Commit 97ecae00 by Simon Knox

switch notes to use task_list, but keep its update function for now

parent 3bb07a88
......@@ -11,7 +11,7 @@ require('./dropzone_input');
require('./gfm_auto_complete');
require('vendor/jquery.caret'); // required by jquery.atwho
require('vendor/jquery.atwho');
require('vendor/task_list');
require('./task_list');
(function() {
var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
......@@ -51,7 +51,11 @@ require('vendor/task_list');
this.addBinding();
this.setPollingInterval();
this.setupMainTargetNoteForm();
this.initTaskList();
this.taskList = new gl.TaskList({
dataType: 'note',
selector: '.notes',
update: this.updateTaskList.bind(this)
});
this.collapseLongCommitList();
// We are in the Merge Requests page so we need another edit form for Changes tab
......@@ -125,8 +129,6 @@ require('vendor/task_list');
$(document).off("keydown", ".js-note-text");
$(document).off('click', '.js-comment-resolve-button');
$(document).off("click", '.system-note-commit-list-toggler');
$('.note .js-task-list-container').taskList('disable');
return $(document).off('tasklist:changed', '.note .js-task-list-container');
};
Notes.prototype.keydownNoteText = function(e) {
......@@ -286,7 +288,7 @@ require('vendor/task_list');
// Update datetime format on the recent note
gl.utils.localTimeAgo($notesList.find("#note_" + note.id + " .js-timeago"), false);
this.collapseLongCommitList();
this.initTaskList();
this.taskList.init();
this.refresh();
return this.updateNotesCount(1);
}
......@@ -863,15 +865,6 @@ require('vendor/task_list');
}
};
Notes.prototype.initTaskList = function() {
this.enableTaskList();
return $(document).on('tasklist:changed', '.note .js-task-list-container', this.updateTaskList.bind(this));
};
Notes.prototype.enableTaskList = function() {
return $('.note .js-task-list-container').taskList('enable');
};
Notes.prototype.putEditFormInPlace = function($el) {
var $editForm = $(this.getEditFormSelector($el));
var $note = $el.closest('.note');
......
/* eslint-disable class-methods-use-this, no-new, func-names, prefer-template, no-unneeded-ternary, object-shorthand, space-before-function-paren, comma-dangle, quote-props, consistent-return, no-else-return, no-param-reassign, max-len */
/* global UsersSelect */
require('vendor/task_list');
class TaskList {
constructor(options = {}) {
this.selector = options.selector;
this.dataType = options.dataType;
// Prevent duplicate event bindings
this.disable();
this.update = options.update || this.update.bind(this);
this.init();
}
init() {
// Prevent duplicate event bindings
this.disable();
$(this.selector + ' .js-task-list-container').taskList('enable');
$(document).on('tasklist:changed', this.selector + ' .js-task-list-container', this.update.bind(this));
$(document).on('tasklist:changed', this.selector + ' .js-task-list-container', this.update);
}
disable() {
......@@ -34,8 +38,6 @@ class TaskList {
document.querySelector('#task_status_short').innerText = result.task_status_short;
}
});
// TODO (rspeicher): Make the issue description inline-editable like a note so
// that we can re-use its form here
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment