mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-27 16:00:59 +01:00
Fix object ObjectItemListView attributes
Summary: This works after pht() + html got sorted out. Test Plan: Looked at some object attribute lists. Reviewers: vrana Reviewed By: vrana CC: aran Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4645
This commit is contained in:
parent
f9030885c4
commit
d83257c29a
9 changed files with 36 additions and 16 deletions
|
@ -79,8 +79,7 @@ final class PhabricatorCalendarViewStatusController
|
|||
->setBarColor($color)
|
||||
->addAttribute(pht('From %s to %s', $from, $to))
|
||||
->addAttribute(
|
||||
phutil_escape_html(
|
||||
phutil_utf8_shorten($status->getDescription(), 64)));
|
||||
phutil_utf8_shorten($status->getDescription(), 64));
|
||||
|
||||
$list->addItem($item);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ final class PhabricatorConfigListController
|
|||
$item = id(new PhabricatorObjectItemView())
|
||||
->setHeader($group->getName())
|
||||
->setHref('/config/group/'.$group->getKey().'/')
|
||||
->addAttribute(phutil_escape_html($group->getDescription()));
|
||||
->addAttribute($group->getDescription());
|
||||
$list->addItem($item);
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ abstract class DrydockController extends PhabricatorController {
|
|||
}
|
||||
|
||||
$status = DrydockLeaseStatus::getNameForStatus($lease->getStatus());
|
||||
$item->addAttribute(phutil_escape_html($status));
|
||||
$item->addAttribute($status);
|
||||
|
||||
$date_created = phabricator_date($lease->getDateCreated(), $user);
|
||||
$item->addAttribute(pht('Created on %s', $date_created));
|
||||
|
|
|
@ -51,8 +51,7 @@ final class PhabricatorApplicationsListController
|
|||
$item = id(new PhabricatorObjectItemView())
|
||||
->setHeader($application->getName())
|
||||
->setHref('/applications/view/'.get_class($application).'/')
|
||||
->addAttribute(
|
||||
phutil_escape_html($application->getShortDescription()));
|
||||
->addAttribute($application->getShortDescription());
|
||||
$list->addItem($item);
|
||||
}
|
||||
return $list;
|
||||
|
|
|
@ -85,7 +85,8 @@ final class PhabricatorPasteListController extends PhabricatorPasteController {
|
|||
$created = phabricator_date($paste->getDateCreated(), $user);
|
||||
$author = $this->getHandle($paste->getAuthorPHID())->renderLink();
|
||||
$source_code = $this->buildSourceCodeView($paste, 5)->render();
|
||||
$source_code = phutil_render_tag(
|
||||
|
||||
$source_code = phutil_tag(
|
||||
'div',
|
||||
array(
|
||||
'class' => 'phabricator-source-code-summary',
|
||||
|
|
|
@ -84,7 +84,7 @@ final class PonderUserProfileView extends AphrontView {
|
|||
array(
|
||||
'href' => '/Q'.$question->getID(),
|
||||
),
|
||||
phutil_escape_html(self::abbreviate($question->getTitle())))));
|
||||
self::abbreviate($question->getTitle()))));
|
||||
|
||||
$view->addItem($item);
|
||||
}
|
||||
|
|
|
@ -36,6 +36,14 @@ abstract class AphrontView extends Phobject {
|
|||
return implode('', $out);
|
||||
}
|
||||
|
||||
final protected function renderHTMLChildren() {
|
||||
$out = array();
|
||||
foreach ($this->children as $child) {
|
||||
$out[] = $this->renderHTMLView($child);
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
final protected function renderSingleView($child) {
|
||||
if ($child instanceof AphrontView) {
|
||||
return $child->render();
|
||||
|
|
|
@ -48,7 +48,7 @@ final class PhabricatorObjectItemListView extends AphrontView {
|
|||
}
|
||||
|
||||
if ($this->items) {
|
||||
$items = $this->renderSingleView($this->items);
|
||||
$items = $this->renderHTMLView($this->items);
|
||||
} else {
|
||||
$string = nonempty($this->noDataString, pht('No data.'));
|
||||
$items = id(new AphrontErrorView())
|
||||
|
@ -59,7 +59,7 @@ final class PhabricatorObjectItemListView extends AphrontView {
|
|||
|
||||
$pager = null;
|
||||
if ($this->pager) {
|
||||
$pager = $this->renderSingleView($this->pager);
|
||||
$pager = $this->renderHTMLView($this->pager);
|
||||
}
|
||||
|
||||
$classes[] = 'phabricator-object-item-list-view';
|
||||
|
@ -67,12 +67,17 @@ final class PhabricatorObjectItemListView extends AphrontView {
|
|||
$classes[] = 'phabricator-object-list-stackable';
|
||||
}
|
||||
|
||||
return phutil_render_tag(
|
||||
return phutil_tag(
|
||||
'ul',
|
||||
array(
|
||||
'class' => implode(' ', $classes),
|
||||
),
|
||||
$header.$items.$pager);
|
||||
$this->renderHTMLView(
|
||||
array(
|
||||
$header,
|
||||
$items,
|
||||
$pager,
|
||||
)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -127,12 +127,15 @@ final class PhabricatorObjectItemView extends AphrontView {
|
|||
"\xC2\xB7");
|
||||
$first = true;
|
||||
foreach ($this->attributes as $attribute) {
|
||||
$attrs[] = phutil_render_tag(
|
||||
$attrs[] = phutil_tag(
|
||||
'li',
|
||||
array(
|
||||
'class' => 'phabricator-object-item-attribute',
|
||||
),
|
||||
($first ? null : $spacer).$attribute);
|
||||
array(
|
||||
($first ? null : $spacer),
|
||||
$attribute,
|
||||
));
|
||||
$first = false;
|
||||
}
|
||||
$attrs = phutil_tag(
|
||||
|
@ -158,12 +161,17 @@ final class PhabricatorObjectItemView extends AphrontView {
|
|||
throw new Exception("Invalid effect!");
|
||||
}
|
||||
|
||||
$content = phutil_render_tag(
|
||||
$content = phutil_tag(
|
||||
'div',
|
||||
array(
|
||||
'class' => 'phabricator-object-item-content',
|
||||
),
|
||||
$header.$attrs.$this->renderChildren());
|
||||
$this->renderHTMLView(
|
||||
array(
|
||||
$header,
|
||||
$attrs,
|
||||
$this->renderHTMLChildren(),
|
||||
)));
|
||||
|
||||
return phutil_tag(
|
||||
'li',
|
||||
|
|
Loading…
Reference in a new issue