mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-20 20:40:56 +01:00
Misc Phame cleanup
Summary: Ref T9360. [x] View Live useless on archived blogs [x] Edit Blog Image treatment like profiles [x] Pager next/prev should keep you on whatever view you're on [x] Unset user titles aren't falling back properly [x] Add captions to edit fields for better clarification Test Plan: Archive a blog, Edit a photo, verify pager on live and internal blogs, check empty titles, and view new edit form instructions. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T9360 Differential Revision: https://secure.phabricator.com/D16197
This commit is contained in:
parent
dc9283b85d
commit
fd0a606f79
4 changed files with 37 additions and 6 deletions
|
@ -36,7 +36,8 @@ final class PhameBlogManageController extends PhameBlogController {
|
|||
->setTag('a')
|
||||
->setText(pht('View Live'))
|
||||
->setIcon('fa-external-link')
|
||||
->setHref($blog->getLiveURI());
|
||||
->setHref($blog->getLiveURI())
|
||||
->setDisabled($blog->isArchived());
|
||||
|
||||
$header = id(new PHUIHeaderView())
|
||||
->setHeader($blog->getName())
|
||||
|
@ -46,6 +47,16 @@ final class PhameBlogManageController extends PhameBlogController {
|
|||
->setStatus($header_icon, $header_color, $header_name)
|
||||
->addActionLink($view);
|
||||
|
||||
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
||||
$viewer,
|
||||
$blog,
|
||||
PhabricatorPolicyCapability::CAN_EDIT);
|
||||
|
||||
if ($can_edit) {
|
||||
$header->setImageEditURL(
|
||||
$this->getApplicationURI('blog/picture/'.$blog->getID().'/'));
|
||||
}
|
||||
|
||||
$curtain = $this->buildCurtain($blog);
|
||||
$properties = $this->buildPropertyView($blog);
|
||||
$file = $this->buildFileView($blog);
|
||||
|
|
|
@ -118,7 +118,7 @@ final class PhamePostViewController
|
|||
array(
|
||||
$user_icon,
|
||||
' ',
|
||||
$blogger_profile->getTitle(),
|
||||
$blogger_profile->getDisplayTitle(),
|
||||
))
|
||||
->setImage($blogger->getProfileImageURI())
|
||||
->setImageHref($author_uri);
|
||||
|
@ -142,12 +142,16 @@ final class PhamePostViewController
|
|||
->setUser($viewer)
|
||||
->setObject($post);
|
||||
|
||||
$is_live = $this->getIsLive();
|
||||
$is_external = $this->getIsExternal();
|
||||
$next_view = new PhameNextPostView();
|
||||
if ($next) {
|
||||
$next_view->setNext($next->getTitle(), $next->getLiveURI());
|
||||
$next_view->setNext($next->getTitle(),
|
||||
$next->getBestURI($is_live, $is_external));
|
||||
}
|
||||
if ($prev) {
|
||||
$next_view->setPrevious($prev->getTitle(), $prev->getLiveURI());
|
||||
$next_view->setPrevious($prev->getTitle(),
|
||||
$prev->getBestURI($is_live, $is_external));
|
||||
}
|
||||
|
||||
$document->setFoot($next_view);
|
||||
|
|
|
@ -96,6 +96,10 @@ final class PhameBlogEditEngine
|
|||
id(new PhabricatorTextEditField())
|
||||
->setKey('domainFullURI')
|
||||
->setLabel(pht('Full Domain URI'))
|
||||
->setControlInstructions(pht('Set Full Domain URI if you plan to '.
|
||||
'serve this blog on another hosted domain. Parent Site Name and '.
|
||||
'Parent Site URI are optional but helpful since they provide '.
|
||||
'a link from the blog back to your parent site.'))
|
||||
->setDescription(pht('Blog full domain URI.'))
|
||||
->setConduitDescription(pht('Change the blog full domain URI.'))
|
||||
->setConduitTypeDescription(pht('New blog full domain URI.'))
|
||||
|
@ -103,7 +107,7 @@ final class PhameBlogEditEngine
|
|||
->setTransactionType(PhameBlogTransaction::TYPE_FULLDOMAIN),
|
||||
id(new PhabricatorTextEditField())
|
||||
->setKey('parentSite')
|
||||
->setLabel(pht('Parent Site'))
|
||||
->setLabel(pht('Parent Site Name'))
|
||||
->setDescription(pht('Blog parent site name.'))
|
||||
->setConduitDescription(pht('Change the blog parent site name.'))
|
||||
->setConduitTypeDescription(pht('New blog parent site name.'))
|
||||
|
@ -111,7 +115,7 @@ final class PhameBlogEditEngine
|
|||
->setTransactionType(PhameBlogTransaction::TYPE_PARENTSITE),
|
||||
id(new PhabricatorTextEditField())
|
||||
->setKey('parentDomain')
|
||||
->setLabel(pht('Parent Domain'))
|
||||
->setLabel(pht('Parent Site URI'))
|
||||
->setDescription(pht('Blog parent domain name.'))
|
||||
->setConduitDescription(pht('Change the blog parent domain.'))
|
||||
->setConduitTypeDescription(pht('New blog parent domain.'))
|
||||
|
|
|
@ -86,6 +86,18 @@ final class PhamePost extends PhameDAO
|
|||
return "/phame/post/view/{$id}/{$slug}/";
|
||||
}
|
||||
|
||||
public function getBestURI($is_live, $is_external) {
|
||||
if ($is_live) {
|
||||
if ($is_external) {
|
||||
return $this->getExternalLiveURI();
|
||||
} else {
|
||||
return $this->getInternalLiveURI();
|
||||
}
|
||||
} else {
|
||||
return $this->getViewURI();
|
||||
}
|
||||
}
|
||||
|
||||
public function getEditURI() {
|
||||
return '/phame/post/edit/'.$this->getID().'/';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue