1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-28 16:30:59 +01:00

Add "thread" role and allow threads to render without thread lists

Summary: The actual layout on mobile is a bit silly since the thread ends up being like 5px tall for now, but it technically works. Ref T2644.

Test Plan: {F38106}

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, chad

Maniphest Tasks: T2421

Differential Revision: https://secure.phabricator.com/D5506
This commit is contained in:
epriestley 2013-04-01 12:52:30 -07:00
parent 0b2bcf2793
commit 5ba5cb5675
7 changed files with 119 additions and 68 deletions

View file

@ -92,45 +92,44 @@ abstract class ConpherenceController extends PhabricatorController {
$edit_href = $this->getApplicationURI('update/'.$conpherence->getID().'/');
$class_mod = $display_data['image_class'];
$header =
phutil_tag(
'div',
array(
'class' => 'upload-photo'
),
pht('Drop photo here to change this Conpherence photo.')).
javelin_tag(
'a',
array(
'class' => 'edit',
'href' => $edit_href,
'sigil' => 'conpherence-edit-metadata',
'meta' => array(
'action' => 'metadata'
)
),
'').
phutil_tag(
'div',
array(
'class' => $class_mod.'header-image',
'style' => 'background-image: url('.$display_data['image'].');'
),
'').
phutil_tag(
'div',
array(
'class' => $class_mod.'title',
),
$display_data['title']).
phutil_tag(
'div',
array(
'class' => $class_mod.'subtitle',
),
$display_data['subtitle']);
return $header;
return array(
phutil_tag(
'div',
array(
'class' => 'upload-photo'
),
pht('Drop photo here to change this Conpherence photo.')),
javelin_tag(
'a',
array(
'class' => 'edit',
'href' => $edit_href,
'sigil' => 'conpherence-edit-metadata',
'meta' => array(
'action' => 'metadata'
)
),
''),
phutil_tag(
'div',
array(
'class' => $class_mod.'header-image',
'style' => 'background-image: url('.$display_data['image'].');'
),
''),
phutil_tag(
'div',
array(
'class' => $class_mod.'title',
),
$display_data['title']),
phutil_tag(
'div',
array(
'class' => $class_mod.'subtitle',
),
$display_data['subtitle']),
);
}
protected function renderConpherenceTransactions(

View file

@ -3,8 +3,8 @@
/**
* @group conpherence
*/
final class ConpherenceUpdateController extends
ConpherenceController {
final class ConpherenceUpdateController
extends ConpherenceController {
private $conpherenceID;
@ -265,10 +265,10 @@ final class ConpherenceUpdateController extends
$rendered_transactions = $data['transactions'];
$new_latest_transaction_id = $data['latest_transaction_id'];
$selected = true;
$nav_item = $this->buildConpherenceMenuItem(
$conpherence,
$selected);
$nav_item = id(new ConpherenceThreadListView())
->setUser($user)
->setBaseURI($this->getApplicationURI())
->renderSingleThread($conpherence);
$header = $this->buildHeaderPaneContent($conpherence);
@ -281,9 +281,9 @@ final class ConpherenceUpdateController extends
$content = array(
'transactions' => $rendered_transactions,
'latest_transaction_id' => $new_latest_transaction_id,
'nav_item' => $nav_item->render(),
'nav_item' => hsprintf('%s', $nav_item),
'conpherence_phid' => $conpherence->getPHID(),
'header' => $header,
'header' => hsprintf('%s', $header),
'file_widget' => $file_widget->render()
);
return $content;

View file

@ -54,14 +54,32 @@ final class ConpherenceViewController extends
$header = $this->renderHeaderPaneContent();
$messages = $this->renderMessagePaneContent();
$content = $header + $messages;
return id(new AphrontAjaxResponse())->setContent($content);
if ($request->isAjax()) {
return id(new AphrontAjaxResponse())->setContent($content);
}
$layout = id(new ConpherenceLayoutView())
->setBaseURI($this->getApplicationURI())
->setThread($conpherence)
->setHeader($header)
->setMessages($messages['messages'])
->setReplyForm($messages['form'])
->setRole('thread');
return $this->buildApplicationPage(
$layout,
array(
'title' => $conpherence->getTitle(),
'device' => true,
));
}
private function renderHeaderPaneContent() {
require_celerity_resource('conpherence-header-pane-css');
$conpherence = $this->getConpherence();
$header = $this->buildHeaderPaneContent($conpherence);
return array('header' => $header);
return array('header' => hsprintf('%s', $header));
}
@ -107,7 +125,7 @@ final class ConpherenceViewController extends
pht('Show Older Messages'));
return array(
'messages' => $scrollbutton.$transactions,
'messages' => hsprintf('%s%s', $scrollbutton, $transactions),
'form' => $form
);

View file

@ -6,6 +6,24 @@ final class ConpherenceLayoutView extends AphrontView {
private $baseURI;
private $threadView;
private $role;
private $header;
private $messages;
private $replyForm;
public function setMessages($messages) {
$this->messages = $messages;
return $this;
}
public function setReplyForm($reply_form) {
$this->replyForm = $reply_form;
return $this;
}
public function setHeader($header) {
$this->header = $header;
return $this;
}
public function setRole($role) {
$this->role = $role;
@ -32,6 +50,7 @@ final class ConpherenceLayoutView extends AphrontView {
}
public function render() {
require_celerity_resource('conpherence-menu-css');
Javelin::initBehavior('conpherence-menu',
array(
@ -87,7 +106,7 @@ final class ConpherenceLayoutView extends AphrontView {
'id' => 'conpherence-header-pane',
'sigil' => 'conpherence-header',
),
''),
nonempty($this->header, '')),
phutil_tag(
'div',
array(
@ -109,13 +128,13 @@ final class ConpherenceLayoutView extends AphrontView {
'id' => 'conpherence-messages',
'sigil' => 'conpherence-messages',
),
''),
nonempty($this->messages, '')),
phutil_tag(
'div',
array(
'id' => 'conpherence-form'
),
'')
nonempty($this->replyForm, ''))
)),
)),
));

View file

@ -46,6 +46,16 @@ final class ConpherenceThreadListView extends AphrontView {
return $menu;
}
public function renderSingleThread(ConpherenceThread $thread) {
return $this->renderThread($thread);
}
private function renderThreadItem(ConpherenceThread $thread) {
return id(new PhabricatorMenuItemView())
->setType(PhabricatorMenuItemView::TYPE_CUSTOM)
->setName($this->renderThread($thread));
}
private function renderThread(ConpherenceThread $thread) {
$user = $this->getUser();
@ -58,7 +68,7 @@ final class ConpherenceThreadListView extends AphrontView {
$image = $data['image'];
$snippet = $data['snippet'];
$item = id(new ConpherenceMenuItemView())
return id(new ConpherenceMenuItemView())
->setUser($user)
->setTitle($title)
->setSubtitle($subtitle)
@ -73,10 +83,6 @@ final class ConpherenceThreadListView extends AphrontView {
array(
'id' => $thread->getID(),
));
return id(new PhabricatorMenuItemView())
->setType(PhabricatorMenuItemView::TYPE_CUSTOM)
->setName($item);
}
private function addThreadsToMenu(
@ -85,7 +91,7 @@ final class ConpherenceThreadListView extends AphrontView {
$read = false) {
foreach ($conpherences as $conpherence) {
$item = $this->renderThread($conpherence);
$item = $this->renderThreadItem($conpherence);
$menu->addMenuItem($item);
}

View file

@ -8,15 +8,6 @@
width: 100%;
}
.device .conpherence-header-pane {
position: fixed;
top: 44px;
}
.device-phone .conpherence-header-pane {
display: none;
}
.conpherence-header-pane .edit {
float: right;
margin: 16px 16px 0px 0px;

View file

@ -38,6 +38,24 @@ div.conpherence-layout .phabricator-nav-column-background {
display: none;
}
.device .conpherence-role-thread .conpherence-menu-pane,
.device .conpherence-role-thread .phabricator-nav-column-background,
.device .conpherence-role-thread .conpherence-widget-pane {
display: none;
}
.device .conpherence-role-thread .conpherence-content-pane {
margin-left: 0;
}
.device .conpherence-role-thread .conpherence-message-pane,
.device .conpherence-role-thread .conpherence-messages,
.device .conpherence-role-thread .phabricator-form-view {
left: 0;
right: 0;
width: 100%;
}
.conpherence-menu .conpherence-menu-item-view {
display: block;