Selaa lähdekoodia

! Now, let's add Gary's new icons in, let's make a sprite out of them, and while we're at it, let's make it slightly more encouraging for guests by showing guests the 'new items' behaviour even if in reality it isn't.

Signed-off-by: Peter Spicer <[email protected]>
Peter Spicer 10 vuotta sitten
vanhempi
commit
2720bd8699

+ 26 - 1
Sources/Subs-BoardIndex.php

@@ -153,8 +153,26 @@ function getBoardIndex($boardIndexOptions)
 					'unapproved_posts' => $row_board['unapproved_posts'] - $row_board['unapproved_topics'],
 					'can_approve_posts' => !empty($user_info['mod_cache']['ap']) && ($user_info['mod_cache']['ap'] == array(0) || in_array($row_board['id_board'], $user_info['mod_cache']['ap'])),
 					'href' => $scripturl . '?board=' . $row_board['id_board'] . '.0',
-					'link' => '<a href="' . $scripturl . '?board=' . $row_board['id_board'] . '.0">' . $row_board['board_name'] . '</a>'
+					'link' => '<a href="' . $scripturl . '?board=' . $row_board['id_board'] . '.0">' . $row_board['board_name'] . '</a>',
+					'board_class' => 'off',
 				);
+
+				// We can do some of the figuring-out-what-icon now.
+				// For certain types of thing we also set up what the tooltip is.
+				if ($this_category[$row_board['id_board']]['is_redirect'])
+				{
+					$this_category[$row_board['id_board']]['board_class'] = 'redirect';
+				}
+				elseif ($this_category[$row_board['id_board']]['new'] || $context['user']['is_guest'])
+				{
+					// If we're showing to guests, we want to give them the idea that something interesting is going on!
+					$this_category[$row_board['id_board']]['board_class'] = 'on';
+					$this_category[$row_board['id_board']]['board_tooltip'] = $txt['new_posts'];
+				}
+				else
+				{
+					$this_category[$row_board['id_board']]['board_tooltip'] = $txt['old_posts'];
+				}
 			}
 			if (!empty($row_board['id_moderator']))
 			{
@@ -215,6 +233,13 @@ function getBoardIndex($boardIndexOptions)
 			// Does this board contain new boards?
 			$this_category[$row_board['id_parent']]['children_new'] |= empty($row_board['is_read']);
 
+			// Update the icon if appropriate
+			if ($this_category[$row_board['id_parent']]['board_class'] == 'off')
+			{
+				$this_category[$row_board['id_parent']]['board_class'] = 'on2';
+				$this_category[$row_board['id_parent']]['board_tooltip'] = $txt['new_posts'];
+			}
+
 			// This is easier to use in many cases for the theme....
 			$this_category[$row_board['id_parent']]['link_children'][] = &$this_category[$row_board['id_parent']]['children'][$row_board['id_board']]['link'];
 		}

+ 2 - 16
Themes/default/BoardIndex.template.php

@@ -142,22 +142,8 @@ function template_main()
 				echo '
 				<tr id="board_', $board['id'], '" class="windowbg2">
 					<td class="windowbg icon"', !empty($board['children']) ? ' rowspan="2"' : '', '>
-						<a href="', ($board['is_redirect'] || $context['user']['is_guest'] ? $board['href'] : $scripturl . '?action=unread;board=' . $board['id'] . '.0;children'), '">';
-
-				// If the board or children is new, show an indicator.
-				if ($board['new'] || $board['children_new'])
-					echo '
-							<img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'on', $board['new'] ? '' : '2', '.png" alt="', $txt['new_posts'], '" title="', $txt['new_posts'], '" />';
-				// Is it a redirection board?
-				elseif ($board['is_redirect'])
-					echo '
-							<img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'redirect.png" alt="*" title="*" />';
-				// No new posts at all! The agony!!
-				else
-					echo '
-							<img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'off.png" alt="', $txt['old_posts'], '" title="', $txt['old_posts'], '" />';
-
-				echo '
+						<a href="', ($board['is_redirect'] || $context['user']['is_guest'] ? $board['href'] : $scripturl . '?action=unread;board=' . $board['id'] . '.0;children'), '">
+							<span class="board_', $board['board_class'], '"', !empty($board['board_tooltip']) ? ' title="' . $board['board_tooltip'] . '"' : '', '></span>
 						</a>
 					</td>
 					<td class="info">

+ 2 - 16
Themes/default/MessageIndex.template.php

@@ -35,22 +35,8 @@ function template_main()
 			echo '
 				<tr id="board_', $board['id'], '" class="windowbg2">
 					<td class="windowbg icon"', !empty($board['children']) ? ' rowspan="2"' : '', '>
-						<a href="', ($board['is_redirect'] || $context['user']['is_guest'] ? $board['href'] : $scripturl . '?action=unread;board=' . $board['id'] . '.0;children'), '">';
-
-			// If the board or children is new, show an indicator.
-			if ($board['new'] || $board['children_new'])
-				echo '
-							<img src="', $settings['images_url'], '/' .$context['theme_variant_url'], 'on', $board['new'] ? '' : '2', '.png" alt="', $txt['new_posts'], '" title="', $txt['new_posts'], '" />';
-			// Is it a redirection board?
-			elseif ($board['is_redirect'])
-				echo '
-							<img src="', $settings['images_url'], '/' .$context['theme_variant_url'], 'redirect.png" alt="*" title="*" />';
-			// No new posts at all! The agony!!
-			else
-				echo '
-							<img src="', $settings['images_url'], '/' .$context['theme_variant_url'], 'off.png" alt="', $txt['old_posts'], '" title="', $txt['old_posts'], '" />';
-
-			echo '
+						<a href="', ($board['is_redirect'] || $context['user']['is_guest'] ? $board['href'] : $scripturl . '?action=unread;board=' . $board['id'] . '.0;children'), '">
+							<span class="board_', $board['board_class'], '"', !empty($board['board_tooltip']) ? ' title="' . $board['board_tooltip'] . '"' : '', '></span>
 						</a>
 					</td>
 					<td class="info">

+ 20 - 1
Themes/default/css/index.css

@@ -1666,7 +1666,7 @@ ul li.greeting {
 	margin: 0 0 0 1px;
 	padding: 8px 0 0 0;
 	width: 5%;
-	min-width: 50px;
+	min-width: 60px;
 	/*Top aligned is much nicer for the icon. */
 	vertical-align: top;
 	border-left: 1px solid #ddd;
@@ -1729,6 +1729,25 @@ ul li.greeting {
 	background: -webkit-linear-gradient(bottom, #FFFFFF 1%, #F1F3F5 96%);
 	background: linear-gradient(to top, #FFFFFF 1%, #F1F3F5 96%);
 }
+/* The board index and its icons. */
+.table_list .icon span {
+	background: url(../images/boardicons.png) no-repeat 0 0;
+	display: inline-block;
+	width: 45px;
+	height: 45px;
+}
+.table_list .icon span.board_on {
+	background-position: 0 0;
+}
+.table_list .icon span.board_on2 {
+	background-position: -45px 0;
+}
+.table_list .icon span.board_off {
+	background-position: 0 -45px;
+}
+.table_list .icon span.board_redirect {
+	background-position: -45px -45px;
+}
 /* Hiding unwanted border repeats. */
 .table_list .content tr:first-child .icon, .table_list .content tr:first-child .info,
 .table_list .content tr:first-child .stats, .table_list .content tr:first-child .lastpost {

BIN
Themes/default/images/boardicons.png


BIN
Themes/default/images/off.png


BIN
Themes/default/images/on.png


BIN
Themes/default/images/on2.png


BIN
Themes/default/images/redirect.png