diff options
Diffstat (limited to 'app/assets/javascripts/pages/admin/abuse_reports/abuse_reports.js')
-rw-r--r-- | app/assets/javascripts/pages/admin/abuse_reports/abuse_reports.js | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/app/assets/javascripts/pages/admin/abuse_reports/abuse_reports.js b/app/assets/javascripts/pages/admin/abuse_reports/abuse_reports.js deleted file mode 100644 index 29e92a8abad..00000000000 --- a/app/assets/javascripts/pages/admin/abuse_reports/abuse_reports.js +++ /dev/null @@ -1,38 +0,0 @@ -import $ from 'jquery'; -import { parseBoolean } from '~/lib/utils/common_utils'; -import { truncate } from '~/lib/utils/text_utility'; - -const MAX_MESSAGE_LENGTH = 500; -const MESSAGE_CELL_SELECTOR = '.abuse-reports .message'; - -export default class AbuseReports { - constructor() { - $(MESSAGE_CELL_SELECTOR).each(this.truncateLongMessage); - $(document) - .off('click', MESSAGE_CELL_SELECTOR) - .on('click', MESSAGE_CELL_SELECTOR, this.toggleMessageTruncation); - } - - truncateLongMessage() { - const $messageCellElement = $(this); - const reportMessage = $messageCellElement.text(); - if (reportMessage.length > MAX_MESSAGE_LENGTH) { - $messageCellElement.data('originalMessage', reportMessage); - $messageCellElement.data('messageTruncated', 'true'); - $messageCellElement.text(truncate(reportMessage, MAX_MESSAGE_LENGTH)); - } - } - - toggleMessageTruncation() { - const $messageCellElement = $(this); - const originalMessage = $messageCellElement.data('originalMessage'); - if (!originalMessage) return; - if (parseBoolean($messageCellElement.data('messageTruncated'))) { - $messageCellElement.data('messageTruncated', 'false'); - $messageCellElement.text(originalMessage); - } else { - $messageCellElement.data('messageTruncated', 'true'); - $messageCellElement.text(truncate(originalMessage, MAX_MESSAGE_LENGTH)); - } - } -} |