summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/create_label.js
diff options
context:
space:
mode:
authorTucker Chapman <tucker.r.chapman@gmail.com>2019-04-05 15:50:21 +0000
committerPhil Hughes <me@iamphill.com>2019-04-05 15:50:21 +0000
commitcca4a5fd37b18590767f1ff8d2e2240f06060c0d (patch)
tree64bb5d7c17ad98bc7bd1e662b1b0019416281305 /app/assets/javascripts/create_label.js
parente4a371582cf044dc3027f48cb923c8c7309a7b6d (diff)
downloadgitlab-ce-cca4a5fd37b18590767f1ff8d2e2240f06060c0d.tar.gz
Add checkbox to choose to create new list when creating new label
Diffstat (limited to 'app/assets/javascripts/create_label.js')
-rw-r--r--app/assets/javascripts/create_label.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/assets/javascripts/create_label.js b/app/assets/javascripts/create_label.js
index 28ca7d97314..eac0e37bcaa 100644
--- a/app/assets/javascripts/create_label.js
+++ b/app/assets/javascripts/create_label.js
@@ -14,6 +14,7 @@ export default class CreateLabelDropdown {
this.$newLabelField = $('#new_label_name', this.$el);
this.$newColorField = $('#new_label_color', this.$el);
this.$colorPreview = $('.js-dropdown-label-color-preview', this.$el);
+ this.$addList = $('.js-add-list', this.$el);
this.$newLabelError = $('.js-label-error', this.$el);
this.$newLabelCreateButton = $('.js-new-label-btn', this.$el);
this.$colorSuggestions = $('.suggest-colors-dropdown a', this.$el);
@@ -21,6 +22,8 @@ export default class CreateLabelDropdown {
this.$newLabelError.hide();
this.$newLabelCreateButton.disable();
+ this.addListDefault = this.$addList.is(':checked');
+
this.cleanBinding();
this.addBinding();
}
@@ -83,6 +86,8 @@ export default class CreateLabelDropdown {
this.$newColorField.val('').trigger('change');
+ this.$addList.prop('checked', this.addListDefault);
+
this.$colorPreview
.css('background-color', '')
.parent()
@@ -116,9 +121,9 @@ export default class CreateLabelDropdown {
this.$newLabelError.html(errors).show();
} else {
+ const addNewList = this.$addList.is(':checked');
this.$dropdownBack.trigger('click');
-
- $(document).trigger('created.label', label);
+ $(document).trigger('created.label', [label, addNewList]);
}
},
);