Pārlūkot izejas kodu

Redirect Childboards + Short Description

This is another piece of my "A massive commit" commit that adds short
descriptions of child boards that are also a redirect:

!enhancement - Added "short_description" for boards, and utilized
"short_description" for the title="" of child boards that are redirects
so that when you mouseover them, you also see a "short" description of
the redirect without having to enter the parent. I set the length on
shorten_subject(); to 128 for now, but can definitely be lowered later
if we feel necessary.

Signed-off-by: emanuele <[email protected]>
Matthew Kerle 12 gadi atpakaļ
vecāks
revīzija
ec4ae041bc

+ 1 - 0
Sources/Subs-BoardIndex.php

@@ -172,6 +172,7 @@ function getBoardIndex($boardIndexOptions)
 				'id' => $row_board['id_board'],
 				'name' => $row_board['board_name'],
 				'description' => $row_board['description'],
+				'short_description' => shorten_subject(strip_tags($row_board['description']), 128),
 				'new' => empty($row_board['is_read']) && $row_board['poster_name'] != '',
 				'topics' => $row_board['num_topics'],
 				'posts' => $row_board['num_posts'],

+ 1 - 1
Themes/default/BoardIndex.template.php

@@ -191,7 +191,7 @@ function template_main()
 						if (!$child['is_redirect'])
 							$child['link'] = '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="board_new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . ($child['new'] ? '</a> <a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><span class="new_posts">' . $txt['new'] . '</span>' : '') . '</a>';
 						else
-							$child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . '">' . $child['name'] . '</a>';
+							$child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . ' - ' . $child['short_description'] . '">' . $child['name'] . '</a>';
 
 						// Has it posts awaiting approval?
 						if ($child['can_approve_posts'] && ($child['unapproved_posts'] || $child['unapproved_topics']))