1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-21 13:00:56 +01:00

Consolidate Conpherence frame rendering

Summary: Conpherence frame rendering is spread out a bit across ConpherenceController, ConpherenceListController, and previously ConpherenceNewController. I want to let the Thread and Widget controllers render the frame for mobile. Ref T2421.

Test Plan: Viewed conpherences, switched between conpherences.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2421

Differential Revision: https://secure.phabricator.com/D5501
This commit is contained in:
epriestley 2013-04-01 12:43:07 -07:00
parent 7b07f6ab3d
commit 7ef2edd300
5 changed files with 96 additions and 81 deletions

View file

@ -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',

View file

@ -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');
}
}

View file

@ -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'
),
'')
))
));
}
}

View file

@ -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')

View file

@ -0,0 +1,88 @@
<?php
final class ConpherenceLayoutView extends AphrontView {
private $selectedConpherencePHID;
private $baseURI;
public function setBaseURI($base_uri) {
$this->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'
),
'')
))
));
}
}