mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-30 01:10:58 +01:00
Modernize Phame
Summary: Adds crumbs, mobile layouts, mobile navs, phts Test Plan: Tested Phame in iOS and Chrome Reviewers: epriestley, btrahan Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D5684
This commit is contained in:
parent
1b4f03b5a8
commit
8ea5c8c74e
12 changed files with 149 additions and 70 deletions
|
@ -2980,7 +2980,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'phabricator-feed-css' =>
|
||||
array(
|
||||
'uri' => '/res/52015916/rsrc/css/application/feed/feed.css',
|
||||
'uri' => '/res/bb92244a/rsrc/css/application/feed/feed.css',
|
||||
'type' => 'css',
|
||||
'requires' =>
|
||||
array(
|
||||
|
|
|
@ -12,18 +12,18 @@ abstract class PhameController extends PhabricatorController {
|
|||
$nav = new AphrontSideNavFilterView();
|
||||
$nav->setBaseURI($base_uri);
|
||||
|
||||
$nav->addLabel('Create');
|
||||
$nav->addFilter('post/new', 'New Post');
|
||||
$nav->addFilter('blog/new', 'New Blog');
|
||||
$nav->addLabel(pht('Create'));
|
||||
$nav->addFilter('post/new', pht('New Post'));
|
||||
$nav->addFilter('blog/new', pht('New Blog'));
|
||||
|
||||
$nav->addLabel('Posts');
|
||||
$nav->addFilter('post/draft', 'My Drafts');
|
||||
$nav->addFilter('post', 'My Posts');
|
||||
$nav->addFilter('post/all', 'All Posts');
|
||||
$nav->addLabel(pht('Posts'));
|
||||
$nav->addFilter('post/draft', pht('My Drafts'));
|
||||
$nav->addFilter('post', pht('My Posts'));
|
||||
$nav->addFilter('post/all', pht('All Posts'));
|
||||
|
||||
$nav->addLabel('Blogs');
|
||||
$nav->addFilter('blog/user', 'Joinable Blogs');
|
||||
$nav->addFilter('blog/all', 'All Blogs');
|
||||
$nav->addLabel(pht('Blogs'));
|
||||
$nav->addFilter('blog/user', pht('Joinable Blogs'));
|
||||
$nav->addFilter('blog/all', pht('All Blogs'));
|
||||
|
||||
$nav->selectFilter(null);
|
||||
|
||||
|
@ -70,10 +70,28 @@ abstract class PhameController extends PhabricatorController {
|
|||
$desc = pht('Published on %s by %s', $published, $blogger);
|
||||
}
|
||||
$item->addAttribute($desc);
|
||||
|
||||
$list->addItem($item);
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
public function buildApplicationMenu() {
|
||||
return $this->renderSideNavFilterView()->getMenu();
|
||||
}
|
||||
|
||||
protected function buildApplicationCrumbs() {
|
||||
$crumbs = parent::buildApplicationCrumbs();
|
||||
$crumbs->addAction(
|
||||
id(new PhabricatorMenuItemView())
|
||||
->setName(pht('New Blog'))
|
||||
->setHref($this->getApplicationURI('/blog/new'))
|
||||
->setIcon('create'));
|
||||
$crumbs->addAction(
|
||||
id(new PhabricatorMenuItemView())
|
||||
->setName(pht('New Post'))
|
||||
->setHref($this->getApplicationURI('/post/new'))
|
||||
->setIcon('new'));
|
||||
return $crumbs;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ final class PhameBlogDeleteController extends PhameController {
|
|||
$dialog = id(new AphrontDialogView())
|
||||
->setUser($user)
|
||||
->setTitle(pht('Delete Blog?'))
|
||||
->setHeaderColor(PhabricatorActionHeaderView::HEADER_RED)
|
||||
->appendChild(
|
||||
pht(
|
||||
'Really delete the blog "%s"? It will be gone forever.',
|
||||
|
|
|
@ -56,8 +56,8 @@ final class PhameBlogEditController
|
|||
$skin = $request->getStr('skin');
|
||||
|
||||
if (empty($name)) {
|
||||
$errors[] = 'You must give the blog a name.';
|
||||
$e_name = 'Required';
|
||||
$errors[] = pht('You must give the blog a name.');
|
||||
$e_name = pht('Required');
|
||||
} else {
|
||||
$e_name = null;
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ final class PhameBlogEditController
|
|||
$error = $blog->validateCustomDomain($custom_domain);
|
||||
if ($error) {
|
||||
$errors[] = $error;
|
||||
$e_custom_domain = 'Invalid';
|
||||
$e_custom_domain = pht('Invalid');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,8 +91,8 @@ final class PhameBlogEditController
|
|||
return id(new AphrontRedirectResponse())
|
||||
->setURI($this->getApplicationURI('blog/view/'.$blog->getID().'/'));
|
||||
} catch (AphrontQueryDuplicateKeyException $ex) {
|
||||
$errors[] = 'Domain must be unique.';
|
||||
$e_custom_domain = 'Not Unique';
|
||||
$errors[] = pht('Domain must be unique.');
|
||||
$e_custom_domain = pht('Not Unique');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -110,14 +110,14 @@ final class PhameBlogEditController
|
|||
->setFlexible(true)
|
||||
->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
->setLabel('Name')
|
||||
->setLabel(pht('Name'))
|
||||
->setName('name')
|
||||
->setValue($blog->getName())
|
||||
->setID('blog-name')
|
||||
->setError($e_name))
|
||||
->appendChild(
|
||||
id(new PhabricatorRemarkupControl())
|
||||
->setLabel('Description')
|
||||
->setLabel(pht('Description'))
|
||||
->setName('description')
|
||||
->setValue($blog->getDescription())
|
||||
->setID('blog-description')
|
||||
|
@ -146,14 +146,15 @@ final class PhameBlogEditController
|
|||
->setName('can_join'))
|
||||
->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
->setLabel('Custom Domain')
|
||||
->setLabel(pht('Custom Domain'))
|
||||
->setName('custom_domain')
|
||||
->setValue($blog->getDomain())
|
||||
->setCaption('Must include at least one dot (.), e.g. blog.example.com')
|
||||
->setCaption(
|
||||
pht('Must include at least one dot (.), e.g. blog.example.com'))
|
||||
->setError($e_custom_domain))
|
||||
->appendChild(
|
||||
id(new AphrontFormSelectControl())
|
||||
->setLabel('Skin')
|
||||
->setLabel(pht('Skin'))
|
||||
->setName('skin')
|
||||
->setValue($blog->getSkin())
|
||||
->setOptions($skins))
|
||||
|
@ -164,7 +165,7 @@ final class PhameBlogEditController
|
|||
|
||||
if ($errors) {
|
||||
$error_view = id(new AphrontErrorView())
|
||||
->setTitle('Form Errors')
|
||||
->setTitle(pht('Form Errors'))
|
||||
->setErrors($errors);
|
||||
} else {
|
||||
$error_view = null;
|
||||
|
@ -173,10 +174,17 @@ final class PhameBlogEditController
|
|||
$header = id(new PhabricatorHeaderView())
|
||||
->setHeader($page_title);
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
$crumbs->addCrumb(
|
||||
id(new PhabricatorCrumbView())
|
||||
->setName($page_title)
|
||||
->setHref($this->getApplicationURI('blog/new')));
|
||||
|
||||
$nav = $this->renderSideNavFilterView();
|
||||
$nav->selectFilter($this->id ? null : 'blog/new');
|
||||
$nav->appendChild(
|
||||
array(
|
||||
$crumbs,
|
||||
$header,
|
||||
$error_view,
|
||||
$form,
|
||||
|
@ -185,7 +193,9 @@ final class PhameBlogEditController
|
|||
return $this->buildApplicationPage(
|
||||
$nav,
|
||||
array(
|
||||
'title' => $page_title,
|
||||
'title' => $page_title,
|
||||
'device' => true,
|
||||
'dust' => true,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,23 +44,27 @@ final class PhameBlogListController extends PhameController {
|
|||
|
||||
$blogs = $query->executeWithOffsetPager($pager);
|
||||
|
||||
$header = id(new PhabricatorHeaderView())
|
||||
->setHeader($title);
|
||||
|
||||
$blog_list = $this->renderBlogList($blogs, $user, $nodata);
|
||||
$blog_list->setPager($pager);
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
$crumbs->addCrumb(
|
||||
id(new PhabricatorCrumbView())
|
||||
->setName($title)
|
||||
->setHref($this->getApplicationURI()));
|
||||
|
||||
$nav->appendChild(
|
||||
array(
|
||||
$header,
|
||||
$crumbs,
|
||||
$blog_list,
|
||||
));
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
$nav,
|
||||
array(
|
||||
'title' => $title,
|
||||
'device' => true,
|
||||
'title' => $title,
|
||||
'device' => true,
|
||||
'dust' => true,
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -48,8 +48,15 @@ final class PhameBlogViewController extends PhameController {
|
|||
$user,
|
||||
pht('This blog has no visible posts.'));
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
$crumbs->addCrumb(
|
||||
id(new PhabricatorCrumbView())
|
||||
->setName($blog->getName())
|
||||
->setHref($this->getApplicationURI()));
|
||||
|
||||
$nav->appendChild(
|
||||
array(
|
||||
$crumbs,
|
||||
$header,
|
||||
$actions,
|
||||
$properties,
|
||||
|
@ -59,8 +66,9 @@ final class PhameBlogViewController extends PhameController {
|
|||
return $this->buildApplicationPage(
|
||||
$nav,
|
||||
array(
|
||||
'device' => true,
|
||||
'title' => $blog->getName(),
|
||||
'device' => true,
|
||||
'title' => $blog->getName(),
|
||||
'dust' => true,
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ final class PhamePostDeleteController extends PhameController {
|
|||
$dialog = id(new AphrontDialogView())
|
||||
->setUser($user)
|
||||
->setTitle(pht('Delete Post?'))
|
||||
->setHeaderColor(PhabricatorActionHeaderView::HEADER_RED)
|
||||
->appendChild(
|
||||
pht(
|
||||
'Really delete the post "%s"? It will be gone forever.',
|
||||
|
|
|
@ -69,13 +69,13 @@ final class PhamePostEditController
|
|||
$post->setConfigData($data);
|
||||
|
||||
if ($phame_title == '/') {
|
||||
$errors[] = 'Phame title must be nonempty.';
|
||||
$e_phame_title = 'Required';
|
||||
$errors[] = pht('Phame title must be nonempty.');
|
||||
$e_phame_title = pht('Required');
|
||||
}
|
||||
|
||||
if (!strlen($title)) {
|
||||
$errors[] = 'Title must be nonempty.';
|
||||
$e_title = 'Required';
|
||||
$errors[] = pht('Title must be nonempty.');
|
||||
$e_title = pht('Required');
|
||||
} else {
|
||||
$e_title = null;
|
||||
}
|
||||
|
@ -87,9 +87,9 @@ final class PhamePostEditController
|
|||
$uri = $this->getApplicationURI('/post/view/'.$post->getID().'/');
|
||||
return id(new AphrontRedirectResponse())->setURI($uri);
|
||||
} catch (AphrontQueryDuplicateKeyException $e) {
|
||||
$e_phame_title = 'Not Unique';
|
||||
$errors[] = 'Another post already uses this slug. '.
|
||||
'Each post must have a unique slug.';
|
||||
$e_phame_title = pht('Not Unique');
|
||||
$errors[] = pht('Another post already uses this slug. '.
|
||||
'Each post must have a unique slug.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -104,28 +104,28 @@ final class PhamePostEditController
|
|||
->addHiddenInput('blog', $request->getInt('blog'))
|
||||
->appendChild(
|
||||
id(new AphrontFormMarkupControl())
|
||||
->setLabel('Blog')
|
||||
->setLabel(pht('Blog'))
|
||||
->setValue($handle->renderLink()))
|
||||
->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
->setLabel('Title')
|
||||
->setLabel(pht('Title'))
|
||||
->setName('title')
|
||||
->setValue($post->getTitle())
|
||||
->setID('post-title')
|
||||
->setError($e_title))
|
||||
->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
->setLabel('Phame Title')
|
||||
->setLabel(pht('Phame Title'))
|
||||
->setName('phame_title')
|
||||
->setValue(rtrim($post->getPhameTitle(), '/'))
|
||||
->setID('post-phame-title')
|
||||
->setCaption('Up to 64 alphanumeric characters '.
|
||||
->setCaption(pht('Up to 64 alphanumeric characters '.
|
||||
'with underscores for spaces. '.
|
||||
'Formatting is enforced.')
|
||||
'Formatting is enforced.'))
|
||||
->setError($e_phame_title))
|
||||
->appendChild(
|
||||
id(new PhabricatorRemarkupControl())
|
||||
->setLabel('Body')
|
||||
->setLabel(pht('Body'))
|
||||
->setName('body')
|
||||
->setValue($post->getBody())
|
||||
->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL)
|
||||
|
@ -134,7 +134,7 @@ final class PhamePostEditController
|
|||
->setDisableMacros(true))
|
||||
->appendChild(
|
||||
id(new AphrontFormSelectControl())
|
||||
->setLabel('Comments Widget')
|
||||
->setLabel(pht('Comments Widget'))
|
||||
->setName('comments_widget')
|
||||
->setvalue($post->getCommentsWidget())
|
||||
->setOptions($post->getCommentsWidgetOptionsForSelect()))
|
||||
|
@ -170,15 +170,22 @@ final class PhamePostEditController
|
|||
|
||||
if ($errors) {
|
||||
$error_view = id(new AphrontErrorView())
|
||||
->setTitle('Errors saving post.')
|
||||
->setTitle(pht('Errors saving post.'))
|
||||
->setErrors($errors);
|
||||
} else {
|
||||
$error_view = null;
|
||||
}
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
$crumbs->addCrumb(
|
||||
id(new PhabricatorCrumbView())
|
||||
->setName($page_title)
|
||||
->setHref($this->getApplicationURI('/post/view/'.$this->id.'/')));
|
||||
|
||||
$nav = $this->renderSideNavFilterView(null);
|
||||
$nav->appendChild(
|
||||
array(
|
||||
$crumbs,
|
||||
$header,
|
||||
$error_view,
|
||||
$form,
|
||||
|
@ -188,8 +195,9 @@ final class PhamePostEditController
|
|||
return $this->buildApplicationPage(
|
||||
$nav,
|
||||
array(
|
||||
'title' => $page_title,
|
||||
'device' => true,
|
||||
'title' => $page_title,
|
||||
'device' => true,
|
||||
'dust' => true,
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -70,14 +70,17 @@ final class PhamePostListController extends PhameController {
|
|||
mpull($posts, 'getBlogPHID'));
|
||||
$this->loadHandles($handle_phids);
|
||||
|
||||
|
||||
$header = id(new PhabricatorHeaderView())
|
||||
->setHeader($title);
|
||||
$post_list = $this->renderPostList($posts, $user, $nodata);
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
$crumbs->addCrumb(
|
||||
id(new PhabricatorCrumbView())
|
||||
->setName($title)
|
||||
->setHref($this->getApplicationURI()));
|
||||
|
||||
$nav->appendChild(
|
||||
array(
|
||||
$header,
|
||||
$crumbs,
|
||||
$post_list,
|
||||
));
|
||||
|
||||
|
@ -86,6 +89,7 @@ final class PhamePostListController extends PhameController {
|
|||
array(
|
||||
'title' => $title,
|
||||
'device' => true,
|
||||
'dust' => true,
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ final class PhamePostNewController extends PhameController {
|
|||
$title = pht('Move Post');
|
||||
} else {
|
||||
$title = pht('Create Post');
|
||||
$view_uri = $this->getApplicationURI('/post/new');
|
||||
}
|
||||
|
||||
$blogs = id(new PhameBlogQuery())
|
||||
|
@ -66,6 +67,14 @@ final class PhamePostNewController extends PhameController {
|
|||
|
||||
$nav = $this->renderSideNavFilterView();
|
||||
$nav->selectFilter('post/new');
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
$crumbs->addCrumb(
|
||||
id(new PhabricatorCrumbView())
|
||||
->setName($title)
|
||||
->setHref($view_uri));
|
||||
$nav->appendChild($crumbs);
|
||||
|
||||
$nav->appendChild(
|
||||
id(new PhabricatorHeaderView())->setHeader($title));
|
||||
|
||||
|
@ -91,7 +100,7 @@ final class PhamePostNewController extends PhameController {
|
|||
->setFlexible(true)
|
||||
->appendChild(
|
||||
id(new AphrontFormSelectControl())
|
||||
->setLabel('Blog')
|
||||
->setLabel(pht('Blog'))
|
||||
->setName('blog')
|
||||
->setOptions($options)
|
||||
->setValue($selected_value));
|
||||
|
@ -119,6 +128,7 @@ final class PhamePostNewController extends PhameController {
|
|||
array(
|
||||
'title' => $title,
|
||||
'device' => true,
|
||||
'dust' => true,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ final class PhamePostPublishController extends PhameController {
|
|||
}
|
||||
|
||||
$header = id(new PhabricatorHeaderView())
|
||||
->setHeader('Preview Post');
|
||||
->setHeader(pht('Preview Post'));
|
||||
|
||||
$form = id(new AphrontFormView())
|
||||
->setUser($user)
|
||||
|
@ -50,9 +50,16 @@ final class PhamePostPublishController extends PhameController {
|
|||
|
||||
$frame = $this->renderPreviewFrame($post);
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
$crumbs->addCrumb(
|
||||
id(new PhabricatorCrumbView())
|
||||
->setName(pht('Preview'))
|
||||
->setHref($view_uri));
|
||||
|
||||
$nav = $this->renderSideNavFilterView(null);
|
||||
$nav->appendChild(
|
||||
array(
|
||||
$crumbs,
|
||||
$header,
|
||||
$form,
|
||||
$frame,
|
||||
|
@ -79,7 +86,7 @@ final class PhamePostPublishController extends PhameController {
|
|||
'iframe',
|
||||
array(
|
||||
'style' => 'width: 100%; height: 600px; '.
|
||||
'border: 1px solid #303030; background: #303030;',
|
||||
'border: 1px solid #303030;',
|
||||
'src' => $this->getApplicationURI('/post/framed/'.$post->getID().'/'),
|
||||
),
|
||||
''));
|
||||
|
|
|
@ -26,6 +26,22 @@ final class PhamePostViewController extends PhameController {
|
|||
|
||||
$nav = $this->renderSideNavFilterView();
|
||||
|
||||
$this->loadHandles(
|
||||
array(
|
||||
$post->getBlogPHID(),
|
||||
$post->getBloggerPHID(),
|
||||
));
|
||||
$actions = $this->renderActions($post, $user);
|
||||
$properties = $this->renderProperties($post, $user);
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
$crumbs->setActionList($actions);
|
||||
$crumbs->addCrumb(
|
||||
id(new PhabricatorCrumbView())
|
||||
->setName($post->getTitle())
|
||||
->setHref($this->getApplicationURI('post/view/'.$post->getID().'/')));
|
||||
|
||||
$nav->appendChild($crumbs);
|
||||
$nav->appendChild(
|
||||
id(new PhabricatorHeaderView())
|
||||
->setHeader($post->getTitle()));
|
||||
|
@ -50,15 +66,6 @@ final class PhamePostViewController extends PhameController {
|
|||
'been deleted). Use "Move Post" to move it to a new blog.')));
|
||||
}
|
||||
|
||||
$this->loadHandles(
|
||||
array(
|
||||
$post->getBlogPHID(),
|
||||
$post->getBloggerPHID(),
|
||||
));
|
||||
|
||||
$actions = $this->renderActions($post, $user);
|
||||
$properties = $this->renderProperties($post, $user);
|
||||
|
||||
$nav->appendChild(
|
||||
array(
|
||||
$actions,
|
||||
|
@ -68,8 +75,9 @@ final class PhamePostViewController extends PhameController {
|
|||
return $this->buildApplicationPage(
|
||||
$nav,
|
||||
array(
|
||||
'title' => $post->getTitle(),
|
||||
'device' => true,
|
||||
'title' => $post->getTitle(),
|
||||
'device' => true,
|
||||
'dust' => true,
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -92,7 +100,7 @@ final class PhamePostViewController extends PhameController {
|
|||
id(new PhabricatorActionView())
|
||||
->setIcon('edit')
|
||||
->setHref($this->getApplicationURI('post/edit/'.$id.'/'))
|
||||
->setName('Edit Post')
|
||||
->setName(pht('Edit Post'))
|
||||
->setDisabled(!$can_edit)
|
||||
->setWorkflow(!$can_edit));
|
||||
|
||||
|
@ -100,7 +108,7 @@ final class PhamePostViewController extends PhameController {
|
|||
id(new PhabricatorActionView())
|
||||
->setIcon('move')
|
||||
->setHref($this->getApplicationURI('post/move/'.$id.'/'))
|
||||
->setName('Move Post')
|
||||
->setName(pht('Move Post'))
|
||||
->setDisabled(!$can_edit)
|
||||
->setWorkflow(!$can_edit));
|
||||
|
||||
|
@ -123,7 +131,7 @@ final class PhamePostViewController extends PhameController {
|
|||
id(new PhabricatorActionView())
|
||||
->setIcon('delete')
|
||||
->setHref($this->getApplicationURI('post/delete/'.$id.'/'))
|
||||
->setName('Delete Post')
|
||||
->setName(pht('Delete Post'))
|
||||
->setDisabled(!$can_edit)
|
||||
->setWorkflow(true));
|
||||
|
||||
|
|
Loading…
Reference in a new issue