summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/due_date_select.js.es6
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-10-20 08:54:33 +0100
committerPhil Hughes <me@iamphill.com>2016-10-20 08:54:33 +0100
commit29645f06e7889fe85bb155abaa0f361f8680311b (patch)
tree6dc442e40471790e0b74babc165618b4e095a068 /app/assets/javascripts/due_date_select.js.es6
parent344154e9068945af2874d6cb253457fb90fef3f3 (diff)
downloadgitlab-ce-29645f06e7889fe85bb155abaa0f361f8680311b.tar.gz
Hides/shows the boards sidebar
Rather than constructing & then deconstructing, we know just hide & show the sidebar. This is done so we dont' have a memory leak on the frontend with objects getting created.
Diffstat (limited to 'app/assets/javascripts/due_date_select.js.es6')
-rw-r--r--app/assets/javascripts/due_date_select.js.es629
1 files changed, 26 insertions, 3 deletions
diff --git a/app/assets/javascripts/due_date_select.js.es6 b/app/assets/javascripts/due_date_select.js.es6
index 41925fcc8e3..4f7c1092d05 100644
--- a/app/assets/javascripts/due_date_select.js.es6
+++ b/app/assets/javascripts/due_date_select.js.es6
@@ -41,7 +41,12 @@
defaultDate: $("input[name='" + this.fieldName + "']").val(),
altField: "input[name='" + this.fieldName + "']",
onSelect: () => {
- return this.saveDueDate(true);
+ if (this.$dropdown.hasClass('js-issue-boards-due-date')) {
+ gl.issueBoards.BoardsStore.detail.issue.dueDate = $("input[name='" + this.fieldName + "']").val();
+ this.updateIssueBoardIssue();
+ } else {
+ return this.saveDueDate(true);
+ }
}
});
}
@@ -49,8 +54,14 @@
initRemoveDueDate() {
this.$block.on('click', '.js-remove-due-date', (e) => {
e.preventDefault();
- $("input[name='" + this.fieldName + "']").val('');
- return this.saveDueDate(false);
+
+ if (this.$dropdown.hasClass('js-issue-boards-due-date')) {
+ gl.issueBoards.BoardsStore.detail.issue.dueDate = '';
+ this.updateIssueBoardIssue();
+ } else {
+ $("input[name='" + this.fieldName + "']").val('');
+ return this.saveDueDate(false);
+ }
});
}
@@ -83,6 +94,18 @@
this.datePayload = datePayload;
}
+ updateIssueBoardIssue () {
+ this.$loading.fadeIn();
+ this.$dropdown.trigger('loading.gl.dropdown');
+ this.$selectbox.hide();
+ this.$value.css('display', '');
+
+ gl.issueBoards.BoardsStore.detail.issue.update(this.$dropdown.attr('data-issue-update'))
+ .then(() => {
+ this.$loading.fadeOut();
+ });
+ }
+
submitSelectedDate(isDropdown) {
return $.ajax({
type: 'PUT',