1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-01 03:02:43 +01:00
phorge-phorge/src/applications/differential/view/DifferentialResultsTableView.php
epriestley 40547030a5 render_tag -> tag: PropertyListView
Summary: Converts callsites in PropertyListView (addDetail() and setTextContent()).

Test Plan: Grepped for PhabricatorPropertyListView, addDetail() and setTextContent().

Reviewers: vrana

Reviewed By: vrana

CC: aran

Maniphest Tasks: T2432

Differential Revision: https://secure.phabricator.com/D4695
2013-01-29 11:01:47 -08:00

115 lines
2.5 KiB
PHP

<?php
final class DifferentialResultsTableView extends AphrontView {
private $rows;
private $showMoreString;
public function setRows(array $rows) {
$this->rows = $rows;
return $this;
}
public function setShowMoreString($show_more_string) {
$this->showMoreString = $show_more_string;
return $this;
}
public function render() {
$rows = array();
$any_hidden = false;
foreach ($this->rows as $row) {
$style = idx($row, 'style');
switch ($style) {
case 'section':
$cells = phutil_tag(
'th',
array(
'colspan' => 2,
),
idx($row, 'name'));
break;
default:
$name = phutil_tag(
'th',
array(
),
idx($row, 'name'));
$value = phutil_tag(
'td',
array(
),
idx($row, 'value'));
$cells = array($name, $value);
break;
}
$show = idx($row, 'show');
$rows[] = javelin_tag(
'tr',
array(
'style' => $show ? null : 'display: none',
'sigil' => $show ? null : 'differential-results-row-toggle',
'class' => 'differential-results-row-'.$style,
),
$cells);
if (!$show) {
$any_hidden = true;
}
}
if ($any_hidden) {
$show_more = javelin_tag(
'a',
array(
'href' => '#',
'mustcapture' => true,
),
$this->showMoreString);
$hide_more = javelin_tag(
'a',
array(
'href' => '#',
'mustcapture' => true,
),
'Hide');
$rows[] = javelin_tag(
'tr',
array(
'class' => 'differential-results-row-show',
'sigil' => 'differential-results-row-show',
),
phutil_tag('th', array('colspan' => 2), $show_more));
$rows[] = javelin_tag(
'tr',
array(
'class' => 'differential-results-row-show',
'sigil' => 'differential-results-row-hide',
'style' => 'display: none',
),
phutil_tag('th', array('colspan' => 2), $hide_more));
Javelin::initBehavior('differential-show-field-details');
}
require_celerity_resource('differential-results-table-css');
return javelin_tag(
'table',
array(
'class' => 'differential-results-table',
'sigil' => 'differential-results-table',
),
$rows);
}
}