1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-23 23:32:40 +01:00

render_tag -> tag: fix more callsites (more view, misc)

Summary: Fixes even more callsites.

Test Plan: See inlines.

Reviewers: vrana

Reviewed By: vrana

CC: aran

Maniphest Tasks: T2432

Differential Revision: https://secure.phabricator.com/D4749
This commit is contained in:
epriestley 2013-01-31 09:08:02 -08:00
parent 95d37af5d9
commit 7f43826854
8 changed files with 78 additions and 40 deletions

View file

@ -244,12 +244,14 @@ final class DifferentialChangesetViewController extends DifferentialController {
$detail->setVsChangesetID($left_source); $detail->setVsChangesetID($left_source);
$panel = new DifferentialPrimaryPaneView(); $panel = new DifferentialPrimaryPaneView();
$panel->appendChild(phutil_render_tag('div', $panel->appendChild(
phutil_tag(
'div',
array( array(
'class' => 'differential-review-stage', 'class' => 'differential-review-stage',
'id' => 'differential-review-stage', 'id' => 'differential-review-stage',
), $detail->render()) ),
); $detail->render()));
return $this->buildStandardPageResponse( return $this->buildStandardPageResponse(
array( array(

View file

@ -148,7 +148,7 @@ final class DifferentialDiffTableOfContentsView extends AphrontView {
$rows[] = $rows[] =
'<tr>'. '<tr>'.
phutil_render_tag( phutil_tag(
'td', 'td',
array( array(
'class' => 'differential-toc-char', 'class' => 'differential-toc-char',

View file

@ -88,13 +88,13 @@ final class DifferentialLocalCommitsView extends AphrontView {
$summary = phutil_utf8_shorten($summary, 80); $summary = phutil_utf8_shorten($summary, 80);
$view = new AphrontMoreView(); $view = new AphrontMoreView();
$view->setSome(phutil_escape_html($summary)); $view->setSome($summary);
if ($message && (trim($summary) != trim($message))) { if ($message && (trim($summary) != trim($message))) {
$view->setMore(nl2br(phutil_escape_html($message))); $view->setMore(phutil_escape_html_newlines($message));
} }
$row[] = phutil_render_tag( $row[] = phutil_tag(
'td', 'td',
array( array(
'class' => 'summary', 'class' => 'summary',

View file

@ -159,13 +159,20 @@ final class DifferentialRevisionCommentListView extends AphrontView {
array( array(
'markup' => implode("\n", $hidden), 'markup' => implode("\n", $hidden),
)); ));
$hidden = javelin_render_tag( $hidden = javelin_tag(
'div', 'div',
array( array(
'sigil' => "differential-all-comments-container", 'sigil' => "differential-all-comments-container",
), ),
'<div class="differential-older-comments-are-hidden">'. phutil_tag(
pht('%d older comments are hidden. ', number_format(count($hidden))). 'div',
array(
'class' => 'differential-older-comments-are-hidden',
),
array(
pht(
'%d older comments are hidden. ',
number_format(count($hidden))),
javelin_tag( javelin_tag(
'a', 'a',
array( array(
@ -173,8 +180,8 @@ final class DifferentialRevisionCommentListView extends AphrontView {
'mustcapture' => true, 'mustcapture' => true,
'sigil' => 'differential-show-all-comments', 'sigil' => 'differential-show-all-comments',
), ),
pht('Show all comments.')). pht('Show all comments.')),
'</div>'); )));
} else { } else {
$hidden = null; $hidden = null;
} }

View file

@ -271,6 +271,10 @@ final class DiffusionBrowseFileController extends DiffusionController {
'sigil' => 'diffusion-source', 'sigil' => 'diffusion-source',
), ),
implode("\n", $rows)); implode("\n", $rows));
// TODO: [HTML] Major cheating here.
$corpus_table = phutil_safe_html($corpus_table);
$corpus = phutil_tag( $corpus = phutil_tag(
'div', 'div',
array( array(
@ -723,18 +727,29 @@ final class DiffusionBrowseFileController extends DiffusionController {
array( array(
'target' => 'scroll_target', 'target' => 'scroll_target',
)); ));
$anchor_text = '<a id="scroll_target"></a>'; $anchor_text = phutil_tag(
'a',
array(
'id' => 'scroll_target',
),
'');
} else { } else {
$anchor_text = null; $anchor_text = null;
} }
$blame[] = phutil_render_tag( $blame[] = phutil_tag(
'td', 'td',
array( array(
), ),
$anchor_text. array(
"\xE2\x80\x8B". // NOTE: See phabricator-oncopy behavior. $anchor_text,
$line['data']);
// NOTE: See phabricator-oncopy behavior.
"\xE2\x80\x8B",
// TODO: [HTML] Not ideal.
phutil_safe_html($line['data']),
));
$rows[] = phutil_tag( $rows[] = phutil_tag(
'tr', 'tr',

View file

@ -442,13 +442,25 @@ final class DiffusionCommitController extends DiffusionController {
foreach ($parents as $parent) { foreach ($parents as $parent) {
$parent_links[] = $handles[$parent->getPHID()]->renderLink(); $parent_links[] = $handles[$parent->getPHID()]->renderLink();
} }
$props['Parents'] = implode(' &middot; ', $parent_links); $props['Parents'] = array_interleave(
" \xC2\xB7 ",
$parent_links);
} }
$request = $this->getDiffusionRequest(); $request = $this->getDiffusionRequest();
$props['Branches'] = '<span id="commit-branches">Unknown</span>'; $props['Branches'] = phutil_tag(
$props['Tags'] = '<span id="commit-tags">Unknown</span>'; 'span',
array(
'id' => 'commit-branches',
),
'Unknown');
$props['Tags'] = phutil_tag(
'span',
array(
'id' => 'commit-tags',
),
'Unknown');
$callsign = $request->getRepository()->getCallsign(); $callsign = $request->getRepository()->getCallsign();
$root = '/diffusion/'.$callsign.'/commit/'.$commit->getCommitIdentifier(); $root = '/diffusion/'.$callsign.'/commit/'.$commit->getCommitIdentifier();
@ -906,8 +918,8 @@ final class DiffusionCommitController extends DiffusionController {
), ),
$ref); $ref);
} }
$ref_links = implode(', ', $ref_links);
return $ref_links; return array_interleave(', ', $ref_links);
} }
private function buildRawDiffResponse(DiffusionRequest $drequest) { private function buildRawDiffResponse(DiffusionRequest $drequest) {

View file

@ -44,8 +44,8 @@ final class PonderAddCommentView extends AphrontView {
->setValue($is_serious ? 'Submit' : 'Editorialize')); ->setValue($is_serious ? 'Submit' : 'Editorialize'));
$view = id(new AphrontMoreView()) $view = id(new AphrontMoreView())
->setSome(id(new AphrontNullView())->render()) ->setSome('')
->setMore($form->render()) ->setMore(phutil_safe_html($form->render()))
->setExpandText('Add Comment'); ->setExpandText('Add Comment');
return $view->render(); return $view->render();

View file

@ -22,17 +22,19 @@ final class AphrontMoreView extends AphrontView {
} }
public function render() { public function render() {
$some = $this->some;
$content = array();
$content[] = $this->some;
if ($this->more && $this->more != $this->some) {
$text = "(Show More\xE2\x80\xA6)"; $text = "(Show More\xE2\x80\xA6)";
if ($this->expandtext !== null) { if ($this->expandtext !== null) {
$text = $this->expandtext; $text = $this->expandtext;
} }
$link = null;
if ($this->more && $this->more != $this->some) {
Javelin::initBehavior('aphront-more'); Javelin::initBehavior('aphront-more');
$link = ' '.javelin_tag( $content[] = ' ';
$content[] = javelin_tag(
'a', 'a',
array( array(
'sigil' => 'aphront-more-view-show-more', 'sigil' => 'aphront-more-view-show-more',
@ -45,11 +47,11 @@ final class AphrontMoreView extends AphrontView {
$text); $text);
} }
return javelin_render_tag( return javelin_tag(
'div', 'div',
array( array(
'sigil' => 'aphront-more-view', 'sigil' => 'aphront-more-view',
), ),
$some.$link); $content);
} }
} }