[aur-dev] [PATCH 1/2] Wrap long lines in the "Recent Updates" sidebar
* Sync the sidebar layout with archweb, use the "pkg-name" class to wrap long package names. * Move the "New!" logo to a separate column to make sure it isn't wrapped to a new line on its own. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- web/html/css/aur.css | 4 ++++ web/template/stats/updates_table.php | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/web/html/css/aur.css b/web/html/css/aur.css index 741446e..de661fc 100644 --- a/web/html/css/aur.css +++ b/web/html/css/aur.css @@ -2,3 +2,7 @@ #lang_sub { float: right; } + +#pkg-updates td.pkg-new { + padding: 0 .5em; +} diff --git a/web/template/stats/updates_table.php b/web/template/stats/updates_table.php index e7ceec7..2220d6a 100644 --- a/web/template/stats/updates_table.php +++ b/web/template/stats/updates_table.php @@ -3,10 +3,13 @@ <a href="<?php echo get_uri('/rss/') ?>" title="Arch Package Updates RSS Feed" class="rss-icon"><img src="/images/feed-icon-14x14.png" alt="RSS Feed" /></a> <table> - <?php foreach ($newest_packages->getIterator() as $row): ?> + <tbody> + <?php foreach ($newest_packages->getIterator() as $row): ?> <tr> - <td> + <td class="pkg-name"> <a href="<?php echo get_pkg_uri($row["Name"]); ?>"><?php print htmlspecialchars($row["Name"]) . ' ' . htmlspecialchars($row["Version"]); ?></a> + </td> + <td class="pkg-new"> <?php if ($row["ModifiedTS"] === $row["SubmittedTS"]): ?> <img src="images/new.png" alt="New!" /> <?php endif; ?> @@ -15,5 +18,6 @@ <span><?php print gmdate("Y-m-d H:i", intval($row["ModifiedTS"])); ?></span> </td> </tr> - <?php endforeach; ?> + <?php endforeach; ?> + </tbody> </table> -- 1.7.12
* Use archweb classes for search result statistics. * Add some space between page numbers. * Display current page number instead of current item range. * Hide page numbers if the result fits into a single page. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- web/html/css/aur.css | 4 ++++ web/lib/pkgfuncs.inc.php | 6 ------ web/template/pkg_search_form.php | 4 ++-- web/template/pkg_search_results.php | 13 ++++++++----- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/web/html/css/aur.css b/web/html/css/aur.css index de661fc..dada258 100644 --- a/web/html/css/aur.css +++ b/web/html/css/aur.css @@ -3,6 +3,10 @@ float: right; } +.pkglist-nav .page { + margin: 0 .25em; +} + #pkg-updates td.pkg-new { padding: 0 .5em; } diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php index b42df4c..0c96a0b 100644 --- a/web/lib/pkgfuncs.inc.php +++ b/web/lib/pkgfuncs.inc.php @@ -639,12 +639,6 @@ function pkg_search_page($SID="", $dbh=NULL) { // figure out the results to use $first = $_GET['O'] + 1; - if (($_GET['PP'] + $_GET['O']) > $total) { - $last = $total; - } else { - $last = $_GET['PP'] + $_GET['O']; - } - # calculation of pagination links $per_page = ($_GET['PP'] > 0) ? $_GET['PP'] : 50; $current = ceil($first / $per_page); diff --git a/web/template/pkg_search_form.php b/web/template/pkg_search_form.php index 3f90088..49ca876 100644 --- a/web/template/pkg_search_form.php +++ b/web/template/pkg_search_form.php @@ -30,7 +30,7 @@ $orderby = array( 'd' => __('Descending') ); -$pages = array(50, 100, 250); +$per_page = array(50, 100, 250); ?> <div id="pkglist-search" class="box filter-criteria"> @@ -109,7 +109,7 @@ $pages = array(50, 100, 250); <div> <label for="id_per_page"><?php print __("Per page"); ?></label> <select name='PP'> - <?php foreach ($pages as $i): ?> + <?php foreach ($per_page as $i): ?> <?php if (isset($_REQUEST['PP']) && $_REQUEST['PP'] == $i): ?> <option value="<?php print $i; ?>" selected="selected"><?php print $i; ?></option> <?php else: ?> diff --git a/web/template/pkg_search_results.php b/web/template/pkg_search_results.php index 11db7a1..13e0b44 100644 --- a/web/template/pkg_search_results.php +++ b/web/template/pkg_search_results.php @@ -11,8 +11,9 @@ if (!$result): ?> <div class="box"><p><?php echo __("No packages matched your search criteria.") ?></p></div> <?php else: ?> <div id="pkglist-results" class="box"> - <div id="pkglist-stats-top"> - <p><?php echo __('%s Packages found. Showing %s - %s', $total, $first, $last) ?></p> + <div class="pkglist-stats"> + <p><?php echo __('%d packages found. Page %d of %d.', $total, $current, $pages) ?></p> + <?php if (count($templ_pages) > 1): ?> <p class="pkglist-nav"> <?php foreach ($templ_pages as $pagenr => $pagestart): ?> <?php if ($pagestart === false): ?> @@ -24,6 +25,7 @@ if (!$result): ?> <?php endif; ?> <?php endforeach; ?> </p> + <?php endif; ?> </div> <form id="pkglist-results-form" method="post" action="<?php echo get_uri('/packages/'); ?>?<?php echo htmlentities($_SERVER['QUERY_STRING']) ?>"> @@ -80,9 +82,9 @@ if (!$result): ?> </tbody> </table> - <div id="pkglist-stats-bottom"> - <p><?php echo __('%s Packages found. Showing %s - %s', $total, $first, $last) ?></p> - + <div class="pkglist-stats"> + <p><?php echo __('%d packages found. Page %d of %d.', $total, $current, $pages) ?></p> + <?php if (count($templ_pages) > 1): ?> <p class="pkglist-nav"> <?php foreach ($templ_pages as $pagenr => $pagestart): ?> <?php if ($pagestart === false): ?> @@ -94,6 +96,7 @@ if (!$result): ?> <?php endif; ?> <?php endforeach; ?> </p> + <?php endif; ?> </div> <?php if ($SID): ?> -- 1.7.12
participants (1)
-
Lukas Fleischer