Commit 426ba54c by Scott

More styling/layout for comment voting

parent 2797e942
...@@ -475,14 +475,22 @@ function qa_post_html_fields($post, $userid, $cookieid, $usershtml, $dummy, $opt ...@@ -475,14 +475,22 @@ function qa_post_html_fields($post, $userid, $cookieid, $usershtml, $dummy, $opt
$fields['vote_on_page'] = strpos($voteview, '-disabled-page') ? 'disabled' : 'enabled'; $fields['vote_on_page'] = strpos($voteview, '-disabled-page') ? 'disabled' : 'enabled';
$fields['upvotes_view'] = ($upvotes == 1) ? qa_lang_html_sub_split('main/1_liked', $upvoteshtml, '1') if ($iscomment) {
: qa_lang_html_sub_split('main/x_liked', $upvoteshtml); // for comments just show number, no additional text
$fields['upvotes_view'] = array('prefix' => '', 'data' => $upvoteshtml, 'suffix' => '');
$fields['downvotes_view'] = ($downvotes == 1) ? qa_lang_html_sub_split('main/1_disliked', $downvoteshtml, '1') $fields['downvotes_view'] = array('prefix' => '', 'data' => $downvoteshtml, 'suffix' => '');
: qa_lang_html_sub_split('main/x_disliked', $downvoteshtml); $fields['netvotes_view'] = array('prefix' => '', 'data' => $netvoteshtml, 'suffix' => '');
} else {
$fields['netvotes_view'] = ($netvotes == 1) ? qa_lang_html_sub_split('main/1_vote', $netvoteshtml, '1') $fields['upvotes_view'] = $upvotes == 1
: qa_lang_html_sub_split('main/x_votes', $netvoteshtml); ? qa_lang_html_sub_split('main/1_liked', $upvoteshtml, '1')
: qa_lang_html_sub_split('main/x_liked', $upvoteshtml);
$fields['downvotes_view'] = $downvotes == 1
? qa_lang_html_sub_split('main/1_disliked', $downvoteshtml, '1')
: qa_lang_html_sub_split('main/x_disliked', $downvoteshtml);
$fields['netvotes_view'] = $netvotes == 1
? qa_lang_html_sub_split('main/1_vote', $netvoteshtml, '1')
: qa_lang_html_sub_split('main/x_votes', $netvoteshtml);
}
// schema.org microdata - vote display might be formatted (e.g. '2k') so we use meta tag for true count // schema.org microdata - vote display might be formatted (e.g. '2k') so we use meta tag for true count
if ($microdata) { if ($microdata) {
......
...@@ -1804,8 +1804,9 @@ class qa_html_theme_base ...@@ -1804,8 +1804,9 @@ class qa_html_theme_base
if ($post['vote_view'] == 'updown') { if ($post['vote_view'] == 'updown') {
$this->output_split($post['upvotes_view'], 'qa-upvote-count'); $this->output_split($post['upvotes_view'], 'qa-upvote-count');
$this->output_split($post['downvotes_view'], 'qa-downvote-count'); $this->output_split($post['downvotes_view'], 'qa-downvote-count');
} else } else {
$this->output_split($post['netvotes_view'], 'qa-netvote-count'); $this->output_split($post['netvotes_view'], 'qa-netvote-count');
}
$this->output('</div>'); $this->output('</div>');
} }
......
...@@ -2618,11 +2618,21 @@ input[type="submit"], button { ...@@ -2618,11 +2618,21 @@ input[type="submit"], button {
} }
.qa-c-list-item .qa-netvote-count-data { .qa-c-list-item .qa-netvote-count-data {
font-size: 13px; font-size: 13px;
line-height: 20px; line-height: 18px;
} }
/*.qa-c-list-item .qa-netvote-count-pad {
display: none; .qa-c-list-item .qa-upvote-count {
}*/ line-height: 6px;
}
.qa-c-list-item .qa-downvote-count {
line-height: 14px;
}
.qa-c-list-item .qa-upvote-count-data,
.qa-c-list-item .qa-downvote-count-data {
font-size: 13px;
font-weight: normal;
}
.qa-c-list-item .qa-vote-up-button, .qa-c-list-item .qa-vote-up-button,
.qa-c-list-item .qa-vote-down-button, .qa-c-list-item .qa-vote-down-button,
......
...@@ -490,6 +490,19 @@ class qa_html_theme extends qa_html_theme_base ...@@ -490,6 +490,19 @@ class qa_html_theme extends qa_html_theme_base
} }
/** /**
* Hide votes when zero
* @param array $post
*/
public function vote_count($post)
{
if ($post['raw']['basetype'] === 'C' && $post['netvotes_view']['data'] == 0) {
$post['netvotes_view']['data'] = '';
}
parent::vote_count($post);
}
/**
* Move user whometa to top in answer * Move user whometa to top in answer
* *
* @since Snow 1.4 * @since Snow 1.4
......
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