mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-26 15:30:58 +01:00
a161617d8e
Summary: does the title and also a few other small tweaks - kills the init js behavior; now its part of menu where it belongs. - adds the underline to the icon when its toggled in the widget menu - fixed JS initialization errors on the "create conpherence" page. Note I still like keeping all that init stuff in one function because its typing the same data a bunch to be passed over to the JS layer. Other ways to accomplish this obvi... Only fun wrinkle here is I think Chad intended me to display "when the file was attached". Instead, I display when the file was *uploaded*. I think this jives better with our version where you can't delete and all that. Files are pretty powerful, long-living objects in Phabricator land. Test Plan: added files to a conpherence and noted widget loaded updated okay. added a file with no author (generated by the system) and verified it still rendered okay. switched between conpherences and verified proper data in each files widget. uploaded image and text files to check the icons were correct. Reviewers: epriestley, chad Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2530 Differential Revision: https://secure.phabricator.com/D5337
99 lines
2.3 KiB
PHP
99 lines
2.3 KiB
PHP
<?php
|
|
|
|
final class PhabricatorFileLinkView extends AphrontView {
|
|
|
|
private $fileName;
|
|
private $fileDownloadURI;
|
|
private $fileViewURI;
|
|
private $fileViewable;
|
|
private $filePHID;
|
|
private $customClass;
|
|
|
|
public function setCustomClass($custom_class) {
|
|
$this->customClass = $custom_class;
|
|
return $this;
|
|
}
|
|
public function getCustomClass() {
|
|
return $this->customClass;
|
|
}
|
|
|
|
public function setFilePHID($file_phid) {
|
|
$this->filePHID = $file_phid;
|
|
return $this;
|
|
}
|
|
private function getFilePHID() {
|
|
return $this->filePHID;
|
|
}
|
|
|
|
public function setFileViewable($file_viewable) {
|
|
$this->fileViewable = $file_viewable;
|
|
return $this;
|
|
}
|
|
private function getFileViewable() {
|
|
return $this->fileViewable;
|
|
}
|
|
|
|
public function setFileViewURI($file_view_uri) {
|
|
$this->fileViewURI = $file_view_uri;
|
|
return $this;
|
|
}
|
|
private function getFileViewURI() {
|
|
return $this->fileViewURI;
|
|
}
|
|
|
|
public function setFileDownloadURI($file_download_uri) {
|
|
$this->fileDownloadURI = $file_download_uri;
|
|
return $this;
|
|
}
|
|
private function getFileDownloadURI() {
|
|
return $this->fileDownloadURI;
|
|
}
|
|
|
|
public function setFileName($file_name) {
|
|
$this->fileName = $file_name;
|
|
return $this;
|
|
}
|
|
private function getFileName() {
|
|
return $this->fileName;
|
|
}
|
|
|
|
public function getMetadata() {
|
|
return array(
|
|
'phid' => $this->getFilePHID(),
|
|
'viewable' => $this->getFileViewable(),
|
|
'uri' => $this->getFileViewURI(),
|
|
'dUri' => $this->getFileDownloadURI(),
|
|
'name' => $this->getFileName(),
|
|
);
|
|
}
|
|
|
|
public function render() {
|
|
require_celerity_resource('phabricator-remarkup-css');
|
|
require_celerity_resource('lightbox-attachment-css');
|
|
|
|
$sigil = null;
|
|
$meta = null;
|
|
$mustcapture = false;
|
|
if ($this->getFileViewable()) {
|
|
$mustcapture = true;
|
|
$sigil = 'lightboxable';
|
|
$meta = $this->getMetadata();
|
|
}
|
|
|
|
$class = 'phabricator-remarkup-embed-layout-link';
|
|
if ($this->getCustomClass()) {
|
|
$class = $this->getCustomClass();
|
|
}
|
|
|
|
return javelin_tag(
|
|
'a',
|
|
array(
|
|
'href' => $this->getFileViewURI(),
|
|
'class' => $class,
|
|
'sigil' => $sigil,
|
|
'meta' => $meta,
|
|
'mustcapture' => $mustcapture,
|
|
),
|
|
$this->getFileName());
|
|
}
|
|
}
|