Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15379070
D13033.id31451.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
D13033.id31451.diff
View Options
diff --git a/src/applications/calendar/controller/PhabricatorCalendarController.php b/src/applications/calendar/controller/PhabricatorCalendarController.php
--- a/src/applications/calendar/controller/PhabricatorCalendarController.php
+++ b/src/applications/calendar/controller/PhabricatorCalendarController.php
@@ -5,11 +5,23 @@
protected function buildApplicationCrumbs() {
$crumbs = parent::buildApplicationCrumbs();
+ $actions = id(new PhabricatorActionListView())
+ ->setUser($this->getViewer())
+ ->addAction(
+ id(new PhabricatorActionView())
+ ->setName(pht('Create Private Event'))
+ ->setHref('/calendar/event/create/?mode=private'))
+ ->addAction(
+ id(new PhabricatorActionView())
+ ->setName(pht('Create Public Event'))
+ ->setHref('/calendar/event/create/?mode=public'));
+
$crumbs->addAction(
id(new PHUIListItemView())
->setName(pht('Create Event'))
->setHref($this->getApplicationURI().'event/create/')
- ->setIcon('fa-plus-square'));
+ ->setIcon('fa-plus-square')
+ ->setDropdownMenu($actions));
return $crumbs;
}
diff --git a/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php b/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php
--- a/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php
+++ b/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php
@@ -29,7 +29,10 @@
$uri_query = $request->getStr('query');
if ($this->isCreate()) {
- $event = PhabricatorCalendarEvent::initializeNewCalendarEvent($viewer);
+ $mode = $request->getStr('mode');
+ $event = PhabricatorCalendarEvent::initializeNewCalendarEvent(
+ $viewer,
+ $mode);
$create_start_year = $request->getInt('year');
$create_start_month = $request->getInt('month');
diff --git a/src/applications/calendar/storage/PhabricatorCalendarEvent.php b/src/applications/calendar/storage/PhabricatorCalendarEvent.php
--- a/src/applications/calendar/storage/PhabricatorCalendarEvent.php
+++ b/src/applications/calendar/storage/PhabricatorCalendarEvent.php
@@ -28,18 +28,26 @@
private $invitees = self::ATTACHABLE;
private $appliedViewer;
- public static function initializeNewCalendarEvent(PhabricatorUser $actor) {
+ public static function initializeNewCalendarEvent(
+ PhabricatorUser $actor,
+ $mode) {
$app = id(new PhabricatorApplicationQuery())
->setViewer($actor)
->withClasses(array('PhabricatorCalendarApplication'))
->executeOne();
+ if ($mode == 'public') {
+ $view_policy = PhabricatorPolicies::getMostOpenPolicy();
+ } else {
+ $view_policy = $actor->getPHID();
+ }
+
return id(new PhabricatorCalendarEvent())
->setUserPHID($actor->getPHID())
->setIsCancelled(0)
->setIsAllDay(0)
->setIcon(self::DEFAULT_ICON)
- ->setViewPolicy($actor->getPHID())
+ ->setViewPolicy($view_policy)
->setEditPolicy($actor->getPHID())
->attachInvitees(array())
->applyViewerTimezone($actor);
diff --git a/src/view/phui/PHUICrumbsView.php b/src/view/phui/PHUICrumbsView.php
--- a/src/view/phui/PHUICrumbsView.php
+++ b/src/view/phui/PHUICrumbsView.php
@@ -84,6 +84,7 @@
'class' => implode(' ', $action_classes),
'sigil' => implode(' ', $action_sigils),
'style' => $action->getStyle(),
+ 'meta' => $action->getMetadata(),
),
array(
$icon,
diff --git a/src/view/phui/PHUIListItemView.php b/src/view/phui/PHUIListItemView.php
--- a/src/view/phui/PHUIListItemView.php
+++ b/src/view/phui/PHUIListItemView.php
@@ -29,6 +29,18 @@
private $aural;
private $profileImage;
+ public function setDropdownMenu(PhabricatorActionListView $actions) {
+ Javelin::initBehavior('phui-dropdown-menu');
+
+ $this->addSigil('phui-dropdown-menu');
+ $this->setMetadata(
+ array(
+ 'items' => $actions,
+ ));
+
+ return $this;
+ }
+
public function setAural($aural) {
$this->aural = $aural;
return $this;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 14, 6:30 PM (2 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7584814
Default Alt Text
D13033.id31451.diff (4 KB)
Attached To
Mode
D13033: Create button should be a dropdown with public and private options
Attached
Detach File
Event Timeline
Log In to Comment