diff options
author | Luke Bennett <lukeeeebennettplus@gmail.com> | 2016-08-18 14:22:14 +0100 |
---|---|---|
committer | Luke Bennett <lukeeeebennettplus@gmail.com> | 2016-08-18 14:22:14 +0100 |
commit | 32060d45a2ceea3dc3e367e6b489cd94967c76c5 (patch) | |
tree | 245705404e30ac7eb81473af52c2981b8369cdfb | |
parent | d8f88aa4101e654982a4d941742d07a299a472f9 (diff) | |
download | gitlab-ce-13664-abuse-report-page-should-have-a-maximum-width.tar.gz |
Moved truncation method chain to utility method13664-abuse-report-page-should-have-a-maximum-width
-rw-r--r-- | app/assets/javascripts/abuse_reports.js.es6 | 2 | ||||
-rw-r--r-- | app/assets/javascripts/lib/utils/text_utility.js | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/app/assets/javascripts/abuse_reports.js.es6 b/app/assets/javascripts/abuse_reports.js.es6 index f51a5121399..748084b0307 100644 --- a/app/assets/javascripts/abuse_reports.js.es6 +++ b/app/assets/javascripts/abuse_reports.js.es6 @@ -17,7 +17,7 @@ window.gl = window.gl || {}; if (reportMessage.length > MAX_MESSAGE_LENGTH) { $messageCellElement.data('original-message', reportMessage); $messageCellElement.data('message-truncated', 'true'); - $messageCellElement.text(`${reportMessage.substr(0, (MAX_MESSAGE_LENGTH - 3))}...`); + $messageCellElement.text(global.text.truncate(reportMessage, MAX_MESSAGE_LENGTH)); } } diff --git a/app/assets/javascripts/lib/utils/text_utility.js b/app/assets/javascripts/lib/utils/text_utility.js index 130479642f3..b6636de5767 100644 --- a/app/assets/javascripts/lib/utils/text_utility.js +++ b/app/assets/javascripts/lib/utils/text_utility.js @@ -104,9 +104,12 @@ return self.updateText($this.closest('.md-area').find('textarea'), $this.data('md-tag'), $this.data('md-block'), !$this.data('md-prepend')); }); }; - return gl.text.removeListeners = function(form) { + gl.text.removeListeners = function(form) { return $('.js-md', form).off(); }; + return gl.text.truncate = function(string, maxLength) { + return string.substr(0, (maxLength - 3)) + '...'; + }; })(window); }).call(this); |