1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-04 20:01:00 +01:00

Tidy context displayed in gap

Summary:
We have some complaints on this feature:

- It's not clear that the displayed code is context from gap.
- It would be better if the context would be displayed with its real indentation.
- It's not clear how far the context is from the displayed code.
- Links revealing gap aren't on consistent place.

This solves all these problems and introduces new one:
It now seems that the reveal links works only with the left side.
Anyway, I think that this is better overall.

I don't want to put the context on a separate line to not waste space.

Test Plan: Displayed various contexts, revealed context.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin, bh, jwatzman

Differential Revision: https://secure.phabricator.com/D3404
This commit is contained in:
vrana 2012-08-29 16:34:52 -07:00
parent cc0b74b01a
commit 0f9f8b5f30
4 changed files with 63 additions and 45 deletions

View file

@ -680,7 +680,7 @@ celerity_register_resource_map(array(
),
'differential-changeset-view-css' =>
array(
'uri' => '/res/28449eff/rsrc/css/application/differential/changeset-view.css',
'uri' => '/res/8ef2b180/rsrc/css/application/differential/changeset-view.css',
'type' => 'css',
'requires' =>
array(
@ -1189,7 +1189,7 @@ celerity_register_resource_map(array(
),
'javelin-behavior-differential-show-more' =>
array(
'uri' => '/res/e92c5272/rsrc/js/application/differential/behavior-show-more.js',
'uri' => '/res/88115daf/rsrc/js/application/differential/behavior-show-more.js',
'type' => 'js',
'requires' =>
array(
@ -3000,7 +3000,7 @@ celerity_register_resource_map(array(
'uri' => '/res/pkg/462ee6cf/core.pkg.js',
'type' => 'js',
),
'0a1a85e9' =>
'2ba14b3d' =>
array(
'name' => 'differential.pkg.css',
'symbols' =>
@ -3020,10 +3020,10 @@ celerity_register_resource_map(array(
12 => 'differential-local-commits-view-css',
13 => 'inline-comment-summary-css',
),
'uri' => '/res/pkg/0a1a85e9/differential.pkg.css',
'uri' => '/res/pkg/2ba14b3d/differential.pkg.css',
'type' => 'css',
),
'605ce8ec' =>
'670ad7f1' =>
array(
'name' => 'differential.pkg.js',
'symbols' =>
@ -3046,7 +3046,7 @@ celerity_register_resource_map(array(
15 => 'differential-inline-comment-editor',
16 => 'javelin-behavior-differential-dropdown-menus',
),
'uri' => '/res/pkg/605ce8ec/differential.pkg.js',
'uri' => '/res/pkg/670ad7f1/differential.pkg.js',
'type' => 'js',
),
'c8ce2d88' =>
@ -3142,7 +3142,7 @@ celerity_register_resource_map(array(
'aphront-dialog-view-css' => '7cca2ba4',
'aphront-error-view-css' => '7cca2ba4',
'aphront-form-view-css' => '7cca2ba4',
'aphront-headsup-action-list-view-css' => '0a1a85e9',
'aphront-headsup-action-list-view-css' => '2ba14b3d',
'aphront-headsup-view-css' => '7cca2ba4',
'aphront-list-filter-view-css' => '7cca2ba4',
'aphront-pager-view-css' => '7cca2ba4',
@ -3152,36 +3152,36 @@ celerity_register_resource_map(array(
'aphront-tokenizer-control-css' => '7cca2ba4',
'aphront-tooltip-css' => '7cca2ba4',
'aphront-typeahead-control-css' => '7cca2ba4',
'differential-changeset-view-css' => '0a1a85e9',
'differential-core-view-css' => '0a1a85e9',
'differential-inline-comment-editor' => '605ce8ec',
'differential-local-commits-view-css' => '0a1a85e9',
'differential-results-table-css' => '0a1a85e9',
'differential-revision-add-comment-css' => '0a1a85e9',
'differential-revision-comment-css' => '0a1a85e9',
'differential-revision-comment-list-css' => '0a1a85e9',
'differential-revision-history-css' => '0a1a85e9',
'differential-revision-list-css' => '0a1a85e9',
'differential-table-of-contents-css' => '0a1a85e9',
'differential-changeset-view-css' => '2ba14b3d',
'differential-core-view-css' => '2ba14b3d',
'differential-inline-comment-editor' => '670ad7f1',
'differential-local-commits-view-css' => '2ba14b3d',
'differential-results-table-css' => '2ba14b3d',
'differential-revision-add-comment-css' => '2ba14b3d',
'differential-revision-comment-css' => '2ba14b3d',
'differential-revision-comment-list-css' => '2ba14b3d',
'differential-revision-history-css' => '2ba14b3d',
'differential-revision-list-css' => '2ba14b3d',
'differential-table-of-contents-css' => '2ba14b3d',
'diffusion-commit-view-css' => 'c8ce2d88',
'diffusion-icons-css' => 'c8ce2d88',
'inline-comment-summary-css' => '0a1a85e9',
'inline-comment-summary-css' => '2ba14b3d',
'javelin-behavior' => '6fb20113',
'javelin-behavior-aphront-basic-tokenizer' => '97f65640',
'javelin-behavior-aphront-drag-and-drop' => '605ce8ec',
'javelin-behavior-aphront-drag-and-drop-textarea' => '605ce8ec',
'javelin-behavior-aphront-drag-and-drop' => '670ad7f1',
'javelin-behavior-aphront-drag-and-drop-textarea' => '670ad7f1',
'javelin-behavior-aphront-form-disable-on-submit' => '462ee6cf',
'javelin-behavior-audit-preview' => '5e68be89',
'javelin-behavior-differential-accept-with-errors' => '605ce8ec',
'javelin-behavior-differential-add-reviewers-and-ccs' => '605ce8ec',
'javelin-behavior-differential-comment-jump' => '605ce8ec',
'javelin-behavior-differential-diff-radios' => '605ce8ec',
'javelin-behavior-differential-dropdown-menus' => '605ce8ec',
'javelin-behavior-differential-edit-inline-comments' => '605ce8ec',
'javelin-behavior-differential-feedback-preview' => '605ce8ec',
'javelin-behavior-differential-keyboard-navigation' => '605ce8ec',
'javelin-behavior-differential-populate' => '605ce8ec',
'javelin-behavior-differential-show-more' => '605ce8ec',
'javelin-behavior-differential-accept-with-errors' => '670ad7f1',
'javelin-behavior-differential-add-reviewers-and-ccs' => '670ad7f1',
'javelin-behavior-differential-comment-jump' => '670ad7f1',
'javelin-behavior-differential-diff-radios' => '670ad7f1',
'javelin-behavior-differential-dropdown-menus' => '670ad7f1',
'javelin-behavior-differential-edit-inline-comments' => '670ad7f1',
'javelin-behavior-differential-feedback-preview' => '670ad7f1',
'javelin-behavior-differential-keyboard-navigation' => '670ad7f1',
'javelin-behavior-differential-populate' => '670ad7f1',
'javelin-behavior-differential-show-more' => '670ad7f1',
'javelin-behavior-diffusion-commit-graph' => '5e68be89',
'javelin-behavior-diffusion-pull-lastmodified' => '5e68be89',
'javelin-behavior-maniphest-batch-selector' => '7707de41',
@ -3191,12 +3191,12 @@ celerity_register_resource_map(array(
'javelin-behavior-maniphest-transaction-preview' => '7707de41',
'javelin-behavior-phabricator-autofocus' => '462ee6cf',
'javelin-behavior-phabricator-keyboard-shortcuts' => '462ee6cf',
'javelin-behavior-phabricator-object-selector' => '605ce8ec',
'javelin-behavior-phabricator-object-selector' => '670ad7f1',
'javelin-behavior-phabricator-oncopy' => '462ee6cf',
'javelin-behavior-phabricator-tooltips' => '462ee6cf',
'javelin-behavior-phabricator-watch-anchor' => '462ee6cf',
'javelin-behavior-refresh-csrf' => '462ee6cf',
'javelin-behavior-repository-crossreference' => '605ce8ec',
'javelin-behavior-repository-crossreference' => '670ad7f1',
'javelin-behavior-workflow' => '462ee6cf',
'javelin-dom' => '6fb20113',
'javelin-event' => '6fb20113',
@ -3218,23 +3218,23 @@ celerity_register_resource_map(array(
'maniphest-task-summary-css' => '7839ae2d',
'maniphest-transaction-detail-css' => '7839ae2d',
'phabricator-app-buttons-css' => '7cca2ba4',
'phabricator-content-source-view-css' => '0a1a85e9',
'phabricator-content-source-view-css' => '2ba14b3d',
'phabricator-core-buttons-css' => '7cca2ba4',
'phabricator-core-css' => '7cca2ba4',
'phabricator-directory-css' => '7cca2ba4',
'phabricator-drag-and-drop-file-upload' => '605ce8ec',
'phabricator-drag-and-drop-file-upload' => '670ad7f1',
'phabricator-dropdown-menu' => '462ee6cf',
'phabricator-flag-css' => '7cca2ba4',
'phabricator-jump-nav' => '7cca2ba4',
'phabricator-keyboard-shortcut' => '462ee6cf',
'phabricator-keyboard-shortcut-manager' => '462ee6cf',
'phabricator-menu-item' => '462ee6cf',
'phabricator-object-selector-css' => '0a1a85e9',
'phabricator-object-selector-css' => '2ba14b3d',
'phabricator-paste-file-upload' => '462ee6cf',
'phabricator-prefab' => '462ee6cf',
'phabricator-project-tag-css' => '7839ae2d',
'phabricator-remarkup-css' => '7cca2ba4',
'phabricator-shaped-request' => '605ce8ec',
'phabricator-shaped-request' => '670ad7f1',
'phabricator-standard-page-view' => '7cca2ba4',
'phabricator-tooltip' => '462ee6cf',
'phabricator-transaction-view-css' => '7cca2ba4',

View file

@ -1464,15 +1464,17 @@ final class DifferentialChangesetParser {
: "\xE2\x96\xBC Show 20 Lines");
}
$context = null;
$context_line = null;
if (!$is_last_block && $depths[$ii + $len]) {
for ($l = $ii + $len - 1; $l >= $ii; $l--) {
$line = $this->new[$l]['text'];
if ($depths[$l] < $depths[$ii + $len] && trim($line) != '') {
$contents[] = '<code>'.$this->newRender[$l].'</code>';
$context = $this->newRender[$l];
$context_line = $this->new[$l]['line'];
break;
}
}
}
$container = javelin_render_tag(
@ -1480,9 +1482,11 @@ final class DifferentialChangesetParser {
array(
'sigil' => 'context-target',
),
'<td colspan="6" class="show-more">'.
'<td colspan="2" class="show-more">'.
implode(' &bull; ', $contents).
'</td>');
'</td>'.
'<th class="show-context-line">'.$context_line.'</td>'.
'<td colspan="2" class="show-context">'.$context.'</td>');
$html[] = $container;

View file

@ -149,23 +149,37 @@ td.cov-X {
}
.differential-diff td.show-more,
.differential-diff th.show-context-line,
.differential-diff td.show-context,
.differential-diff td.differential-shield {
background: #ffffee;
padding: 1em;
text-align: center;
border: 1px solid #ccccaa;
}
.differential-diff td.show-more,
.differential-diff td.differential-shield {
font-family: "Verdana";
font-size: 11px;
border: 1px solid #ccccaa;
white-space: normal;
}
.differential-diff td.show-more {
text-align: center;
color: #999966;
}
.differential-diff th.show-context-line {
padding-right: 6px;
}
.differential-diff td.show-context {
padding-left: 14px; /* td.copy + .differential-diff td */
}
.differential-diff td.differential-shield {
text-align: center;
max-width: 1160px;
text-align: center;
}
.differential-diff td.differential-shield a {

View file

@ -36,7 +36,7 @@ JX.behavior('differential-show-more', function(config) {
var context = e.getData().context;
var data = JX.Stratcom.getData(e.getData().show);
var container = JX.DOM.find(context, 'td');
var container = JX.DOM.scry(context, 'td')[0];
JX.DOM.setContent(container, 'Loading...');
JX.DOM.alterClass(context, 'differential-show-more-loading', true);
data['whitespace'] = config.whitespace;