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

Convert phutil_render_tag() to phutil_tag() for inline comments

Test Plan:
Looked at file with lint errors in Diffusion.

I've also tried inline comments in Differential but it failed.
I'll try it again after you land all your diffs.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T2432

Differential Revision: https://secure.phabricator.com/D4755
This commit is contained in:
vrana 2013-02-02 05:15:30 -08:00
parent de0261358f
commit 6e95901161
3 changed files with 37 additions and 36 deletions

View file

@ -324,26 +324,29 @@ final class DifferentialChangesetTwoUpRenderer
} }
} }
} }
$html[] = $html[] = hsprintf(
'<tr class="inline">'. '<tr class="inline">'.
'<th />'. '<th />'.
'<td class="left">'.$comment_html.'</td>'. '<td class="left">%s</td>'.
'<th />'. '<th />'.
'<td colspan="3" class="right3">'.$new.'</td>'. '<td colspan="3" class="right3">%s</td>'.
'</tr>'; '</tr>',
$comment_html,
$new);
} }
} }
if ($n_num && isset($new_comments[$n_num])) { if ($n_num && isset($new_comments[$n_num])) {
foreach ($new_comments[$n_num] as $comment) { foreach ($new_comments[$n_num] as $comment) {
$comment_html = $this->renderInlineComment($comment, $comment_html = $this->renderInlineComment($comment,
$on_right = true); $on_right = true);
$html[] = $html[] = hsprintf(
'<tr class="inline">'. '<tr class="inline">'.
'<th />'. '<th />'.
'<td class="left" />'. '<td class="left" />'.
'<th />'. '<th />'.
'<td colspan="3" class="right3">'.$comment_html.'</td>'. '<td colspan="3" class="right3">%s</td>'.
'</tr>'; '</tr>',
$comment_html);
} }
} }
} }

View file

@ -175,10 +175,10 @@ final class DifferentialInlineCommentView extends AphrontView {
} }
if ($links) { if ($links) {
$links = $links = phutil_tag(
'<span class="differential-inline-comment-links">'. 'span',
implode(' &middot; ', $links). array('class' => 'differential-inline-comment-links'),
'</span>'; array_interleave(" \xC2\xB7 ", $links));
} else { } else {
$links = null; $links = null;
} }
@ -217,24 +217,25 @@ final class DifferentialInlineCommentView extends AphrontView {
$author = $handles[$inline->getAuthorPHID()]->getName(); $author = $handles[$inline->getAuthorPHID()]->getName();
} }
$markup = javelin_render_tag( $markup = javelin_tag(
'div', 'div',
array( array(
'class' => $classes, 'class' => $classes,
'sigil' => $sigil, 'sigil' => $sigil,
'meta' => $metadata, 'meta' => $metadata,
), ),
hsprintf(
'<div class="differential-inline-comment-head">'. '<div class="differential-inline-comment-head">'.
$anchor. '%s%s <span class="differential-inline-comment-line">%s</span> %s'.
$links.
' <span class="differential-inline-comment-line">'.$line.'</span> '.
phutil_escape_html($author).
'</div>'. '</div>'.
'<div class="differential-inline-comment-content">'. '<div class="differential-inline-comment-content">'.
'<div class="phabricator-remarkup">'. '<div class="phabricator-remarkup">%s</div>'.
$content. '</div>',
'</div>'. $anchor,
'</div>'); $links,
$line,
$author,
$content));
return $this->scaffoldMarkup($markup); return $this->scaffoldMarkup($markup);
} }
@ -247,15 +248,17 @@ final class DifferentialInlineCommentView extends AphrontView {
$left_markup = !$this->onRight ? $markup : ''; $left_markup = !$this->onRight ? $markup : '';
$right_markup = $this->onRight ? $markup : ''; $right_markup = $this->onRight ? $markup : '';
return return hsprintf(
'<table>'. '<table>'.
'<tr class="inline">'. '<tr class="inline">'.
'<th></th>'. '<th></th>'.
'<td class="left">'.$left_markup.'</td>'. '<td class="left">%s</td>'.
'<th></th>'. '<th></th>'.
'<td class="right3" colspan="3">'.$right_markup.'</td>'. '<td class="right3" colspan="3">%s</td>'.
'</tr>'. '</tr>'.
'</table>'; '</table>',
$left_markup,
$right_markup);
} }
} }

View file

@ -264,16 +264,13 @@ final class DiffusionBrowseFileController extends DiffusionController {
)); ));
} }
$corpus_table = javelin_render_tag( $corpus_table = javelin_tag(
'table', 'table',
array( array(
'class' => "diffusion-source remarkup-code PhabricatorMonospaced", 'class' => "diffusion-source remarkup-code PhabricatorMonospaced",
'sigil' => 'diffusion-source', 'sigil' => 'diffusion-source',
), ),
implode("\n", $rows)); $rows);
// TODO: [HTML] Major cheating here.
$corpus_table = phutil_safe_html($corpus_table);
$corpus = phutil_tag( $corpus = phutil_tag(
'div', 'div',
@ -774,11 +771,9 @@ final class DiffusionBrowseFileController extends DiffusionController {
->setMarkupEngine($engine) ->setMarkupEngine($engine)
->setInlineComment($inline) ->setInlineComment($inline)
->render(); ->render();
$rows[] = $row = array_fill(0, ($needs_blame ? 5 : 1), phutil_tag('th'));
'<tr class="inline">'. $row[] = phutil_tag('td', array(), $inline_view);
str_repeat('<th></th>', ($needs_blame ? 5 : 1)). $rows[] = phutil_tag('tr', array('class' => 'inline'), $row);
'<td>'.$inline_view.'</td>'.
'</tr>';
} }
return $rows; return $rows;
} }