From 7f43826854d2be401c95d5df36a004c414c1f8fe Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 31 Jan 2013 09:08:02 -0800 Subject: [PATCH] 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 --- .../DifferentialChangesetViewController.php | 8 +++-- .../DifferentialDiffTableOfContentsView.php | 2 +- .../view/DifferentialLocalCommitsView.php | 6 ++-- .../DifferentialRevisionCommentListView.php | 31 ++++++++++++------- .../DiffusionBrowseFileController.php | 25 ++++++++++++--- .../controller/DiffusionCommitController.php | 22 ++++++++++--- .../ponder/view/PonderAddCommentView.php | 4 +-- src/view/layout/AphrontMoreView.php | 20 ++++++------ 8 files changed, 78 insertions(+), 40 deletions(-) diff --git a/src/applications/differential/controller/DifferentialChangesetViewController.php b/src/applications/differential/controller/DifferentialChangesetViewController.php index 3d7454c229..e1c35f9808 100644 --- a/src/applications/differential/controller/DifferentialChangesetViewController.php +++ b/src/applications/differential/controller/DifferentialChangesetViewController.php @@ -244,12 +244,14 @@ final class DifferentialChangesetViewController extends DifferentialController { $detail->setVsChangesetID($left_source); $panel = new DifferentialPrimaryPaneView(); - $panel->appendChild(phutil_render_tag('div', + $panel->appendChild( + phutil_tag( + 'div', array( 'class' => 'differential-review-stage', 'id' => 'differential-review-stage', - ), $detail->render()) - ); + ), + $detail->render())); return $this->buildStandardPageResponse( array( diff --git a/src/applications/differential/view/DifferentialDiffTableOfContentsView.php b/src/applications/differential/view/DifferentialDiffTableOfContentsView.php index 75de304237..cd30fa0c90 100644 --- a/src/applications/differential/view/DifferentialDiffTableOfContentsView.php +++ b/src/applications/differential/view/DifferentialDiffTableOfContentsView.php @@ -148,7 +148,7 @@ final class DifferentialDiffTableOfContentsView extends AphrontView { $rows[] = ''. - phutil_render_tag( + phutil_tag( 'td', array( 'class' => 'differential-toc-char', diff --git a/src/applications/differential/view/DifferentialLocalCommitsView.php b/src/applications/differential/view/DifferentialLocalCommitsView.php index f3f6eab6de..6a3cae9439 100644 --- a/src/applications/differential/view/DifferentialLocalCommitsView.php +++ b/src/applications/differential/view/DifferentialLocalCommitsView.php @@ -88,13 +88,13 @@ final class DifferentialLocalCommitsView extends AphrontView { $summary = phutil_utf8_shorten($summary, 80); $view = new AphrontMoreView(); - $view->setSome(phutil_escape_html($summary)); + $view->setSome($summary); 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', array( 'class' => 'summary', diff --git a/src/applications/differential/view/DifferentialRevisionCommentListView.php b/src/applications/differential/view/DifferentialRevisionCommentListView.php index 8edeaeea81..ebccc8c78a 100644 --- a/src/applications/differential/view/DifferentialRevisionCommentListView.php +++ b/src/applications/differential/view/DifferentialRevisionCommentListView.php @@ -159,22 +159,29 @@ final class DifferentialRevisionCommentListView extends AphrontView { array( 'markup' => implode("\n", $hidden), )); - $hidden = javelin_render_tag( + $hidden = javelin_tag( 'div', array( 'sigil' => "differential-all-comments-container", ), - '
'. - pht('%d older comments are hidden. ', number_format(count($hidden))). - javelin_tag( - 'a', - array( - 'href' => '#', - 'mustcapture' => true, - 'sigil' => 'differential-show-all-comments', - ), - pht('Show all comments.')). - '
'); + phutil_tag( + 'div', + array( + 'class' => 'differential-older-comments-are-hidden', + ), + array( + pht( + '%d older comments are hidden. ', + number_format(count($hidden))), + javelin_tag( + 'a', + array( + 'href' => '#', + 'mustcapture' => true, + 'sigil' => 'differential-show-all-comments', + ), + pht('Show all comments.')), + ))); } else { $hidden = null; } diff --git a/src/applications/diffusion/controller/DiffusionBrowseFileController.php b/src/applications/diffusion/controller/DiffusionBrowseFileController.php index 534ddd7e8c..b690c484ea 100644 --- a/src/applications/diffusion/controller/DiffusionBrowseFileController.php +++ b/src/applications/diffusion/controller/DiffusionBrowseFileController.php @@ -271,6 +271,10 @@ final class DiffusionBrowseFileController extends DiffusionController { 'sigil' => 'diffusion-source', ), implode("\n", $rows)); + + // TODO: [HTML] Major cheating here. + $corpus_table = phutil_safe_html($corpus_table); + $corpus = phutil_tag( 'div', array( @@ -723,18 +727,29 @@ final class DiffusionBrowseFileController extends DiffusionController { array( 'target' => 'scroll_target', )); - $anchor_text = ''; + $anchor_text = phutil_tag( + 'a', + array( + 'id' => 'scroll_target', + ), + ''); } else { $anchor_text = null; } - $blame[] = phutil_render_tag( + $blame[] = phutil_tag( 'td', array( ), - $anchor_text. - "\xE2\x80\x8B". // NOTE: See phabricator-oncopy behavior. - $line['data']); + array( + $anchor_text, + + // NOTE: See phabricator-oncopy behavior. + "\xE2\x80\x8B", + + // TODO: [HTML] Not ideal. + phutil_safe_html($line['data']), + )); $rows[] = phutil_tag( 'tr', diff --git a/src/applications/diffusion/controller/DiffusionCommitController.php b/src/applications/diffusion/controller/DiffusionCommitController.php index 7181c0b5da..52392e1746 100644 --- a/src/applications/diffusion/controller/DiffusionCommitController.php +++ b/src/applications/diffusion/controller/DiffusionCommitController.php @@ -442,13 +442,25 @@ final class DiffusionCommitController extends DiffusionController { foreach ($parents as $parent) { $parent_links[] = $handles[$parent->getPHID()]->renderLink(); } - $props['Parents'] = implode(' · ', $parent_links); + $props['Parents'] = array_interleave( + " \xC2\xB7 ", + $parent_links); } $request = $this->getDiffusionRequest(); - $props['Branches'] = 'Unknown'; - $props['Tags'] = 'Unknown'; + $props['Branches'] = phutil_tag( + 'span', + array( + 'id' => 'commit-branches', + ), + 'Unknown'); + $props['Tags'] = phutil_tag( + 'span', + array( + 'id' => 'commit-tags', + ), + 'Unknown'); $callsign = $request->getRepository()->getCallsign(); $root = '/diffusion/'.$callsign.'/commit/'.$commit->getCommitIdentifier(); @@ -906,8 +918,8 @@ final class DiffusionCommitController extends DiffusionController { ), $ref); } - $ref_links = implode(', ', $ref_links); - return $ref_links; + + return array_interleave(', ', $ref_links); } private function buildRawDiffResponse(DiffusionRequest $drequest) { diff --git a/src/applications/ponder/view/PonderAddCommentView.php b/src/applications/ponder/view/PonderAddCommentView.php index 16a324e7f4..f23f624df7 100644 --- a/src/applications/ponder/view/PonderAddCommentView.php +++ b/src/applications/ponder/view/PonderAddCommentView.php @@ -44,8 +44,8 @@ final class PonderAddCommentView extends AphrontView { ->setValue($is_serious ? 'Submit' : 'Editorialize')); $view = id(new AphrontMoreView()) - ->setSome(id(new AphrontNullView())->render()) - ->setMore($form->render()) + ->setSome('') + ->setMore(phutil_safe_html($form->render())) ->setExpandText('Add Comment'); return $view->render(); diff --git a/src/view/layout/AphrontMoreView.php b/src/view/layout/AphrontMoreView.php index 3eb89714a5..0bd1b82d80 100644 --- a/src/view/layout/AphrontMoreView.php +++ b/src/view/layout/AphrontMoreView.php @@ -22,17 +22,19 @@ final class AphrontMoreView extends AphrontView { } public function render() { - $some = $this->some; - $text = "(Show More\xE2\x80\xA6)"; - if ($this->expandtext !== null) { - $text = $this->expandtext; - } + $content = array(); + $content[] = $this->some; - $link = null; if ($this->more && $this->more != $this->some) { + $text = "(Show More\xE2\x80\xA6)"; + if ($this->expandtext !== null) { + $text = $this->expandtext; + } + Javelin::initBehavior('aphront-more'); - $link = ' '.javelin_tag( + $content[] = ' '; + $content[] = javelin_tag( 'a', array( 'sigil' => 'aphront-more-view-show-more', @@ -45,11 +47,11 @@ final class AphrontMoreView extends AphrontView { $text); } - return javelin_render_tag( + return javelin_tag( 'div', array( 'sigil' => 'aphront-more-view', ), - $some.$link); + $content); } }