Commit ff3dc13f authored by Luke "Jared" Bennett's avatar Luke "Jared" Bennett Committed by Luke Bennett

Review changes

parent 6b7c0a93
class @AbuseReports
MAX_MESSAGE_LENGTH = 300
MESSAGE_CELL_SELECTOR = 'table tbody tr td:nth-child(3)'
MESSAGE_CELL_SELECTOR = '.abuse-reports td:nth-child(3)'
constructor: ->
$(MESSAGE_CELL_SELECTOR).each @truncateLongMessage
$(document).on 'click', "#{MESSAGE_CELL_SELECTOR}", @toggleMessageTruncation
$(document)
.off 'click', MESSAGE_CELL_SELECTOR
.on 'click', MESSAGE_CELL_SELECTOR, @toggleMessageTruncation
truncateLongMessage: ->
messageCellElement = $(this)
reportMessage = messageCellElement.text()
$messageCellElement = $(this)
reportMessage = $messageCellElement.text()
if reportMessage.length > MAX_MESSAGE_LENGTH
messageCellElement.attr 'data-original-message', reportMessage
messageCellElement.attr 'data-message-truncated', 'true'
messageCellElement.text "#{reportMessage.substr 0, MAX_MESSAGE_LENGTH}..."
$messageCellElement.data 'original-message', reportMessage
$messageCellElement.data 'message-truncated', 'true'
$messageCellElement.text "#{reportMessage.substr 0, MAX_MESSAGE_LENGTH}..."
toggleMessageTruncation: ->
messageCellElement = $(this)
originalMessage = messageCellElement.attr 'data-original-message'
$messageCellElement = $(this)
originalMessage = $messageCellElement.data 'original-message'
return if not originalMessage
if messageCellElement.attr('data-message-truncated') is 'true'
messageCellElement.attr 'data-message-truncated', 'false'
messageCellElement.text originalMessage
if $messageCellElement.data('message-truncated') is 'true'
$messageCellElement.data 'message-truncated', 'false'
$messageCellElement.text originalMessage
else
messageCellElement.attr 'data-message-truncated', 'true'
messageCellElement.text "#{originalMessage.substr 0, MAX_MESSAGE_LENGTH}..."
$messageCellElement.data 'message-truncated', 'true'
$messageCellElement.text "#{originalMessage.substr 0, MAX_MESSAGE_LENGTH}..."
......@@ -100,10 +100,15 @@
.abuse-reports {
table-layout: fixed;
td {
vertical-align: top !important;
&.action-buttons a {
white-space: normal;
.action-buttons a {
white-space: normal;
}
@media (min-width: $screen-sm-min) {
th {
width: 15%;
&.wide {
width: 55%;
}
}
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment