summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/comment_type_toggle.js
diff options
context:
space:
mode:
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
});
}
}