1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

render_tag -> tag: Differential Changeset stuff

Summary: I cheated in a couple of places here, but this is in the process of getting refactored anyway, and there's a pretty clear boundary.

Test Plan: Viewed changesets in Differential, viewed standalone. Viewed context elements.

Reviewers: vrana

Reviewed By: vrana

CC: aran

Maniphest Tasks: T2432

Differential Revision: https://secure.phabricator.com/D4723
This commit is contained in:
epriestley 2013-01-30 10:58:21 -08:00
parent fb59101cde
commit 0a9f378594
6 changed files with 76 additions and 41 deletions

View file

@ -234,6 +234,10 @@ final class DifferentialChangesetViewController extends DifferentialController {
Javelin::initBehavior('differential-comment-jump', array());
// TODO: [HTML] Clean up DifferentialChangesetParser output, but it's
// undergoing like six kinds of refactoring anyway.
$output = phutil_safe_html($output);
$detail = new DifferentialChangesetDetailView();
$detail->setChangeset($changeset);
$detail->appendChild($output);

View file

@ -319,9 +319,11 @@ abstract class DifferentialChangesetHTMLRenderer
$meta['whitespace'] = DifferentialChangesetParser::WHITESPACE_SHOW_ALL;
}
$more = null;
$content = array();
$content[] = $message;
if ($force !== 'none') {
$more = ' '.javelin_tag(
$content[] = ' ';
$content[] = javelin_tag(
'a',
array(
'mustcapture' => true,
@ -334,15 +336,18 @@ abstract class DifferentialChangesetHTMLRenderer
}
return $this->wrapChangeInTable(
javelin_render_tag(
javelin_tag(
'tr',
array(
'sigil' => 'context-target',
),
'<td class="differential-shield" colspan="6">'.
phutil_escape_html($message).
$more.
'</td>'));
phutil_tag(
'td',
array(
'class' => 'differential-shield',
'colspan' => 6,
),
$content)));
}
protected function wrapChangeInTable($content) {
@ -350,7 +355,10 @@ abstract class DifferentialChangesetHTMLRenderer
return null;
}
return javelin_render_tag(
// TODO: [HTML] After TwoUpRenderer gets refactored, fix this.
$content = phutil_safe_html($content);
return javelin_tag(
'table',
array(
'class' => 'differential-diff remarkup-code PhabricatorMonospaced',

View file

@ -148,16 +148,36 @@ final class DifferentialChangesetTwoUpRenderer
}
}
$container = javelin_render_tag(
$container = javelin_tag(
'tr',
array(
'sigil' => 'context-target',
),
'<td colspan="2" class="show-more">'.
implode(' &bull; ', $contents).
'</td>'.
'<th class="show-context-line">'.$context_line.'</td>'.
'<td colspan="3" class="show-context">'.$context.'</td>');
array(
phutil_tag(
'td',
array(
'colspan' => 2,
'class' => 'show-more',
),
array_interleave(
" \xE2\x80\xA2 ", // Bullet
$contents)),
phutil_tag(
'th',
array(
'class' => 'show-context-line',
),
$context_line ? (int)$context_line : null),
phutil_tag(
'td',
array(
'colspan' => 3,
'class' => 'show-context',
),
// TODO: [HTML] Escaping model here isn't ideal.
phutil_safe_html($context)),
));
$html[] = $container;

View file

@ -59,10 +59,12 @@ final class DifferentialChangesetDetailView extends AphrontView {
$buttons = null;
if ($this->buttons) {
$buttons =
'<div class="differential-changeset-buttons">'.
implode('', $this->buttons).
'</div>';
$buttons = phutil_tag(
'div',
array(
'class' => 'differential-changeset-buttons',
),
$this->buttons);
}
$id = $this->getID();
@ -77,7 +79,7 @@ final class DifferentialChangesetDetailView extends AphrontView {
$display_filename = $changeset->getDisplayFilename();
$output = javelin_render_tag(
return javelin_tag(
'div',
array(
'sigil' => 'differential-changeset',
@ -90,17 +92,17 @@ final class DifferentialChangesetDetailView extends AphrontView {
'class' => $class,
'id' => $id,
),
id(new PhabricatorAnchorView())
->setAnchorName($changeset->getAnchorName())
->setNavigationMarker(true)
->render().
$buttons.
'<h1>'.phutil_escape_html($display_filename).'</h1>'.
'<div style="clear: both;"></div>'.
$this->renderChildren());
return $output;
$this->renderHTMLView(
array(
id(new PhabricatorAnchorView())
->setAnchorName($changeset->getAnchorName())
->setNavigationMarker(true)
->render(),
$buttons,
phutil_tag('h1', array(), $display_filename),
phutil_tag('div', array('style' => 'clear: both'), ''),
$this->renderHTMLChildren(),
)));
}
}

View file

@ -192,17 +192,19 @@ final class DifferentialChangesetListView extends AphrontView {
));
}
return
id(new PhabricatorHeaderView())
->setHeader($this->getTitle())
->render().
phutil_render_tag(
'div',
return $this->renderHTMLView(
array(
'class' => 'differential-review-stage',
'id' => 'differential-review-stage',
),
implode("\n", $output));
id(new PhabricatorHeaderView())
->setHeader($this->getTitle())
->render(),
phutil_tag(
'div',
array(
'class' => 'differential-review-stage',
'id' => 'differential-review-stage',
),
$output),
));
}
/**

View file

@ -81,7 +81,6 @@ JX.behavior('dark-console', function(config, statics) {
JX.DOM.alterClass(req.all[req.current], 'dark-selected', true);
if (statics.visible) {
JX.log('visible!');
draw_request(key);
}
}