diff --git a/resources/celerity/map.php b/resources/celerity/map.php --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -45,7 +45,7 @@ 'rsrc/css/application/config/setup-issue.css' => 'f794cfc3', 'rsrc/css/application/config/unhandled-exception.css' => '4c96257a', 'rsrc/css/application/conpherence/durable-column.css' => '194ac487', - 'rsrc/css/application/conpherence/menu.css' => '3a0fd18a', + 'rsrc/css/application/conpherence/menu.css' => '4c959efa', 'rsrc/css/application/conpherence/message-pane.css' => '31dc663d', 'rsrc/css/application/conpherence/notification.css' => '6cdcc253', 'rsrc/css/application/conpherence/transaction.css' => '2c71247c', @@ -438,7 +438,7 @@ 'rsrc/js/application/conpherence/behavior-menu.js' => '1d45c74d', 'rsrc/js/application/conpherence/behavior-pontificate.js' => '21ba5861', 'rsrc/js/application/conpherence/behavior-quicksand-blacklist.js' => '7927a7d3', - 'rsrc/js/application/conpherence/behavior-widget-pane.js' => 'a8458711', + 'rsrc/js/application/conpherence/behavior-widget-pane.js' => '65845387', 'rsrc/js/application/countdown/timer.js' => 'e4cc26b3', 'rsrc/js/application/daemon/behavior-bulk-job-reload.js' => 'edf8a145', 'rsrc/js/application/dashboard/behavior-dashboard-async-panel.js' => '469c0d9e', @@ -614,7 +614,7 @@ 'config-options-css' => '0ede4c9b', 'config-page-css' => '8798e14f', 'conpherence-durable-column-view' => '194ac487', - 'conpherence-menu-css' => '3a0fd18a', + 'conpherence-menu-css' => '4c959efa', 'conpherence-message-pane-css' => '31dc663d', 'conpherence-notification-css' => '6cdcc253', 'conpherence-thread-manager' => '01774ab2', @@ -664,7 +664,7 @@ 'javelin-behavior-conpherence-drag-and-drop-photo' => 'cf86d16a', 'javelin-behavior-conpherence-menu' => '1d45c74d', 'javelin-behavior-conpherence-pontificate' => '21ba5861', - 'javelin-behavior-conpherence-widget-pane' => 'a8458711', + 'javelin-behavior-conpherence-widget-pane' => '65845387', 'javelin-behavior-countdown-timer' => 'e4cc26b3', 'javelin-behavior-dark-console' => 'f411b6ae', 'javelin-behavior-dashboard-async-panel' => '469c0d9e', @@ -1479,6 +1479,19 @@ 'javelin-request', 'javelin-workflow', ), + 65845387 => array( + 'javelin-behavior', + 'javelin-dom', + 'javelin-stratcom', + 'javelin-workflow', + 'javelin-util', + 'phabricator-notification', + 'javelin-behavior-device', + 'phuix-dropdown-menu', + 'phuix-action-list-view', + 'phuix-action-view', + 'conpherence-thread-manager', + ), '680ea2c8' => array( 'javelin-install', 'javelin-dom', @@ -1784,19 +1797,6 @@ 'javelin-stratcom', 'javelin-dom', ), - 'a8458711' => array( - 'javelin-behavior', - 'javelin-dom', - 'javelin-stratcom', - 'javelin-workflow', - 'javelin-util', - 'phabricator-notification', - 'javelin-behavior-device', - 'phuix-dropdown-menu', - 'phuix-action-list-view', - 'phuix-action-view', - 'conpherence-thread-manager', - ), 'a8d8459d' => array( 'javelin-behavior', 'javelin-dom', diff --git a/src/applications/conpherence/constants/ConpherenceWidgetConfigConstants.php b/src/applications/conpherence/constants/ConpherenceWidgetConfigConstants.php --- a/src/applications/conpherence/constants/ConpherenceWidgetConfigConstants.php +++ b/src/applications/conpherence/constants/ConpherenceWidgetConfigConstants.php @@ -36,12 +36,6 @@ 'deviceOnly' => false, 'hasCreate' => false, ), - 'widgets-edit' => array( - 'name' => pht('Edit Room'), - 'icon' => 'fa-pencil', - 'deviceOnly' => false, - 'hasCreate' => false, - ), ); } diff --git a/src/applications/conpherence/controller/ConpherenceController.php b/src/applications/conpherence/controller/ConpherenceController.php --- a/src/applications/conpherence/controller/ConpherenceController.php +++ b/src/applications/conpherence/controller/ConpherenceController.php @@ -38,30 +38,10 @@ $crumbs = parent::buildApplicationCrumbs(); $crumbs->setBorder(true); - $crumbs->addAction( - id(new PHUIListItemView()) - ->setName(pht('Search')) - ->setHref($this->getApplicationURI('search/')) - ->setIcon('fa-search')); - - if ($is_rooms) { - $crumbs - ->addAction( - id(new PHUIListItemView()) - ->setName(pht('New Room')) - ->setHref($this->getApplicationURI('new/')) - ->setIcon('fa-plus-square') - ->setWorkflow(true)); - } else { + if (!$is_rooms) { $crumbs ->addAction( id(new PHUIListItemView()) - ->setName(pht('New Room')) - ->setHref($this->getApplicationURI('new/')) - ->setIcon('fa-plus-square') - ->setWorkflow(true)) - ->addAction( - id(new PHUIListItemView()) ->setName(pht('Room')) ->setHref('#') ->setIcon('fa-bars') @@ -76,6 +56,7 @@ ConpherenceThread $conpherence, array $policy_objects) { assert_instances_of($policy_objects, 'PhabricatorPolicy'); + $viewer = $this->getViewer(); $crumbs = $this->buildApplicationCrumbs(); $data = $conpherence->getDisplayData($this->getViewer()); @@ -84,6 +65,21 @@ ->setName($data['title']) ->setHref('/'.$conpherence->getMonogram())); + $can_edit = PhabricatorPolicyFilter::hasCapability( + $viewer, + $conpherence, + PhabricatorPolicyCapability::CAN_EDIT); + + $crumbs + ->addAction( + id(new PHUIListItemView()) + ->setName(pht('Edit Room')) + ->setHref( + $this->getApplicationURI('update/'.$conpherence->getID()).'/') + ->setIcon('fa-pencil') + ->setDisabled(!$can_edit) + ->setWorkflow(true)); + return hsprintf( '%s', array( diff --git a/src/applications/conpherence/controller/ConpherenceWidgetController.php b/src/applications/conpherence/controller/ConpherenceWidgetController.php --- a/src/applications/conpherence/controller/ConpherenceWidgetController.php +++ b/src/applications/conpherence/controller/ConpherenceWidgetController.php @@ -82,13 +82,6 @@ 'style' => 'display: none', ), $this->renderSettingsWidgetPaneContent()); - $widgets[] = phutil_tag( - 'div', - array( - 'class' => 'widgets-body', - 'id' => 'widgets-edit', - 'style' => 'display: none', - )); // without this implosion we get "," between each element in our widgets // array diff --git a/src/applications/conpherence/view/ConpherenceThreadListView.php b/src/applications/conpherence/view/ConpherenceThreadListView.php --- a/src/applications/conpherence/view/ConpherenceThreadListView.php +++ b/src/applications/conpherence/view/ConpherenceThreadListView.php @@ -99,9 +99,7 @@ array $rooms, array $policy_objects) { - $header = $this->renderMenuItemHeader( - pht('Rooms'), - 'conpherence-room-list-header'); + $header = $this->renderMenuItemHeader(); $menu->addMenuItem($header); if (empty($rooms)) { @@ -189,11 +187,53 @@ return $menu; } - private function renderMenuItemHeader($title, $class = null) { + private function renderMenuItemHeader() { + $rooms = phutil_tag( + 'a', + array( + 'class' => 'room-list-href', + 'href' => '/conpherence/search/', + ), + pht('Rooms')); + + $new_icon = id(new PHUIIconView()) + ->setIcon('fa-plus-square') + ->addSigil('has-tooltip') + ->setHref('/conpherence/new/') + ->setWorkflow(true) + ->setMetaData(array( + 'tip' => pht('New Room'), + )); + + $search_icon = id(new PHUIIconView()) + ->setIcon('fa-search') + ->addSigil('has-tooltip') + ->setHref('/conpherence/search/') + ->setMetaData(array( + 'tip' => pht('Search Rooms'), + )); + + $icons = phutil_tag( + 'span', + array( + 'class' => 'room-list-icons', + ), + array( + $new_icon, + $search_icon, + )); + + $new_icon = id(new PHUIIconView()) + ->setIcon('fa-plus-square') + ->setHref('/conpherence/new/') + ->setWorkflow(true); + + $custom = array($rooms, $icons); + $item = id(new PHUIListItemView()) - ->setType(PHUIListItemView::TYPE_LABEL) - ->setName($title) - ->addClass($class); + ->setType(PHUIListItemView::TYPE_CUSTOM) + ->setName($custom) + ->addClass('conpherence-room-list-header'); return $item; } diff --git a/webroot/rsrc/css/application/conpherence/menu.css b/webroot/rsrc/css/application/conpherence/menu.css --- a/webroot/rsrc/css/application/conpherence/menu.css +++ b/webroot/rsrc/css/application/conpherence/menu.css @@ -51,8 +51,24 @@ display: none; } -.conpherence-menu-pane.phabricator-side-menu .phui-list-item-type-label { +.conpherence-menu-pane.phabricator-side-menu .room-list-href { padding: 10px 0 9px 8px; + display: inline-block; + text-transform: uppercase; + color: {$darkgreytext}; + font-weight: bold; + font-size: {$smallerfontsize}; +} + +.conpherence-menu-pane.phabricator-side-menu .room-list-icons { + display: inline-block; + float: right; + padding: 8px 0 5px; +} + +.conpherence-menu-pane .conpherence-room-list-header { + clear: both; + overflow: hidden; } .conpherence-menu-pane .conpherence-room-list-header @@ -60,7 +76,7 @@ font-weight: bold; float: right; text-transform: none; - margin: 0px 8px 0px 0px; + padding: 4px; } .conpherence-menu-pane .conpherence-room-list-header diff --git a/webroot/rsrc/js/application/conpherence/behavior-widget-pane.js b/webroot/rsrc/js/application/conpherence/behavior-widget-pane.js --- a/webroot/rsrc/js/application/conpherence/behavior-widget-pane.js +++ b/webroot/rsrc/js/application/conpherence/behavior-widget-pane.js @@ -83,27 +83,11 @@ var handler; var href; - if (widget == 'widgets-edit') { - var threadManager = JX.ConpherenceThreadManager.getInstance(); - handler = function(e) { - e.prevent(); - menu.close(); - threadManager.runUpdateWorkflowFromLink( - e.getTarget(), - { - action : 'metadata', - force_ajax : true, - stage : 'submit' - }); - }; - href = threadManager._getUpdateURI(); - } else { - handler = JX.bind(null, function(widget, e) { - toggleWidget({widget: widget}); - e.prevent(); - menu.close(); - }, widget); - } + handler = JX.bind(null, function(widget, e) { + toggleWidget({widget: widget}); + e.prevent(); + menu.close(); + }, widget); var item = new JX.PHUIXActionView() .setIcon(widget_data.icon || 'none') .setName(widget_data.name)