1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-26 05:32:59 +00:00

Style the tags in the page list

This commit is contained in:
Starbeamrainbowlabs 2015-12-12 20:11:17 +00:00
parent db931e4dd8
commit f3feec9a6e
4 changed files with 35 additions and 3 deletions

View file

@ -307,7 +307,9 @@ textarea ~ input[type=submit] { margin: 0.5rem 0.8rem; padding: 0.5rem; font-wei
.page-tags-display { margin: 0.5rem 0 0 0; padding: 0; list-style-type: none; } .page-tags-display { margin: 0.5rem 0 0 0; padding: 0; list-style-type: none; }
.page-tags-display li { display: inline-block; margin: 0.5rem; padding: 0.5rem; background: #D2C3DD; white-space: nowrap; } .page-tags-display li { display: inline-block; margin: 0.5rem; padding: 0.5rem; background: #D2C3DD; white-space: nowrap; }
.page-tags-display li a { color: #FB701A; text-decoration: none; } .page-tags-display li a { color: #FB701A; text-decoration: none; }
.page-tags-display li:before { content: \"\\A\"; position: relative; top: 0.03rem; left: -0.9rem; width: 0; height: 0; border-top: 0.6rem solid transparent; border-bottom: 0.6rem solid transparent; border-right: 0.5rem solid #D2C3DD; } .page-tags-display li::before { content: \"\\A\"; position: relative; top: 0.03rem; left: -0.9rem; width: 0; height: 0; border-top: 0.6rem solid transparent; border-bottom: 0.6rem solid transparent; border-right: 0.5rem solid #D2C3DD; }
.mini-tag { background: #d2c3dd; padding: 0.2rem 0.4rem; color: #fb701a; text-decoration: none; }
footer { padding: 2rem; } footer { padding: 2rem; }
/* #ffdb6d #36962c */"; /* #ffdb6d #36962c */";
@ -2884,14 +2886,28 @@ function generate_page_list($pagelist)
<th>Size</th> <th>Size</th>
<th>Last Editor</th> <th>Last Editor</th>
<th>Last Edit Time</th> <th>Last Edit Time</th>
<th>Tags</th>
</tr>\n"; </tr>\n";
foreach($pagelist as $pagename) foreach($pagelist as $pagename)
{ {
// Construct a list of tags that are attached to this page ready for display
$tags = "";
// Make sure that this page does actually have some tags first
if(isset($pageindex->$pagename->tags))
{
foreach($pageindex->$pagename->tags as $tag)
{
$tags .= "<a href='?action=list-tags&tag=" . rawurlencode($tag) . "' class='mini-tag'>$tag</a>, ";
}
$tags = substr($tags, 0, -2); // Remove the last ", " from the tag list
}
$result .= "\t\t<tr> $result .= "\t\t<tr>
<td><a href='index.php?page=$pagename'>$pagename</a></td> <td><a href='index.php?page=$pagename'>$pagename</a></td>
<td>" . human_filesize($pageindex->$pagename->size) . "</td> <td>" . human_filesize($pageindex->$pagename->size) . "</td>
<td>" . $pageindex->$pagename->lasteditor . "</td> <td>" . $pageindex->$pagename->lasteditor . "</td>
<td>" . human_time_since($pageindex->$pagename->lastmodified) . " <small>(" . date("l jS \of F Y \a\\t h:ia T", $pageindex->$pagename->lastmodified) . ")</small></td> <td>" . human_time_since($pageindex->$pagename->lastmodified) . " <small>(" . date("l jS \of F Y \a\\t h:ia T", $pageindex->$pagename->lastmodified) . ")</small></td>
<td>$tags</td>
</tr>\n"; </tr>\n";
} }

View file

@ -113,7 +113,7 @@
"author": "Starbeamrainbowlabs", "author": "Starbeamrainbowlabs",
"description": "Adds a page that lists all the pages in the index along with their metadata.", "description": "Adds a page that lists all the pages in the index along with their metadata.",
"id": "page-list", "id": "page-list",
"lastupdate": 1449406838, "lastupdate": 1449950909,
"optional": false "optional": false
}, },
{ {

View file

@ -77,14 +77,28 @@ function generate_page_list($pagelist)
<th>Size</th> <th>Size</th>
<th>Last Editor</th> <th>Last Editor</th>
<th>Last Edit Time</th> <th>Last Edit Time</th>
<th>Tags</th>
</tr>\n"; </tr>\n";
foreach($pagelist as $pagename) foreach($pagelist as $pagename)
{ {
// Construct a list of tags that are attached to this page ready for display
$tags = "";
// Make sure that this page does actually have some tags first
if(isset($pageindex->$pagename->tags))
{
foreach($pageindex->$pagename->tags as $tag)
{
$tags .= "<a href='?action=list-tags&tag=" . rawurlencode($tag) . "' class='mini-tag'>$tag</a>, ";
}
$tags = substr($tags, 0, -2); // Remove the last ", " from the tag list
}
$result .= "\t\t<tr> $result .= "\t\t<tr>
<td><a href='index.php?page=$pagename'>$pagename</a></td> <td><a href='index.php?page=$pagename'>$pagename</a></td>
<td>" . human_filesize($pageindex->$pagename->size) . "</td> <td>" . human_filesize($pageindex->$pagename->size) . "</td>
<td>" . $pageindex->$pagename->lasteditor . "</td> <td>" . $pageindex->$pagename->lasteditor . "</td>
<td>" . human_time_since($pageindex->$pagename->lastmodified) . " <small>(" . date("l jS \of F Y \a\\t h:ia T", $pageindex->$pagename->lastmodified) . ")</small></td> <td>" . human_time_since($pageindex->$pagename->lastmodified) . " <small>(" . date("l jS \of F Y \a\\t h:ia T", $pageindex->$pagename->lastmodified) . ")</small></td>
<td>$tags</td>
</tr>\n"; </tr>\n";
} }

View file

@ -296,7 +296,9 @@ textarea ~ input[type=submit] { margin: 0.5rem 0.8rem; padding: 0.5rem; font-wei
.page-tags-display { margin: 0.5rem 0 0 0; padding: 0; list-style-type: none; } .page-tags-display { margin: 0.5rem 0 0 0; padding: 0; list-style-type: none; }
.page-tags-display li { display: inline-block; margin: 0.5rem; padding: 0.5rem; background: #D2C3DD; white-space: nowrap; } .page-tags-display li { display: inline-block; margin: 0.5rem; padding: 0.5rem; background: #D2C3DD; white-space: nowrap; }
.page-tags-display li a { color: #FB701A; text-decoration: none; } .page-tags-display li a { color: #FB701A; text-decoration: none; }
.page-tags-display li:before { content: \"\\A\"; position: relative; top: 0.03rem; left: -0.9rem; width: 0; height: 0; border-top: 0.6rem solid transparent; border-bottom: 0.6rem solid transparent; border-right: 0.5rem solid #D2C3DD; } .page-tags-display li::before { content: \"\\A\"; position: relative; top: 0.03rem; left: -0.9rem; width: 0; height: 0; border-top: 0.6rem solid transparent; border-bottom: 0.6rem solid transparent; border-right: 0.5rem solid #D2C3DD; }
.mini-tag { background: #d2c3dd; padding: 0.2rem 0.4rem; color: #fb701a; text-decoration: none; }
footer { padding: 2rem; } footer { padding: 2rem; }
/* #ffdb6d #36962c */"; /* #ffdb6d #36962c */";