Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
673806a2
Commit
673806a2
authored
Aug 09, 2016
by
Luke Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some more styling tweaks and added jasmine test
parent
1e6d8a38
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
74 additions
and
8 deletions
+74
-8
app/assets/javascripts/abuse_reports.js.es6
app/assets/javascripts/abuse_reports.js.es6
+3
-2
app/assets/stylesheets/pages/admin.scss
app/assets/stylesheets/pages/admin.scss
+10
-3
app/views/admin/abuse_reports/_abuse_report.html.haml
app/views/admin/abuse_reports/_abuse_report.html.haml
+4
-3
spec/javascripts/abuse_reports_spec.js.es6
spec/javascripts/abuse_reports_spec.js.es6
+41
-0
spec/javascripts/fixtures/abuse_reports.html.haml
spec/javascripts/fixtures/abuse_reports.html.haml
+16
-0
No files found.
app/assets/javascripts/abuse_reports.js.es6
View file @
673806a2
window.gl = window.gl || {};
((global) => {
((global) => {
const MAX_MESSAGE_LENGTH = 500;
const MAX_MESSAGE_LENGTH = 500;
const MESSAGE_CELL_SELECTOR = '.abuse-reports .message';
const MESSAGE_CELL_SELECTOR = '.abuse-reports .message';
...
@@ -16,7 +17,7 @@
...
@@ -16,7 +17,7 @@
if (reportMessage.length > MAX_MESSAGE_LENGTH) {
if (reportMessage.length > MAX_MESSAGE_LENGTH) {
$messageCellElement.data('original-message', reportMessage);
$messageCellElement.data('original-message', reportMessage);
$messageCellElement.data('message-truncated', 'true');
$messageCellElement.data('message-truncated', 'true');
$messageCellElement.text(`${reportMessage.substr(0,
MAX_MESSAGE_LENGTH
)}...`);
$messageCellElement.text(`${reportMessage.substr(0,
(MAX_MESSAGE_LENGTH - 3)
)}...`);
}
}
}
}
...
@@ -29,7 +30,7 @@
...
@@ -29,7 +30,7 @@
$messageCellElement.text(originalMessage);
$messageCellElement.text(originalMessage);
} else {
} else {
$messageCellElement.data('message-truncated', 'true');
$messageCellElement.data('message-truncated', 'true');
$messageCellElement.text(`${originalMessage.substr(0,
MAX_MESSAGE_LENGTH
)}...`);
$messageCellElement.text(`${originalMessage.substr(0,
(MAX_MESSAGE_LENGTH - 3)
)}...`);
}
}
}
}
}
}
...
...
app/assets/stylesheets/pages/admin.scss
View file @
673806a2
...
@@ -99,10 +99,16 @@
...
@@ -99,10 +99,16 @@
}
}
.abuse-reports
{
.abuse-reports
{
.table
{
table-layout
:
fixed
;
table-layout
:
fixed
;
.action-buttons
a
{
white-space
:
normal
;
}
}
.subheading
{
padding-bottom
:
$gl-padding
;
}
.message
{
word-wrap
:
break-word
;
}
th
{
th
{
width
:
15%
;
width
:
15%
;
&
.wide
{
&
.wide
{
...
@@ -118,6 +124,7 @@
...
@@ -118,6 +124,7 @@
float
:
left
;
float
:
left
;
}
}
}
}
.no-reports
{
.no-reports
{
.emoji-icon
{
.emoji-icon
{
margin-left
:
$btn-side-margin
;
margin-left
:
$btn-side-margin
;
...
...
app/views/admin/abuse_reports/_abuse_report.html.haml
View file @
673806a2
-
reporter
=
abuse_report
.
reporter
-
reporter
=
abuse_report
.
reporter
-
user
=
abuse_report
.
user
-
user
=
abuse_report
.
user
%tr
%tr
%th
.visible-xs-block.visible-sm-block
User
%th
.visible-xs-block.visible-sm-block
%strong
User
%td
%td
-
if
user
-
if
user
=
link_to
user
.
name
,
user
=
link_to
user
.
name
,
user
...
@@ -10,7 +11,7 @@
...
@@ -10,7 +11,7 @@
-
else
-
else
(removed)
(removed)
%td
%td
%strong
.visible-xs-block.visible-sm-block
Reported by
%strong
.
subheading.
visible-xs-block.visible-sm-block
Reported by
-
if
reporter
-
if
reporter
=
link_to
reporter
.
name
,
reporter
=
link_to
reporter
.
name
,
reporter
-
else
-
else
...
@@ -18,7 +19,7 @@
...
@@ -18,7 +19,7 @@
.light.small
.light.small
=
time_ago_with_tooltip
(
abuse_report
.
created_at
)
=
time_ago_with_tooltip
(
abuse_report
.
created_at
)
%td
%td
%strong
.visible-xs-block.visible-sm-block
Message
%strong
.
subheading.
visible-xs-block.visible-sm-block
Message
.message
.message
=
markdown
(
abuse_report
.
message
.
squish!
,
pipeline: :single_line
,
author:
reporter
)
=
markdown
(
abuse_report
.
message
.
squish!
,
pipeline: :single_line
,
author:
reporter
)
%td
%td
...
...
spec/javascripts/abuse_reports_spec.js.es6
0 → 100644
View file @
673806a2
/*= require abuse_reports */
/*= require jquery */
((global) => {
const FIXTURE = 'abuse_reports.html';
const MAX_MESSAGE_LENGTH = 500;
function assertMaxLength($message) {
expect($message.text().length).toEqual(MAX_MESSAGE_LENGTH);
}
describe('Abuse Reports', function() {
fixture.preload(FIXTURE);
beforeEach(function() {
fixture.load(FIXTURE);
new global.AbuseReports();
});
it('should truncate long messages', function() {
const $longMessage = $('#long');
expect($longMessage.data('original-message')).toEqual(jasmine.anything());
assertMaxLength($longMessage);
});
it('should not truncate short messages', function() {
const $shortMessage = $('#short');
expect($shortMessage.data('original-message')).not.toEqual(jasmine.anything());
});
it('should allow clicking a truncated message to expand and collapse the full message', function() {
const $longMessage = $('#long');
$longMessage.click();
expect($longMessage.data('original-message').length).toEqual($longMessage.text().length);
$longMessage.click();
assertMaxLength($longMessage);
});
});
})(window.gl);
spec/javascripts/fixtures/abuse_reports.html.haml
0 → 100644
View file @
673806a2
.abuse-reports
.message
#long
Cat ipsum dolor sit amet, hide head under blanket so no one can see.
Gate keepers of hell eat and than sleep on your face but hunt by meowing
loudly at 5am next to human slave food dispenser cats go for world
domination or chase laser, yet poop on grasses chirp at birds. Cat is love,
cat is life chase after silly colored fish toys around the house climb a
tree, wait for a fireman jump to fireman then scratch his face fall asleep
on the washing machine lies down always hungry so caticus cuteicus. Sit on
human. Spot something, big eyes, big eyes, crouch, shake butt, prepare to
pounce sleep in the bathroom sink hiss at vacuum cleaner hide head under
blanket so no one can see throwup on your pillow.
.message
#short
Cat ipsum dolor sit amet, groom yourself 4 hours - checked, have your
beauty sleep 18 hours - checked, be fabulous for the rest of the day -
checked! for shake treat bag.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment