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.js38
1 files changed, 21 insertions, 17 deletions
diff --git a/app/assets/javascripts/comment_type_toggle.js b/app/assets/javascripts/comment_type_toggle.js
index ba3b43b201d..de9dc5979a3 100644
--- a/app/assets/javascripts/comment_type_toggle.js
+++ b/app/assets/javascripts/comment_type_toggle.js
@@ -31,23 +31,27 @@ class CommentTypeToggle {
}],
};
- if (!this.closeButton || !this.reopenButton) return config;
-
- config.InputSetter.push({
- input: this.closeButton,
- valueAttribute: 'data-close-text',
- }, {
- input: this.closeButton,
- valueAttribute: 'data-close-text',
- inputAttribute: 'data-alternative-text',
- }, {
- input: this.reopenButton,
- valueAttribute: 'data-reopen-text',
- }, {
- input: this.reopenButton,
- valueAttribute: 'data-reopen-text',
- inputAttribute: 'data-alternative-text',
- });
+ if (this.closeButton) {
+ config.InputSetter.push({
+ input: this.closeButton,
+ valueAttribute: 'data-close-text',
+ }, {
+ input: this.closeButton,
+ valueAttribute: 'data-close-text',
+ inputAttribute: 'data-alternative-text',
+ });
+ }
+
+ if (this.reopenButton) {
+ config.InputSetter.push({
+ input: this.reopenButton,
+ valueAttribute: 'data-reopen-text',
+ }, {
+ input: this.reopenButton,
+ valueAttribute: 'data-reopen-text',
+ inputAttribute: 'data-alternative-text',
+ });
+ }
return config;
}