mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-28 15:38:19 +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:
parent
fb59101cde
commit
0a9f378594
6 changed files with 76 additions and 41 deletions
|
@ -234,6 +234,10 @@ final class DifferentialChangesetViewController extends DifferentialController {
|
||||||
|
|
||||||
Javelin::initBehavior('differential-comment-jump', array());
|
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 = new DifferentialChangesetDetailView();
|
||||||
$detail->setChangeset($changeset);
|
$detail->setChangeset($changeset);
|
||||||
$detail->appendChild($output);
|
$detail->appendChild($output);
|
||||||
|
|
|
@ -319,9 +319,11 @@ abstract class DifferentialChangesetHTMLRenderer
|
||||||
$meta['whitespace'] = DifferentialChangesetParser::WHITESPACE_SHOW_ALL;
|
$meta['whitespace'] = DifferentialChangesetParser::WHITESPACE_SHOW_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
$more = null;
|
$content = array();
|
||||||
|
$content[] = $message;
|
||||||
if ($force !== 'none') {
|
if ($force !== 'none') {
|
||||||
$more = ' '.javelin_tag(
|
$content[] = ' ';
|
||||||
|
$content[] = javelin_tag(
|
||||||
'a',
|
'a',
|
||||||
array(
|
array(
|
||||||
'mustcapture' => true,
|
'mustcapture' => true,
|
||||||
|
@ -334,15 +336,18 @@ abstract class DifferentialChangesetHTMLRenderer
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->wrapChangeInTable(
|
return $this->wrapChangeInTable(
|
||||||
javelin_render_tag(
|
javelin_tag(
|
||||||
'tr',
|
'tr',
|
||||||
array(
|
array(
|
||||||
'sigil' => 'context-target',
|
'sigil' => 'context-target',
|
||||||
),
|
),
|
||||||
'<td class="differential-shield" colspan="6">'.
|
phutil_tag(
|
||||||
phutil_escape_html($message).
|
'td',
|
||||||
$more.
|
array(
|
||||||
'</td>'));
|
'class' => 'differential-shield',
|
||||||
|
'colspan' => 6,
|
||||||
|
),
|
||||||
|
$content)));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function wrapChangeInTable($content) {
|
protected function wrapChangeInTable($content) {
|
||||||
|
@ -350,7 +355,10 @@ abstract class DifferentialChangesetHTMLRenderer
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return javelin_render_tag(
|
// TODO: [HTML] After TwoUpRenderer gets refactored, fix this.
|
||||||
|
$content = phutil_safe_html($content);
|
||||||
|
|
||||||
|
return javelin_tag(
|
||||||
'table',
|
'table',
|
||||||
array(
|
array(
|
||||||
'class' => 'differential-diff remarkup-code PhabricatorMonospaced',
|
'class' => 'differential-diff remarkup-code PhabricatorMonospaced',
|
||||||
|
|
|
@ -148,16 +148,36 @@ final class DifferentialChangesetTwoUpRenderer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$container = javelin_render_tag(
|
$container = javelin_tag(
|
||||||
'tr',
|
'tr',
|
||||||
array(
|
array(
|
||||||
'sigil' => 'context-target',
|
'sigil' => 'context-target',
|
||||||
),
|
),
|
||||||
'<td colspan="2" class="show-more">'.
|
array(
|
||||||
implode(' • ', $contents).
|
phutil_tag(
|
||||||
'</td>'.
|
'td',
|
||||||
'<th class="show-context-line">'.$context_line.'</td>'.
|
array(
|
||||||
'<td colspan="3" class="show-context">'.$context.'</td>');
|
'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;
|
$html[] = $container;
|
||||||
|
|
||||||
|
|
|
@ -59,10 +59,12 @@ final class DifferentialChangesetDetailView extends AphrontView {
|
||||||
|
|
||||||
$buttons = null;
|
$buttons = null;
|
||||||
if ($this->buttons) {
|
if ($this->buttons) {
|
||||||
$buttons =
|
$buttons = phutil_tag(
|
||||||
'<div class="differential-changeset-buttons">'.
|
'div',
|
||||||
implode('', $this->buttons).
|
array(
|
||||||
'</div>';
|
'class' => 'differential-changeset-buttons',
|
||||||
|
),
|
||||||
|
$this->buttons);
|
||||||
}
|
}
|
||||||
|
|
||||||
$id = $this->getID();
|
$id = $this->getID();
|
||||||
|
@ -77,7 +79,7 @@ final class DifferentialChangesetDetailView extends AphrontView {
|
||||||
|
|
||||||
$display_filename = $changeset->getDisplayFilename();
|
$display_filename = $changeset->getDisplayFilename();
|
||||||
|
|
||||||
$output = javelin_render_tag(
|
return javelin_tag(
|
||||||
'div',
|
'div',
|
||||||
array(
|
array(
|
||||||
'sigil' => 'differential-changeset',
|
'sigil' => 'differential-changeset',
|
||||||
|
@ -90,17 +92,17 @@ final class DifferentialChangesetDetailView extends AphrontView {
|
||||||
'class' => $class,
|
'class' => $class,
|
||||||
'id' => $id,
|
'id' => $id,
|
||||||
),
|
),
|
||||||
|
$this->renderHTMLView(
|
||||||
|
array(
|
||||||
id(new PhabricatorAnchorView())
|
id(new PhabricatorAnchorView())
|
||||||
->setAnchorName($changeset->getAnchorName())
|
->setAnchorName($changeset->getAnchorName())
|
||||||
->setNavigationMarker(true)
|
->setNavigationMarker(true)
|
||||||
->render().
|
->render(),
|
||||||
$buttons.
|
$buttons,
|
||||||
'<h1>'.phutil_escape_html($display_filename).'</h1>'.
|
phutil_tag('h1', array(), $display_filename),
|
||||||
'<div style="clear: both;"></div>'.
|
phutil_tag('div', array('style' => 'clear: both'), ''),
|
||||||
$this->renderChildren());
|
$this->renderHTMLChildren(),
|
||||||
|
)));
|
||||||
|
|
||||||
return $output;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,17 +192,19 @@ final class DifferentialChangesetListView extends AphrontView {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return $this->renderHTMLView(
|
||||||
|
array(
|
||||||
id(new PhabricatorHeaderView())
|
id(new PhabricatorHeaderView())
|
||||||
->setHeader($this->getTitle())
|
->setHeader($this->getTitle())
|
||||||
->render().
|
->render(),
|
||||||
phutil_render_tag(
|
phutil_tag(
|
||||||
'div',
|
'div',
|
||||||
array(
|
array(
|
||||||
'class' => 'differential-review-stage',
|
'class' => 'differential-review-stage',
|
||||||
'id' => 'differential-review-stage',
|
'id' => 'differential-review-stage',
|
||||||
),
|
),
|
||||||
implode("\n", $output));
|
$output),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -81,7 +81,6 @@ JX.behavior('dark-console', function(config, statics) {
|
||||||
JX.DOM.alterClass(req.all[req.current], 'dark-selected', true);
|
JX.DOM.alterClass(req.all[req.current], 'dark-selected', true);
|
||||||
|
|
||||||
if (statics.visible) {
|
if (statics.visible) {
|
||||||
JX.log('visible!');
|
|
||||||
draw_request(key);
|
draw_request(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue