diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 26ab7dee34..45f7406a5a 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -231,6 +231,7 @@ phutil_register_library_map(array( 'ConpherenceFileWidgetView' => 'applications/conpherence/view/ConpherenceFileWidgetView.php', 'ConpherenceFormDragAndDropUploadControl' => 'applications/conpherence/view/ConpherenceFormDragAndDropUploadControl.php', 'ConpherenceImageData' => 'applications/conpherence/constants/ConpherenceImageData.php', + 'ConpherenceLayoutView' => 'applications/conpherence/view/ConpherenceLayoutView.php', 'ConpherenceListController' => 'applications/conpherence/controller/ConpherenceListController.php', 'ConpherenceMenuItemView' => 'applications/conpherence/view/ConpherenceMenuItemView.php', 'ConpherenceNewController' => 'applications/conpherence/controller/ConpherenceNewController.php', @@ -1940,6 +1941,7 @@ phutil_register_library_map(array( 'ConpherenceFileWidgetView' => 'AphrontView', 'ConpherenceFormDragAndDropUploadControl' => 'AphrontFormControl', 'ConpherenceImageData' => 'ConpherenceConstants', + 'ConpherenceLayoutView' => 'AphrontView', 'ConpherenceListController' => 'ConpherenceController', 'ConpherenceMenuItemView' => 'AphrontTagView', 'ConpherenceNewController' => 'ConpherenceController', diff --git a/src/applications/conpherence/controller/ConpherenceController.php b/src/applications/conpherence/controller/ConpherenceController.php index 80b3a6de58..3da95bd2e1 100644 --- a/src/applications/conpherence/controller/ConpherenceController.php +++ b/src/applications/conpherence/controller/ConpherenceController.php @@ -314,32 +314,4 @@ abstract class ConpherenceController extends PhabricatorController { ); } - - protected function initJavelinBehaviors($more_than_menu = false) { - - Javelin::initBehavior('conpherence-menu', - array( - 'base_uri' => $this->getApplicationURI(''), - 'header' => 'conpherence-header-pane', - 'messages' => 'conpherence-messages', - 'messages_pane' => 'conpherence-message-pane', - 'widgets_pane' => 'conpherence-widget-pane', - 'form_pane' => 'conpherence-form', - 'menu_pane' => 'conpherence-menu', - 'selected_conpherence_id' => $this->getSelectedConpherencePHID(), - 'fancy_ajax' => (bool) $this->getSelectedConpherencePHID() - )); - - if ($more_than_menu) { - Javelin::initBehavior('conpherence-drag-and-drop-photo', - array( - 'target' => 'conpherence-header-pane', - 'form_pane' => 'conpherence-form', - 'upload_uri' => '/file/dropupload/', - 'activated_class' => 'conpherence-header-upload-photo', - )); - } - - Javelin::initBehavior('conpherence-pontificate'); - } } diff --git a/src/applications/conpherence/controller/ConpherenceListController.php b/src/applications/conpherence/controller/ConpherenceListController.php index 97f7c7e427..ff1c6e29aa 100644 --- a/src/applications/conpherence/controller/ConpherenceListController.php +++ b/src/applications/conpherence/controller/ConpherenceListController.php @@ -48,7 +48,10 @@ final class ConpherenceListController extends $this->loadStartingConpherences($current_selection_epoch); $nav = $this->buildSideNavView(); - $main_pane = $this->renderEmptyMainPane(); + $main_pane = id(new ConpherenceLayoutView()) + ->setBaseURI($this->getApplicationURI()) + ->setSelectedConpherencePHID($this->getSelectedConpherencePHID()); + $nav->appendChild( array( $main_pane, @@ -62,54 +65,4 @@ final class ConpherenceListController extends )); } - private function renderEmptyMainPane() { - $this->initJavelinBehaviors(true); - return javelin_tag( - 'div', - array( - 'id' => 'conpherence-main-pane', - 'sigil' => 'conpherence-layout' - ), - array( - javelin_tag( - 'div', - array( - 'class' => 'conpherence-header-pane', - 'id' => 'conpherence-header-pane', - 'sigil' => 'conpherence-header', - ), - ''), - phutil_tag( - 'div', - array( - 'class' => 'conpherence-widget-pane', - 'id' => 'conpherence-widget-pane' - ), - ''), - javelin_tag( - 'div', - array( - 'class' => 'conpherence-message-pane', - 'id' => 'conpherence-message-pane' - ), - array( - javelin_tag( - 'div', - array( - 'class' => 'conpherence-messages', - 'id' => 'conpherence-messages', - 'sigil' => 'conpherence-messages', - ), - ''), - phutil_tag( - 'div', - array( - 'id' => 'conpherence-form' - ), - '') - )) - )); - } - - } diff --git a/src/applications/conpherence/controller/ConpherenceViewController.php b/src/applications/conpherence/controller/ConpherenceViewController.php index 5ae7710927..0219d5f330 100644 --- a/src/applications/conpherence/controller/ConpherenceViewController.php +++ b/src/applications/conpherence/controller/ConpherenceViewController.php @@ -75,11 +75,11 @@ final class ConpherenceViewController extends $transactions = $data['transactions']; $update_uri = $this->getApplicationURI('update/'.$conpherence->getID().'/'); - $form_id = celerity_generate_unique_node_id(); + + Javelin::initBehavior('conpherence-pontificate'); $form = id(new AphrontFormView()) - ->setID($form_id) ->setAction($update_uri) ->setFlexible(true) ->addSigil('conpherence-pontificate') diff --git a/src/applications/conpherence/view/ConpherenceLayoutView.php b/src/applications/conpherence/view/ConpherenceLayoutView.php new file mode 100644 index 0000000000..cda4035d65 --- /dev/null +++ b/src/applications/conpherence/view/ConpherenceLayoutView.php @@ -0,0 +1,88 @@ +baseURI = $base_uri; + return $this; + } + + public function setSelectedConpherencePHID($selected_conpherence_phid) { + $this->selectedConpherencePHID = $selected_conpherence_phid; + return $this; + } + + public function render() { + + Javelin::initBehavior('conpherence-menu', + array( + 'base_uri' => $this->baseURI, + 'header' => 'conpherence-header-pane', + 'messages' => 'conpherence-messages', + 'messages_pane' => 'conpherence-message-pane', + 'widgets_pane' => 'conpherence-widget-pane', + 'form_pane' => 'conpherence-form', + 'menu_pane' => 'conpherence-menu', + 'selected_conpherence_id' => $this->selectedConpherencePHID, + 'fancy_ajax' => (bool)$this->selectedConpherencePHID, + )); + + Javelin::initBehavior('conpherence-drag-and-drop-photo', + array( + 'target' => 'conpherence-header-pane', + 'form_pane' => 'conpherence-form', + 'upload_uri' => '/file/dropupload/', + 'activated_class' => 'conpherence-header-upload-photo', + )); + + return javelin_tag( + 'div', + array( + 'id' => 'conpherence-main-pane', + 'sigil' => 'conpherence-layout' + ), + array( + javelin_tag( + 'div', + array( + 'class' => 'conpherence-header-pane', + 'id' => 'conpherence-header-pane', + 'sigil' => 'conpherence-header', + ), + ''), + phutil_tag( + 'div', + array( + 'class' => 'conpherence-widget-pane', + 'id' => 'conpherence-widget-pane' + ), + ''), + javelin_tag( + 'div', + array( + 'class' => 'conpherence-message-pane', + 'id' => 'conpherence-message-pane' + ), + array( + javelin_tag( + 'div', + array( + 'class' => 'conpherence-messages', + 'id' => 'conpherence-messages', + 'sigil' => 'conpherence-messages', + ), + ''), + phutil_tag( + 'div', + array( + 'id' => 'conpherence-form' + ), + '') + )) + )); + } + +}