Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Related Question Stats - Sidebar #998

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions qa-include/plugins/qa-widget-related-qs.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,14 @@ public function output_widget($region, $place, $themeobject, $template, $request
$themeobject->output('<ul class="qa-related-q-list">');

foreach ($questions as $question) {
$selectedClass = isset($question['selchildid']) ? ' qa-a-count-selected' : '';
$qaLangACountArray = ($question['acount'] == 1) ? qa_lang_html_sub_split('main/1_answer', '1', '1')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using qa_lang_html_sub instead of qa_lang_html_sub_split should simplify the code a little bit.

BTW, you can keep the same PR and either add a new commit or amend the current one and force push it in the same branch

: qa_lang_html_sub_split('main/x_answers', qa_format_number($question['acount'], 0, true));
$qaLangAnswers = implode('', $qaLangACountArray);

$themeobject->output(
'<li class="qa-related-q-item">' .
'<span class="qa-related-q-item-stats'. $selectedClass .'" title="'.$qaLangAnswers.'">' . qa_html($question['acount']) . '</span>' .
'<a href="' . qa_q_path_html($question['postid'], $question['title']) . '">' .
qa_html($question['title']) .
'</a>' .
Expand Down
22 changes: 21 additions & 1 deletion qa-theme/Candy/qa-styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,27 @@ h2 {font-size:22px; color:#c659ab; padding-top:12px; clear:both;}
.qa-related-qs {font-size:14px;}
.qa-related-qs h2 {font-size:18px;}
.qa-related-q-list {list-style-type:none; padding:0;}
.qa-related-q-item {margin:0.5em 0; word-wrap: break-word;}
.qa-related-q-item {
display: flex;
padding: 5px 0;
word-wrap: break-word;
border-bottom: 1px solid #e0e0e0;
}
.qa-related-q-item-stats {
flex-shrink: 0;
background-color: #ecf0f1;
width: 28px;
height: 18px;
vertical-align: top;
text-align: center;
margin-top: 2px;
margin-inline-end: .6rem;
border-radius: 3px;
}
.qa-related-q-item .qa-a-count-selected {
background-color: #27ae60;
color: #fff;
}
.qa-activity-count {font-size:14px;}
.qa-activity-count-item {margin:0.5em 0;}
.qa-activity-count-data {font-size:24px; font-weight:bold;}
Expand Down
22 changes: 21 additions & 1 deletion qa-theme/Classic/qa-styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,27 @@ h2 {font-size:16px; padding-top:12px; clear:both;}
/* Related questions and activity count widgets */

.qa-related-q-list {list-style-type:none; padding:0;}
.qa-related-q-item {margin:0.5em 0; word-wrap: break-word;}
.qa-related-q-item {
display: flex;
padding: 5px 0;
word-wrap: break-word;
border-bottom: 1px solid #e0e0e0;
}
.qa-related-q-item-stats {
flex-shrink: 0;
background-color: #ecf0f1;
width: 28px;
height: 18px;
vertical-align: top;
text-align: center;
margin-top: 2px;
margin-inline-end: .6rem;
border-radius: 3px;
}
.qa-related-q-item .qa-a-count-selected {
background-color: #27ae60;
color: #fff;
}
.qa-activity-count {font-size:150%;}
.qa-activity-count-item {margin:0.25em 0;}
.qa-activity-count-data {font-weight:bold;}
Expand Down
14 changes: 13 additions & 1 deletion qa-theme/Snow/qa-styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ div.header-banner {
border: 1px solid #ffd196;
}

.qa-a-count-selected {
.qa-a-count-selected, .qa-related-q-item-stats.qa-a-count-selected {
background: #d9f5bb;
border: 1px solid #c1daa6;
}
Expand Down Expand Up @@ -2307,11 +2307,23 @@ a.qa-browse-cat-link:visited {
}

.qa-related-q-item {
display: flex;
margin: 0;
padding: 5px 0;
border-top: 1px solid #fafafa;
border-bottom: 1px solid #ddd;
}
.qa-related-q-item-stats {
flex-shrink: 0;
background-color: #ecf0f1;
width: 28px;
height: 21px;
vertical-align: top;
text-align: center;
margin-top: 2px;
margin-inline-end: .6rem;
border-radius: 3px;
}

.qa-related-q-item:first-child {
border-top: none;
Expand Down
24 changes: 16 additions & 8 deletions qa-theme/SnowFlat/qa-styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -960,8 +960,9 @@ blockquote p {
background-color: #e74c3c;
}

.qa-a-count-selected {
.qa-a-count-selected, .qa-related-q-item-stats.qa-a-count-selected {
background-color: #27ae60;
color: #fff;
}

@media (max-width: 799px) {
Expand Down Expand Up @@ -2956,17 +2957,24 @@ input[type="submit"], button {
list-style: none;
}

.qa-related-q-item a {
display: block;
.qa-related-q-item {
display: flex;
padding: 5px 0;
border-bottom: 1px solid #e0e0e0;
}
.qa-related-q-item:first-child a {
padding-top: 0;
.qa-related-q-item:last-child {
border-bottom: none;
}
.qa-related-q-item:last-child a {
padding-bottom: 0;
border-bottom: 0;
.qa-related-q-item-stats {
flex-shrink: 0;
background-color: #ecf0f1;
width: 30px;
height: 24px;
vertical-align: top;
text-align: center;
margin-top: 2px;
margin-inline-end: .6rem;
border-radius: 3px;
}

.qa-nav-cat {
Expand Down