summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/comment_type_toggle.js
diff options
context:
space:
mode:
authorAlfredo Sumaran <alfredo@gitlab.com>2017-04-05 20:11:38 -0500
committerAlfredo Sumaran <alfredo@gitlab.com>2017-04-05 23:01:43 -0500
commit9ee6b0ce8f6a772a5f19def7d840fe96b3d0fca6 (patch)
tree0f789385dbc8e6ba7d5ff79a1b0c92edd5f8733b /app/assets/javascripts/comment_type_toggle.js
parent46f3e37ddf8625add29939868f189dc4db5336d6 (diff)
downloadgitlab-ce-9ee6b0ce8f6a772a5f19def7d840fe96b3d0fca6.tar.gz
Display secondary button only in resolvable noteables
Diffstat (limited to 'app/assets/javascripts/comment_type_toggle.js')
-rw-r--r--app/assets/javascripts/comment_type_toggle.js27
1 files changed, 16 insertions, 11 deletions
diff --git a/app/assets/javascripts/comment_type_toggle.js b/app/assets/javascripts/comment_type_toggle.js
index 75b6f60cabb..df337441a40 100644
--- a/app/assets/javascripts/comment_type_toggle.js
+++ b/app/assets/javascripts/comment_type_toggle.js
@@ -12,19 +12,24 @@ class CommentTypeToggle {
initDroplab() {
this.droplab = new DropLab();
- this.droplab.init(this.trigger, this.list, [InputSetter], {
- InputSetter: [{
- input: this.input,
- valueAttribute: 'data-value',
- },
- {
- input: this.button,
- valueAttribute: 'data-button-text',
- },
- {
+
+ const inputSetterConfig = [{
+ input: this.input,
+ valueAttribute: 'data-value',
+ },
+ {
+ input: this.button,
+ valueAttribute: 'data-button-text',
+ }];
+ if (this.secondaryButton) {
+ inputSetterConfig.push({
input: this.secondaryButton,
valueAttribute: 'data-secondary-button-text',
- }],
+ });
+ }
+
+ this.droplab.init(this.trigger, this.list, [InputSetter], {
+ InputSetter: inputSetterConfig
});
}
}