mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-28 17:52:43 +01:00
ddf97c0e8a
Summary: files widget updates as new files are added. made basically all edits "ajax" except for when you change the conpherence image which just does a reload. I will fix this in a future diff but it was starting to spiral out of control a bit. Test Plan: commented on a task with files and noted the updated file widget. updated header image via drag and drop and dialogue -- noted a full reload. cropped image and re-titled conpherence - ajax updated as expected. Reviewers: epriestley, chad Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2530 Differential Revision: https://secure.phabricator.com/D5288
65 lines
1.6 KiB
PHP
65 lines
1.6 KiB
PHP
<?php
|
|
|
|
final class ConpherenceFileWidgetView extends AphrontView {
|
|
|
|
private $conpherence;
|
|
private $updateURI;
|
|
|
|
public function setUpdateURI($update_uri) {
|
|
$this->updateURI = $update_uri;
|
|
return $this;
|
|
}
|
|
public function getUpdateURI() {
|
|
return $this->updateURI;
|
|
}
|
|
|
|
public function setConpherence(ConpherenceThread $conpherence) {
|
|
$this->conpherence = $conpherence;
|
|
return $this;
|
|
}
|
|
public function getConpherence() {
|
|
return $this->conpherence;
|
|
}
|
|
|
|
public function render() {
|
|
$conpherence = $this->getConpherence();
|
|
$widget_data = $conpherence->getWidgetData();
|
|
$files = $widget_data['files'];
|
|
|
|
$table_data = array();
|
|
|
|
foreach ($files as $file) {
|
|
$file_view = id(new PhabricatorFileLinkView())
|
|
->setFilePHID($file->getPHID())
|
|
->setFileName($file->getName())
|
|
->setFileViewable(true)
|
|
->setFileViewURI($file->getBestURI());
|
|
$meta = $file_view->getMetadata();
|
|
|
|
$table_data[] = array(
|
|
javelin_tag(
|
|
'a',
|
|
array(
|
|
'sigil' => 'lightboxable',
|
|
'meta' => $meta
|
|
),
|
|
phutil_tag(
|
|
'img',
|
|
array(
|
|
'src' => $file->getThumb60x45URI()
|
|
),
|
|
'')),
|
|
$file_view->render()
|
|
);
|
|
}
|
|
$header = id(new PhabricatorHeaderView())
|
|
->setHeader(pht('Attached Files'));
|
|
$table = id(new AphrontTableView($table_data))
|
|
->setNoDataString(pht('No files attached to conpherence.'))
|
|
->setHeaders(array('', pht('Name')))
|
|
->setColumnClasses(array('', 'wide wrap'));
|
|
return $this->renderSingleView(array($header, $table));
|
|
|
|
}
|
|
|
|
}
|