summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke "Jared" Bennett <lbennett@gitlab.com>2017-04-15 15:55:17 +0100
committerLuke "Jared" Bennett <lbennett@gitlab.com>2017-04-15 15:55:17 +0100
commitc94f0c72ce2032905d45b0da4e1ec3668e4d2680 (patch)
tree77f869e36e7b4005c5e691e31266c0b7fcb91806
parent309bab431075eabfb7a01300f946ce9eb5b6fb98 (diff)
downloadgitlab-ce-c94f0c72ce2032905d45b0da4e1ec3668e4d2680.tar.gz
Added allowEmpty config property
-rw-r--r--app/assets/javascripts/comment_type_toggle.js1
-rw-r--r--app/assets/javascripts/droplab/plugins/input_setter.js3
2 files changed, 4 insertions, 0 deletions
diff --git a/app/assets/javascripts/comment_type_toggle.js b/app/assets/javascripts/comment_type_toggle.js
index df0ba86198c..c175f89c4fa 100644
--- a/app/assets/javascripts/comment_type_toggle.js
+++ b/app/assets/javascripts/comment_type_toggle.js
@@ -24,6 +24,7 @@ class CommentTypeToggle {
InputSetter: [{
input: this.noteTypeInput,
valueAttribute: 'data-value',
+ allowEmpty: true,
},
{
input: this.submitButton,
diff --git a/app/assets/javascripts/droplab/plugins/input_setter.js b/app/assets/javascripts/droplab/plugins/input_setter.js
index d01fbc5830d..0736d525f40 100644
--- a/app/assets/javascripts/droplab/plugins/input_setter.js
+++ b/app/assets/javascripts/droplab/plugins/input_setter.js
@@ -35,6 +35,9 @@ const InputSetter = {
const newValue = selectedItem.getAttribute(config.valueAttribute);
const inputAttribute = config.inputAttribute;
+ console.log('newValue', newValue, 'allowEmpty', config.allowEmpty);
+ if (!newValue && !config.allowEmpty) return;
+
if (input.hasAttribute(inputAttribute)) return input.setAttribute(inputAttribute, newValue);
if (input.tagName === 'INPUT') return input.value = newValue;
return input.textContent = newValue;