summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/boards/models/issue.js.es6
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/boards/models/issue.js.es6')
-rw-r--r--app/assets/javascripts/boards/models/issue.js.es678
1 files changed, 0 insertions, 78 deletions
diff --git a/app/assets/javascripts/boards/models/issue.js.es6 b/app/assets/javascripts/boards/models/issue.js.es6
deleted file mode 100644
index 2d0a295ae4d..00000000000
--- a/app/assets/javascripts/boards/models/issue.js.es6
+++ /dev/null
@@ -1,78 +0,0 @@
-/* eslint-disable no-unused-vars, space-before-function-paren, arrow-body-style, arrow-parens, comma-dangle, max-len */
-/* global Vue */
-/* global ListLabel */
-/* global ListMilestone */
-/* global ListUser */
-
-class ListIssue {
- constructor (obj) {
- this.globalId = obj.id;
- this.id = obj.iid;
- this.title = obj.title;
- this.confidential = obj.confidential;
- this.dueDate = obj.due_date;
- this.subscribed = obj.subscribed;
- this.labels = [];
- this.selected = false;
- this.assignee = false;
-
- if (obj.assignee) {
- this.assignee = new ListUser(obj.assignee);
- }
-
- if (obj.milestone) {
- this.milestone = new ListMilestone(obj.milestone);
- }
-
- obj.labels.forEach((label) => {
- this.labels.push(new ListLabel(label));
- });
-
- this.priority = this.labels.reduce((max, label) => {
- return (label.priority < max) ? label.priority : max;
- }, Infinity);
- }
-
- addLabel (label) {
- if (!this.findLabel(label)) {
- this.labels.push(new ListLabel(label));
- }
- }
-
- findLabel (findLabel) {
- return this.labels.filter(label => label.title === findLabel.title)[0];
- }
-
- removeLabel (removeLabel) {
- if (removeLabel) {
- this.labels = this.labels.filter(label => removeLabel.title !== label.title);
- }
- }
-
- removeLabels (labels) {
- labels.forEach(this.removeLabel.bind(this));
- }
-
- getLists () {
- return gl.issueBoards.BoardsStore.state.lists.filter(list => list.findIssue(this.id));
- }
-
- update (url) {
- const data = {
- issue: {
- milestone_id: this.milestone ? this.milestone.id : null,
- due_date: this.dueDate,
- assignee_id: this.assignee ? this.assignee.id : null,
- label_ids: this.labels.map((label) => label.id)
- }
- };
-
- if (!data.issue.label_ids.length) {
- data.issue.label_ids = [''];
- }
-
- return Vue.http.patch(url, data);
- }
-}
-
-window.ListIssue = ListIssue;