Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15415649
D15556.id37507.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D15556.id37507.diff
View Options
diff --git a/src/applications/badges/application/PhabricatorBadgesApplication.php b/src/applications/badges/application/PhabricatorBadgesApplication.php
--- a/src/applications/badges/application/PhabricatorBadgesApplication.php
+++ b/src/applications/badges/application/PhabricatorBadgesApplication.php
@@ -45,8 +45,8 @@
=> 'PhabricatorBadgesEditController',
'comment/(?P<id>[1-9]\d*)/'
=> 'PhabricatorBadgesCommentController',
- 'edit/(?:(?P<id>\d+)/)?'
- => 'PhabricatorBadgesEditController',
+ $this->getEditRoutePattern('edit/')
+ => 'PhabricatorBadgesEditController',
'archive/(?:(?P<id>\d+)/)?'
=> 'PhabricatorBadgesArchiveController',
'view/(?:(?P<id>\d+)/)?'
diff --git a/src/applications/badges/controller/PhabricatorBadgesListController.php b/src/applications/badges/controller/PhabricatorBadgesListController.php
--- a/src/applications/badges/controller/PhabricatorBadgesListController.php
+++ b/src/applications/badges/controller/PhabricatorBadgesListController.php
@@ -16,16 +16,9 @@
protected function buildApplicationCrumbs() {
$crumbs = parent::buildApplicationCrumbs();
- $can_create = $this->hasApplicationCapability(
- PhabricatorBadgesCreateCapability::CAPABILITY);
-
- $crumbs->addAction(
- id(new PHUIListItemView())
- ->setName(pht('Create Badge'))
- ->setHref($this->getApplicationURI('create/'))
- ->setIcon('fa-plus-square')
- ->setDisabled(!$can_create)
- ->setWorkflow(!$can_create));
+ id(new PhabricatorBadgesEditEngine())
+ ->setViewer($this->getViewer())
+ ->addActionToCrumbs($crumbs);
return $crumbs;
}
diff --git a/src/applications/badges/controller/PhabricatorBadgesViewController.php b/src/applications/badges/controller/PhabricatorBadgesViewController.php
--- a/src/applications/badges/controller/PhabricatorBadgesViewController.php
+++ b/src/applications/badges/controller/PhabricatorBadgesViewController.php
@@ -60,7 +60,9 @@
->setHandles($handles)
->setUser($viewer);
- $add_comment = $this->buildCommentForm($badge);
+ $comment_view = id(new PhabricatorBadgesEditEngine())
+ ->setViewer($viewer)
+ ->buildEditEngineCommentView($badge);
$view = id(new PHUITwoColumnView())
->setHeader($header)
@@ -68,7 +70,7 @@
->setMainColumn(array(
$recipient_list,
$timeline,
- $add_comment,
+ $comment_view,
))
->addPropertySection(pht('DESCRIPTION'), $details);
@@ -154,24 +156,4 @@
return $curtain;
}
- private function buildCommentForm(PhabricatorBadgesBadge $badge) {
- $viewer = $this->getViewer();
-
- $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
-
- $add_comment_header = $is_serious
- ? pht('Add Comment')
- : pht('Render Honors');
-
- $draft = PhabricatorDraft::newFromUserAndKey($viewer, $badge->getPHID());
-
- return id(new PhabricatorApplicationTransactionCommentView())
- ->setUser($viewer)
- ->setObjectPHID($badge->getPHID())
- ->setDraft($draft)
- ->setHeaderText($add_comment_header)
- ->setAction($this->getApplicationURI('/comment/'.$badge->getID().'/'))
- ->setSubmitButtonName(pht('Add Comment'));
- }
-
}
diff --git a/src/applications/badges/editor/PhabricatorBadgesEditEngine.php b/src/applications/badges/editor/PhabricatorBadgesEditEngine.php
--- a/src/applications/badges/editor/PhabricatorBadgesEditEngine.php
+++ b/src/applications/badges/editor/PhabricatorBadgesEditEngine.php
@@ -49,18 +49,31 @@
return pht('Badge');
}
+ protected function getObjectCreateCancelURI($object) {
+ return $this->getApplication()->getApplicationURI('/');
+ }
+
+ protected function getEditorURI() {
+ return $this->getApplication()->getApplicationURI('edit/');
+ }
+
protected function getCommentViewHeaderText($object) {
- return pht('Add Comment');
+ return pht('Render Honors');
}
protected function getCommentViewButtonText($object) {
- return pht('Submit');
+ return pht('Salute');
}
protected function getObjectViewURI($object) {
return $object->getViewURI();
}
+ protected function getCreateNewObjectPolicy() {
+ return $this->getApplication()->getPolicy(
+ PhabricatorBadgesCreateCapability::CAPABILITY);
+ }
+
protected function buildCustomEditFields($object) {
return array(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 21, 7:09 AM (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7249462
Default Alt Text
D15556.id37507.diff (4 KB)
Attached To
Mode
D15556: Clean up EditEngine implementation on Badges
Attached
Detach File
Event Timeline
Log In to Comment