From cc292f7a72d10b9c8c6473e3df5729da8185ee5f Mon Sep 17 00:00:00 2001 From: Malfurious Date: Mon, 27 Sep 2021 18:17:08 -0400 Subject: pad: Add link to pad owner It is annoying to have to manually navigate back to the group page that contains the pad you're currently viewing, since it involves more than a single click to go up one level in the object hierarchy. This patch adds the owner name to the display at the top of each pad, as a hyperlink. If the owner is a group, following the link will take you to the group page. If the owner is _your own_ user, following the link will take you to the 'My Pads' page. Otherwise, it leads nowhere. Signed-off-by: Malfurious --- app/model/pad.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'app/model') diff --git a/app/model/pad.php b/app/model/pad.php index 0090c27..e11a644 100644 --- a/app/model/pad.php +++ b/app/model/pad.php @@ -18,6 +18,21 @@ $pad = getPageObj(); $stages = $pad->getStages(); $stages = array_reverse($stages); +$owner = $pad->getOwner(); + +if (obj::typeOf($owner->guid) === "user") +{ + $owner_glyph = "glyphicon-user"; + $owner_url = (user::getCurrent()->guid === $owner->guid ? "pads" : "#"); + $owner_name = $owner->name; +} +else +{ + $owner_glyph = "glyphicon-th"; + $owner_url = $owner->guid; + $owner_name = $owner->name; +} + $issues = array(); foreach ($stages as $s) -- cgit v1.2.3