1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +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:
epriestley 2013-01-28 18:09:00 -08:00
parent f9030885c4
commit d83257c29a
9 changed files with 36 additions and 16 deletions

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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));

View file

@ -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;

View file

@ -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',

View file

@ -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);
}

View file

@ -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();

View file

@ -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,
)));
}
}

View file

@ -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',