[aur-dev] [PATCH] pkg_details.php: Show keywords
Signed-off-by: Marcel Korpel <marcel.korpel@gmail.com> --- web/html/css/aurweb.css | 13 +++++++++++++ web/template/pkg_details.php | 12 ++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/web/html/css/aurweb.css b/web/html/css/aurweb.css index a3f43bd..dfa97bd 100644 --- a/web/html/css/aurweb.css +++ b/web/html/css/aurweb.css @@ -53,6 +53,19 @@ text-align:right; } +td#keywords { + white-space: normal; +} + +.keyword { + float: left; + margin: 1px 2px 1px 0; + padding: 2px .5em; + background: #1794D1; + color: #FFF; + border-radius: 2px; +} + .text-button { background: transparent; border: none !important; diff --git a/web/template/pkg_details.php b/web/template/pkg_details.php index ae49e24..51a1029 100644 --- a/web/template/pkg_details.php +++ b/web/template/pkg_details.php @@ -189,12 +189,12 @@ $sources = pkg_sources($row["ID"]); <th><?= __('Upstream URL') . ': ' ?></th> <td><a href="<?= htmlspecialchars($row['URL'], ENT_QUOTES) ?>" title="<?= __('Visit the website for') . ' ' . htmlspecialchars( $row['Name'])?>"><?= htmlspecialchars($row['URL'], ENT_QUOTES) ?></a></td> </tr> + <tr> + <th><?= __('Keywords') . ': ' ?></th> + <td id="keywords"> <?php if (has_credential(CRED_PKGBASE_SET_KEYWORDS, array($row["MaintainerUID"]))): ?> - <tr> - <th><?= __('Keywords') . ': ' ?></th> - <td> <form method="post" action="<?= htmlspecialchars(get_pkgbase_uri($row['BaseName']), ENT_QUOTES); ?>"> <div> <input type="hidden" name="action" value="do_SetKeywords" /> @@ -205,9 +205,13 @@ if (has_credential(CRED_PKGBASE_SET_KEYWORDS, array($row["MaintainerUID"]))): <input type="submit" value="<?= __('Update') ?>"/> </div> </form> +<?php else: + foreach ($keywords as $kw) { + echo ' <span class="keyword">' . htmlspecialchars($kw) . "</span>\n"; + } + endif; ?> </td> </tr> -<?php endif; ?> <?php if (count($lics) > 0): ?> <tr> <th><?= __('Licenses') . ': ' ?></th> -- 2.4.3
* Marcel Korpel <marcel.korpel@gmail.com> (Wed, 17 Jun 2015 19:35:26 +0200):
+ foreach ($keywords as $kw) { + echo ' <span class="keyword">' . htmlspecialchars($kw) . "</span>\n"; + }
They could also be made as hyperlinks, so a user can click and start a search for other packages with the same keyword.
On 17/06, Marcel Korpel wrote:
* Marcel Korpel <marcel.korpel@gmail.com> (Wed, 17 Jun 2015 19:35:26 +0200):
+ foreach ($keywords as $kw) { + echo ' <span class="keyword">' . htmlspecialchars($kw) . "</span>\n"; + }
They could also be made as hyperlinks, so a user can click and start a search for other packages with the same keyword.
Making them links sounds great to me. -- Sincerely, Johannes Löthberg PGP Key ID: 0x50FB9B273A9D0BB5 https://theos.kyriasis.com/~kyrias/
participants (2)
-
Johannes Löthberg
-
Marcel Korpel