mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-29 00:40:57 +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:
parent
0b2bcf2793
commit
5ba5cb5675
7 changed files with 119 additions and 68 deletions
|
@ -92,45 +92,44 @@ abstract class ConpherenceController extends PhabricatorController {
|
||||||
$edit_href = $this->getApplicationURI('update/'.$conpherence->getID().'/');
|
$edit_href = $this->getApplicationURI('update/'.$conpherence->getID().'/');
|
||||||
$class_mod = $display_data['image_class'];
|
$class_mod = $display_data['image_class'];
|
||||||
|
|
||||||
$header =
|
return array(
|
||||||
phutil_tag(
|
phutil_tag(
|
||||||
'div',
|
'div',
|
||||||
array(
|
array(
|
||||||
'class' => 'upload-photo'
|
'class' => 'upload-photo'
|
||||||
),
|
),
|
||||||
pht('Drop photo here to change this Conpherence photo.')).
|
pht('Drop photo here to change this Conpherence photo.')),
|
||||||
javelin_tag(
|
javelin_tag(
|
||||||
'a',
|
'a',
|
||||||
array(
|
array(
|
||||||
'class' => 'edit',
|
'class' => 'edit',
|
||||||
'href' => $edit_href,
|
'href' => $edit_href,
|
||||||
'sigil' => 'conpherence-edit-metadata',
|
'sigil' => 'conpherence-edit-metadata',
|
||||||
'meta' => array(
|
'meta' => array(
|
||||||
'action' => 'metadata'
|
'action' => 'metadata'
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'').
|
''),
|
||||||
phutil_tag(
|
phutil_tag(
|
||||||
'div',
|
'div',
|
||||||
array(
|
array(
|
||||||
'class' => $class_mod.'header-image',
|
'class' => $class_mod.'header-image',
|
||||||
'style' => 'background-image: url('.$display_data['image'].');'
|
'style' => 'background-image: url('.$display_data['image'].');'
|
||||||
),
|
),
|
||||||
'').
|
''),
|
||||||
phutil_tag(
|
phutil_tag(
|
||||||
'div',
|
'div',
|
||||||
array(
|
array(
|
||||||
'class' => $class_mod.'title',
|
'class' => $class_mod.'title',
|
||||||
),
|
),
|
||||||
$display_data['title']).
|
$display_data['title']),
|
||||||
phutil_tag(
|
phutil_tag(
|
||||||
'div',
|
'div',
|
||||||
array(
|
array(
|
||||||
'class' => $class_mod.'subtitle',
|
'class' => $class_mod.'subtitle',
|
||||||
),
|
),
|
||||||
$display_data['subtitle']);
|
$display_data['subtitle']),
|
||||||
|
);
|
||||||
return $header;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function renderConpherenceTransactions(
|
protected function renderConpherenceTransactions(
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
/**
|
/**
|
||||||
* @group conpherence
|
* @group conpherence
|
||||||
*/
|
*/
|
||||||
final class ConpherenceUpdateController extends
|
final class ConpherenceUpdateController
|
||||||
ConpherenceController {
|
extends ConpherenceController {
|
||||||
|
|
||||||
private $conpherenceID;
|
private $conpherenceID;
|
||||||
|
|
||||||
|
@ -265,10 +265,10 @@ final class ConpherenceUpdateController extends
|
||||||
$rendered_transactions = $data['transactions'];
|
$rendered_transactions = $data['transactions'];
|
||||||
$new_latest_transaction_id = $data['latest_transaction_id'];
|
$new_latest_transaction_id = $data['latest_transaction_id'];
|
||||||
|
|
||||||
$selected = true;
|
$nav_item = id(new ConpherenceThreadListView())
|
||||||
$nav_item = $this->buildConpherenceMenuItem(
|
->setUser($user)
|
||||||
$conpherence,
|
->setBaseURI($this->getApplicationURI())
|
||||||
$selected);
|
->renderSingleThread($conpherence);
|
||||||
|
|
||||||
$header = $this->buildHeaderPaneContent($conpherence);
|
$header = $this->buildHeaderPaneContent($conpherence);
|
||||||
|
|
||||||
|
@ -281,9 +281,9 @@ final class ConpherenceUpdateController extends
|
||||||
$content = array(
|
$content = array(
|
||||||
'transactions' => $rendered_transactions,
|
'transactions' => $rendered_transactions,
|
||||||
'latest_transaction_id' => $new_latest_transaction_id,
|
'latest_transaction_id' => $new_latest_transaction_id,
|
||||||
'nav_item' => $nav_item->render(),
|
'nav_item' => hsprintf('%s', $nav_item),
|
||||||
'conpherence_phid' => $conpherence->getPHID(),
|
'conpherence_phid' => $conpherence->getPHID(),
|
||||||
'header' => $header,
|
'header' => hsprintf('%s', $header),
|
||||||
'file_widget' => $file_widget->render()
|
'file_widget' => $file_widget->render()
|
||||||
);
|
);
|
||||||
return $content;
|
return $content;
|
||||||
|
|
|
@ -54,14 +54,32 @@ final class ConpherenceViewController extends
|
||||||
$header = $this->renderHeaderPaneContent();
|
$header = $this->renderHeaderPaneContent();
|
||||||
$messages = $this->renderMessagePaneContent();
|
$messages = $this->renderMessagePaneContent();
|
||||||
$content = $header + $messages;
|
$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() {
|
private function renderHeaderPaneContent() {
|
||||||
require_celerity_resource('conpherence-header-pane-css');
|
require_celerity_resource('conpherence-header-pane-css');
|
||||||
$conpherence = $this->getConpherence();
|
$conpherence = $this->getConpherence();
|
||||||
$header = $this->buildHeaderPaneContent($conpherence);
|
$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'));
|
pht('Show Older Messages'));
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'messages' => $scrollbutton.$transactions,
|
'messages' => hsprintf('%s%s', $scrollbutton, $transactions),
|
||||||
'form' => $form
|
'form' => $form
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,24 @@ final class ConpherenceLayoutView extends AphrontView {
|
||||||
private $baseURI;
|
private $baseURI;
|
||||||
private $threadView;
|
private $threadView;
|
||||||
private $role;
|
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) {
|
public function setRole($role) {
|
||||||
$this->role = $role;
|
$this->role = $role;
|
||||||
|
@ -32,6 +50,7 @@ final class ConpherenceLayoutView extends AphrontView {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render() {
|
public function render() {
|
||||||
|
require_celerity_resource('conpherence-menu-css');
|
||||||
|
|
||||||
Javelin::initBehavior('conpherence-menu',
|
Javelin::initBehavior('conpherence-menu',
|
||||||
array(
|
array(
|
||||||
|
@ -87,7 +106,7 @@ final class ConpherenceLayoutView extends AphrontView {
|
||||||
'id' => 'conpherence-header-pane',
|
'id' => 'conpherence-header-pane',
|
||||||
'sigil' => 'conpherence-header',
|
'sigil' => 'conpherence-header',
|
||||||
),
|
),
|
||||||
''),
|
nonempty($this->header, '')),
|
||||||
phutil_tag(
|
phutil_tag(
|
||||||
'div',
|
'div',
|
||||||
array(
|
array(
|
||||||
|
@ -109,13 +128,13 @@ final class ConpherenceLayoutView extends AphrontView {
|
||||||
'id' => 'conpherence-messages',
|
'id' => 'conpherence-messages',
|
||||||
'sigil' => 'conpherence-messages',
|
'sigil' => 'conpherence-messages',
|
||||||
),
|
),
|
||||||
''),
|
nonempty($this->messages, '')),
|
||||||
phutil_tag(
|
phutil_tag(
|
||||||
'div',
|
'div',
|
||||||
array(
|
array(
|
||||||
'id' => 'conpherence-form'
|
'id' => 'conpherence-form'
|
||||||
),
|
),
|
||||||
'')
|
nonempty($this->replyForm, ''))
|
||||||
)),
|
)),
|
||||||
)),
|
)),
|
||||||
));
|
));
|
||||||
|
|
|
@ -46,6 +46,16 @@ final class ConpherenceThreadListView extends AphrontView {
|
||||||
return $menu;
|
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) {
|
private function renderThread(ConpherenceThread $thread) {
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
|
|
||||||
|
@ -58,7 +68,7 @@ final class ConpherenceThreadListView extends AphrontView {
|
||||||
$image = $data['image'];
|
$image = $data['image'];
|
||||||
$snippet = $data['snippet'];
|
$snippet = $data['snippet'];
|
||||||
|
|
||||||
$item = id(new ConpherenceMenuItemView())
|
return id(new ConpherenceMenuItemView())
|
||||||
->setUser($user)
|
->setUser($user)
|
||||||
->setTitle($title)
|
->setTitle($title)
|
||||||
->setSubtitle($subtitle)
|
->setSubtitle($subtitle)
|
||||||
|
@ -73,10 +83,6 @@ final class ConpherenceThreadListView extends AphrontView {
|
||||||
array(
|
array(
|
||||||
'id' => $thread->getID(),
|
'id' => $thread->getID(),
|
||||||
));
|
));
|
||||||
|
|
||||||
return id(new PhabricatorMenuItemView())
|
|
||||||
->setType(PhabricatorMenuItemView::TYPE_CUSTOM)
|
|
||||||
->setName($item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function addThreadsToMenu(
|
private function addThreadsToMenu(
|
||||||
|
@ -85,7 +91,7 @@ final class ConpherenceThreadListView extends AphrontView {
|
||||||
$read = false) {
|
$read = false) {
|
||||||
|
|
||||||
foreach ($conpherences as $conpherence) {
|
foreach ($conpherences as $conpherence) {
|
||||||
$item = $this->renderThread($conpherence);
|
$item = $this->renderThreadItem($conpherence);
|
||||||
$menu->addMenuItem($item);
|
$menu->addMenuItem($item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,15 +8,6 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.device .conpherence-header-pane {
|
|
||||||
position: fixed;
|
|
||||||
top: 44px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.device-phone .conpherence-header-pane {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.conpherence-header-pane .edit {
|
.conpherence-header-pane .edit {
|
||||||
float: right;
|
float: right;
|
||||||
margin: 16px 16px 0px 0px;
|
margin: 16px 16px 0px 0px;
|
||||||
|
|
|
@ -38,6 +38,24 @@ div.conpherence-layout .phabricator-nav-column-background {
|
||||||
display: none;
|
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 {
|
.conpherence-menu .conpherence-menu-item-view {
|
||||||
display: block;
|
display: block;
|
||||||
|
|
Loading…
Reference in a new issue