Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15397271
D15384.id37095.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D15384.id37095.diff
View Options
diff --git a/src/applications/phame/application/PhabricatorPhameApplication.php b/src/applications/phame/application/PhabricatorPhameApplication.php
--- a/src/applications/phame/application/PhabricatorPhameApplication.php
+++ b/src/applications/phame/application/PhabricatorPhameApplication.php
@@ -60,11 +60,11 @@
'blog/' => array(
'(?:query/(?P<queryKey>[^/]+)/)?' => 'PhameBlogListController',
'archive/(?P<id>[^/]+)/' => 'PhameBlogArchiveController',
- 'edit/(?P<id>[^/]+)/' => 'PhameBlogEditController',
+ $this->getEditRoutePattern('edit/')
+ => 'PhameBlogEditController',
'view/(?P<blogID>\d+)/' => 'PhameBlogViewController',
'manage/(?P<id>[^/]+)/' => 'PhameBlogManageController',
'feed/(?P<id>[^/]+)/' => 'PhameBlogFeedController',
- 'new/' => 'PhameBlogEditController',
'picture/(?P<id>[1-9]\d*)/' => 'PhameBlogProfilePictureController',
),
) + $this->getResourceSubroutes(),
diff --git a/src/applications/phame/controller/PhameHomeController.php b/src/applications/phame/controller/PhameHomeController.php
--- a/src/applications/phame/controller/PhameHomeController.php
+++ b/src/applications/phame/controller/PhameHomeController.php
@@ -6,6 +6,16 @@
return true;
}
+ protected function buildApplicationCrumbs() {
+ $crumbs = parent::buildApplicationCrumbs();
+
+ id(new PhameBlogEditEngine())
+ ->setViewer($this->getViewer())
+ ->addActionToCrumbs($crumbs);
+
+ return $crumbs;
+ }
+
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
@@ -44,7 +54,7 @@
$create_button = id(new PHUIButtonView())
->setTag('a')
->setText(pht('Create a Blog'))
- ->setHref('/phame/blog/new/')
+ ->setHref('/phame/blog/edit/')
->setColor(PHUIButtonView::GREEN);
$post_list = id(new PHUIBigInfoView())
@@ -116,27 +126,6 @@
array(
$phame_home,
));
-
-
- }
-
- private function renderBlogs($viewer, $blogs) {}
-
- protected function buildApplicationCrumbs() {
- $crumbs = parent::buildApplicationCrumbs();
-
- $can_create = $this->hasApplicationCapability(
- PhameBlogCreateCapability::CAPABILITY);
-
- $crumbs->addAction(
- id(new PHUIListItemView())
- ->setName(pht('New Blog'))
- ->setHref($this->getApplicationURI('/blog/new/'))
- ->setIcon('fa-plus-square')
- ->setDisabled(!$can_create)
- ->setWorkflow(!$can_create));
-
- return $crumbs;
}
}
diff --git a/src/applications/phame/controller/blog/PhameBlogListController.php b/src/applications/phame/controller/blog/PhameBlogListController.php
--- a/src/applications/phame/controller/blog/PhameBlogListController.php
+++ b/src/applications/phame/controller/blog/PhameBlogListController.php
@@ -7,43 +7,18 @@
}
public function handleRequest(AphrontRequest $request) {
- $query_key = $request->getURIData('queryKey');
- $controller = id(new PhabricatorApplicationSearchController())
- ->setQueryKey($query_key)
- ->setSearchEngine(new PhameBlogSearchEngine())
- ->setNavigation($this->buildSideNavView());
-
- return $this->delegateToController($controller);
+ return id(new PhameBlogSearchEngine())
+ ->setController($this)
+ ->buildResponse();
}
- public function buildSideNavView() {
- $viewer = $this->getRequest()->getUser();
-
- $nav = new AphrontSideNavFilterView();
- $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
-
- id(new PhameBlogSearchEngine())
- ->setViewer($viewer)
- ->addNavigationItems($nav->getMenu());
-
- $nav->selectFilter(null);
-
- return $nav;
- }
protected function buildApplicationCrumbs() {
$crumbs = parent::buildApplicationCrumbs();
- $can_create = $this->hasApplicationCapability(
- PhameBlogCreateCapability::CAPABILITY);
-
- $crumbs->addAction(
- id(new PHUIListItemView())
- ->setName(pht('New Blog'))
- ->setHref($this->getApplicationURI('/blog/new/'))
- ->setIcon('fa-plus-square')
- ->setDisabled(!$can_create)
- ->setWorkflow(!$can_create));
+ id(new PhameBlogEditEngine())
+ ->setViewer($this->getViewer())
+ ->addActionToCrumbs($crumbs);
return $crumbs;
}
diff --git a/src/applications/phame/editor/PhameBlogEditEngine.php b/src/applications/phame/editor/PhameBlogEditEngine.php
--- a/src/applications/phame/editor/PhameBlogEditEngine.php
+++ b/src/applications/phame/editor/PhameBlogEditEngine.php
@@ -46,12 +46,24 @@
return pht('Create Blog');
}
+ protected function getObjectCreateCancelURI($object) {
+ return $this->getApplication()->getApplicationURI('blog/');
+ }
+
+ protected function getEditorURI() {
+ return $this->getApplication()->getApplicationURI('blog/edit/');
+ }
+
protected function getObjectViewURI($object) {
return $object->getManageURI();
}
- protected function buildCustomEditFields($object) {
+ protected function getCreateNewObjectPolicy() {
+ return $this->getApplication()->getPolicy(
+ PhameBlogCreateCapability::CAPABILITY);
+ }
+ protected function buildCustomEditFields($object) {
return array(
id(new PhabricatorTextEditField())
->setKey('name')
diff --git a/src/applications/phame/view/PhameBlogListView.php b/src/applications/phame/view/PhameBlogListView.php
--- a/src/applications/phame/view/PhameBlogListView.php
+++ b/src/applications/phame/view/PhameBlogListView.php
@@ -72,7 +72,7 @@
$list = phutil_tag(
'a',
array(
- 'href' => '/phame/blog/new/',
+ 'href' => '/phame/blog/edit/',
),
pht('Create a Blog'));
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 17, 7:15 PM (2 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7704865
Default Alt Text
D15384.id37095.diff (5 KB)
Attached To
Mode
D15384: Sync up UI with actual policy rules in Phame
Attached
Detach File
Event Timeline
Log In to Comment