Commit d5358b23 authored by Dries's avatar Dries

- Patch #1216976 by cosmicdreams, DyanneNova, aspilicious, rupl, Jacine,...

- Patch #1216976 by cosmicdreams, DyanneNova, aspilicious, rupl, Jacine, mortendk, dcmouyard: clean up the CSS for Comment module.
parent 2e250c69
.indented {
margin-left: 0;
margin-right: 25px;
}
#comments {
margin-top: 15px;
}
.indented {
margin-left: 25px; /* LTR */
}
.comment-unpublished {
background-color: #fff4f4;
}
.comment-preview {
background-color: #ffffea;
}
......@@ -9,4 +9,4 @@ dependencies[] = entity
files[] = comment.entity.inc
files[] = comment.test
configure = admin/content/comment
stylesheets[all][] = comment.css
stylesheets[all][] = comment.theme.css
......@@ -2143,30 +2143,29 @@ function template_preprocess_comment(&$variables) {
// Set status to a string representation of comment->status.
if (isset($comment->in_preview)) {
$variables['status'] = 'comment-preview';
$variables['status'] = 'preview';
}
else {
$variables['status'] = ($comment->status == COMMENT_NOT_PUBLISHED) ? 'comment-unpublished' : 'comment-published';
$variables['status'] = ($comment->status == COMMENT_NOT_PUBLISHED) ? 'unpublished' : 'published';
}
// Gather comment classes.
// 'comment-published' class is not needed, it is either 'comment-preview' or
// 'comment-unpublished'.
if ($variables['status'] != 'comment-published') {
// 'published' class is not needed, it is either 'preview' or 'unpublished'.
if ($variables['status'] != 'published') {
$variables['classes_array'][] = $variables['status'];
}
if ($variables['new']) {
$variables['classes_array'][] = 'comment-new';
$variables['classes_array'][] = 'new';
}
if (!$comment->uid) {
$variables['classes_array'][] = 'comment-by-anonymous';
$variables['classes_array'][] = 'by-anonymous';
}
else {
if ($comment->uid == $variables['node']->uid) {
$variables['classes_array'][] = 'comment-by-node-author';
$variables['classes_array'][] = 'by-node-author';
}
if ($comment->uid == $variables['user']->uid) {
$variables['classes_array'][] = 'comment-by-viewer';
$variables['classes_array'][] = 'by-viewer';
}
}
}
......
......@@ -525,56 +525,56 @@ class CommentInterfaceTest extends CommentHelperCase {
// Verify classes if the comment is visible for the current user.
if ($case['comment_status'] == COMMENT_PUBLISHED || $case['user'] == 'admin') {
// Verify the comment-by-anonymous class.
$comments = $this->xpath('//*[contains(@class, "comment-by-anonymous")]');
// Verify the by-anonymous class.
$comments = $this->xpath('//*[contains(@class, "comment") and contains(@class, "by-anonymous")]');
if ($case['comment_uid'] == 0) {
$this->assertTrue(count($comments) == 1, 'comment-by-anonymous class found.');
$this->assertTrue(count($comments) == 1, 'by-anonymous class found.');
}
else {
$this->assertFalse(count($comments), 'comment-by-anonymous class not found.');
$this->assertFalse(count($comments), 'by-anonymous class not found.');
}
// Verify the comment-by-node-author class.
$comments = $this->xpath('//*[contains(@class, "comment-by-node-author")]');
// Verify the by-node-author class.
$comments = $this->xpath('//*[contains(@class, "comment") and contains(@class, "by-node-author")]');
if ($case['comment_uid'] > 0 && $case['comment_uid'] == $case['node_uid']) {
$this->assertTrue(count($comments) == 1, 'comment-by-node-author class found.');
$this->assertTrue(count($comments) == 1, 'by-node-author class found.');
}
else {
$this->assertFalse(count($comments), 'comment-by-node-author class not found.');
$this->assertFalse(count($comments), 'by-node-author class not found.');
}
// Verify the comment-by-viewer class.
$comments = $this->xpath('//*[contains(@class, "comment-by-viewer")]');
// Verify the by-viewer class.
$comments = $this->xpath('//*[contains(@class, "comment") and contains(@class, "by-viewer")]');
if ($case['comment_uid'] > 0 && $case['comment_uid'] == $case['user_uid']) {
$this->assertTrue(count($comments) == 1, 'comment-by-viewer class found.');
$this->assertTrue(count($comments) == 1, 'by-viewer class found.');
}
else {
$this->assertFalse(count($comments), 'comment-by-viewer class not found.');
$this->assertFalse(count($comments), 'by-viewer class not found.');
}
}
// Verify the comment-unpublished class.
$comments = $this->xpath('//*[contains(@class, "comment-unpublished")]');
// Verify the unpublished class.
$comments = $this->xpath('//*[contains(@class, "comment") and contains(@class, "unpublished")]');
if ($case['comment_status'] == COMMENT_NOT_PUBLISHED && $case['user'] == 'admin') {
$this->assertTrue(count($comments) == 1, 'comment-unpublished class found.');
$this->assertTrue(count($comments) == 1, 'unpublished class found.');
}
else {
$this->assertFalse(count($comments), 'comment-unpublished class not found.');
$this->assertFalse(count($comments), 'unpublished class not found.');
}
// Verify the comment-new class.
// Verify the new class.
if ($case['comment_status'] == COMMENT_PUBLISHED || $case['user'] == 'admin') {
$comments = $this->xpath('//*[contains(@class, "comment-new")]');
$comments = $this->xpath('//*[contains(@class, "comment") and contains(@class, "new")]');
if ($case['user'] != 'anonymous') {
$this->assertTrue(count($comments) == 1, 'comment-new class found.');
$this->assertTrue(count($comments) == 1, 'new class found.');
// Request the node again. The comment-new class should disappear.
// Request the node again. The new class should disappear.
$this->drupalGet('node/' . $node->nid);
$comments = $this->xpath('//*[contains(@class, "comment-new")]');
$this->assertFalse(count($comments), 'comment-new class not found.');
$comments = $this->xpath('//*[contains(@class, "comment") and contains(@class, "new")]');
$this->assertFalse(count($comments), 'new class not found.');
}
else {
$this->assertFalse(count($comments), 'comment-new class not found.');
$this->assertFalse(count($comments), 'new class not found.');
}
}
}
......@@ -1005,7 +1005,7 @@ class CommentPreviewTest extends CommentHelperCase {
$this->assertLink($test_signature);
// Check that the user picture is displayed.
$this->assertFieldByXPath("//div[contains(@class, 'comment-preview')]//div[contains(@class, 'user-picture')]//img", NULL, 'User picture displayed.');
$this->assertFieldByXPath("//div[contains(@class, 'preview')]//div[contains(@class, 'user-picture')]//img", NULL, 'User picture displayed.');
}
/**
......
......@@ -23,21 +23,20 @@
* - $user_picture: The comment author's picture from user-picture.tpl.php.
* - $signature: Authors signature.
* - $status: Comment status. Possible values are:
* comment-unpublished, comment-published or comment-preview.
* unpublished, published, or preview.
* - $title: Linked title.
* - $classes: String of classes that can be used to style contextually through
* CSS. It can be manipulated through the variable $classes_array from
* preprocess functions. The default values can be one or more of the
* following:
* - comment: The current template type, i.e., "theming hook".
* - comment-by-anonymous: Comment by an unregistered user.
* - comment-by-node-author: Comment by the author of the parent node.
* - comment-preview: When previewing a new or edited comment.
* - comment: The current template type; e.g., 'theming hook'.
* - by-anonymous: Comment by an unregistered user.
* - by-node-author: Comment by the author of the parent node.
* - preview: When previewing a new or edited comment.
* The following applies only to viewers who are registered users:
* - comment-unpublished: An unpublished comment visible only to
* administrators.
* - comment-by-viewer: Comment by the user currently viewing the page.
* - comment-new: New comment since last the visit.
* - unpublished: An unpublished comment visible only to administrators.
* - by-viewer: Comment by the user currently viewing the page.
* - new: New comment since the last visit.
* - $title_prefix (array): An array containing additional output populated by
* modules, intended to be displayed in front of the main title tag that
* appears in the template.
......
/* ------------------ Reset Styles ------------------ */
caption,
......@@ -125,7 +124,7 @@ ul.tips {
.comment ul.links li {
padding: 0 0 0.5em;
}
.comment-unpublished {
.comment.unpublished {
margin-left: 5px;
margin-right: 0;
padding: 5px 5px 5px 2px;
......
/* ---------- Overall Specifications ---------- */
body {
......@@ -716,11 +715,11 @@ ul.links {
.comment ul.links li {
padding: 0 0.5em 0 0; /* LTR */
}
.comment-unpublished {
.comment.unpublished {
margin-right: 5px; /* LTR */
padding: 5px 2px 5px 5px; /* LTR */
}
.comment-unpublished .comment-text .comment-arrow {
.comment.unpublished .comment-text .comment-arrow {
border-left: 1px solid #fff4f4;
border-right: 1px solid #fff4f4;
}
......
......@@ -23,19 +23,19 @@
* - $picture: Authors picture.
* - $signature: Authors signature.
* - $status: Comment status. Possible values are:
* comment-unpublished, comment-published or comment-preview.
* unpublished, published, or preview.
* - $title: Linked title.
* - $classes: String of classes that can be used to style contextually through
* CSS. It can be manipulated through the variable $classes_array from
* preprocess functions. The default values can be one or more of the following:
* - comment: The current template type, i.e., "theming hook".
* - comment-by-anonymous: Comment by an unregistered user.
* - comment-by-node-author: Comment by the author of the parent node.
* - comment-preview: When previewing a new or edited comment.
* - comment: The current template type; e.g., 'theming hook'.
* - by-anonymous: Comment by an unregistered user.
* - by-node-author: Comment by the author of the parent node.
* - preview: When previewing a new or edited comment.
* The following applies only to viewers who are registered users:
* - comment-unpublished: An unpublished comment visible only to administrators.
* - comment-by-viewer: Comment by the user currently viewing the page.
* - comment-new: New comment since last the visit.
* - unpublished: An unpublished comment visible only to administrators.
* - by-viewer: Comment by the user currently viewing the page.
* - new: New comment since the last visit.
* - $title_prefix (array): An array containing additional output populated by
* modules, intended to be displayed in front of the main title tag that
* appears in the template.
......
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