Don't display diff size or file status for commit message
+ Also display 'Commit message' instead of /COMMIT_MSG like in the GWT UI. Bug: Issue 3951 Change-Id: Iac62434c0359a290852f788e123a006982c86197
This commit is contained in:
@@ -132,7 +132,7 @@ limitations under the License.
|
||||
hidden$="[[!_loggedIn]]" hidden>
|
||||
<div class="jumpToFileContainer">
|
||||
<gr-button link class="dropdown-trigger" id="trigger" on-tap="_showDropdownTapHandler">
|
||||
<span>[[_path]]</span>
|
||||
<span>[[_computeFileDisplayName(_path)]]</span>
|
||||
<span class="downArrow">▼</span>
|
||||
</gr-button>
|
||||
<iron-dropdown id="dropdown" vertical-align="top" vertical-offset="25">
|
||||
@@ -141,7 +141,9 @@ limitations under the License.
|
||||
<a href$="[[_computeDiffURL(_changeNum, _patchRange, path)]]"
|
||||
selected$="[[_computeFileSelected(path, _path)]]"
|
||||
data-key-nav$="[[_computeKeyNav(path, _path, _fileList)]]"
|
||||
on-tap="_handleFileTap">[[path]]</a>
|
||||
on-tap="_handleFileTap">
|
||||
[[_computeFileDisplayName(path)]]
|
||||
</a>
|
||||
</template>
|
||||
</div>
|
||||
</iron-dropdown>
|
||||
@@ -152,7 +154,7 @@ limitations under the License.
|
||||
<option
|
||||
value$="[[path]]"
|
||||
selected$="[[_computeFileSelected(path, _path)]]">
|
||||
[[path]]
|
||||
[[_computeFileDisplayName(path)]]
|
||||
</option>
|
||||
</template>
|
||||
</select>
|
||||
@@ -172,6 +174,8 @@ limitations under the License.
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
var COMMIT_MESSAGE_PATH = '/COMMIT_MSG';
|
||||
|
||||
Polymer({
|
||||
is: 'gr-diff-view',
|
||||
|
||||
@@ -238,7 +242,8 @@ limitations under the License.
|
||||
|
||||
attached: function() {
|
||||
if (this._path) {
|
||||
this.fire('title-change', {title: this._path});
|
||||
this.fire('title-change',
|
||||
{title: this._computeFileDisplayName(this._path)});
|
||||
}
|
||||
window.addEventListener('resize', this._boundWindowResizeHandler);
|
||||
},
|
||||
@@ -343,7 +348,8 @@ limitations under the License.
|
||||
};
|
||||
this._path = value.path;
|
||||
|
||||
this.fire('title-change', {title: this._path});
|
||||
this.fire('title-change',
|
||||
{title: this._computeFileDisplayName(this._path)});
|
||||
|
||||
// When navigating away from the page, there is a possibility that the
|
||||
// patch number is no longer a part of the URL (say when navigating to
|
||||
@@ -402,6 +408,10 @@ limitations under the License.
|
||||
return base;
|
||||
},
|
||||
|
||||
_computeFileDisplayName: function(path) {
|
||||
return path == COMMIT_MESSAGE_PATH ? 'Commit message' : path;
|
||||
},
|
||||
|
||||
_computeChangeDetailPath: function(changeNum) {
|
||||
return '/changes/' + changeNum + '/detail';
|
||||
},
|
||||
|
@@ -76,6 +76,9 @@ limitations under the License.
|
||||
.stats {
|
||||
min-width: 7em;
|
||||
}
|
||||
.invisible {
|
||||
visibility: hidden;
|
||||
}
|
||||
.row:not(.header) .stats {
|
||||
font-family: var(--monospace-font-family);
|
||||
}
|
||||
@@ -135,15 +138,17 @@ limitations under the License.
|
||||
<input type="checkbox" checked$="[[_computeReviewed(file, _reviewed)]]"
|
||||
data-path$="[[file.__path]]" on-change="_handleReviewedChange">
|
||||
</div>
|
||||
<div class="status">[[file.status]]</div>
|
||||
<div class$="[[_computeClass('status', file.__path)]]">
|
||||
[[_computeFileStatus(file.status)]]
|
||||
</div>
|
||||
<a class="path" href$="[[_computeDiffURL(changeNum, patchNum, file.__path)]]">
|
||||
[[file.__path]]
|
||||
[[_computeFileDisplayName(file.__path)]]
|
||||
</a>
|
||||
<div class="comments">
|
||||
<span class="drafts">[[_computeDraftsString(_drafts, file.__path)]]</span>
|
||||
[[_computeCommentsString(comments, patchNum, file.__path)]]
|
||||
</div>
|
||||
<div class="stats">
|
||||
<div class$="[[_computeClass('stats', file.__path)]]">
|
||||
<span class="added">+[[file.lines_inserted]]</span>
|
||||
<span class="removed">-[[file.lines_deleted]]</span>
|
||||
</div>
|
||||
@@ -154,6 +159,8 @@ limitations under the License.
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
var COMMIT_MESSAGE_PATH = '/COMMIT_MSG';
|
||||
|
||||
Polymer({
|
||||
is: 'gr-file-list',
|
||||
|
||||
@@ -311,10 +318,26 @@ limitations under the License.
|
||||
return index == selectedIndex;
|
||||
},
|
||||
|
||||
_computeFileStatus: function(status) {
|
||||
return status || 'M';
|
||||
},
|
||||
|
||||
_computeDiffURL: function(changeNum, patchNum, path) {
|
||||
return '/c/' + changeNum + '/' + patchNum + '/' + path;
|
||||
},
|
||||
|
||||
_computeFileDisplayName: function(path) {
|
||||
return path == COMMIT_MESSAGE_PATH ? 'Commit message' : path;
|
||||
},
|
||||
|
||||
_computeClass: function(baseClass, path) {
|
||||
var classes = [baseClass];
|
||||
if (path == COMMIT_MESSAGE_PATH) {
|
||||
classes.push('invisible');
|
||||
}
|
||||
return classes.join(' ');
|
||||
},
|
||||
|
||||
_send: function(method, url) {
|
||||
var xhr = document.createElement('gr-request');
|
||||
this._xhrPromise = xhr.send({
|
||||
|
@@ -321,6 +321,11 @@ limitations under the License.
|
||||
assert.equal(linkEls[0].getAttribute('href'), '/c/42/10/chell.go');
|
||||
assert.equal(linkEls[1].getAttribute('href'), '/c/42/10/glados.txt');
|
||||
assert.equal(linkEls[2].getAttribute('href'), '/c/42/10/wheatley.md');
|
||||
|
||||
assert.equal(element._computeFileDisplayName('/foo/bar/baz'),
|
||||
'/foo/bar/baz');
|
||||
assert.equal(element._computeFileDisplayName('/COMMIT_MSG'),
|
||||
'Commit message');
|
||||
});
|
||||
|
||||
test('jump to file dropdown with patch range', function() {
|
||||
|
@@ -260,6 +260,21 @@ limitations under the License.
|
||||
'');
|
||||
});
|
||||
|
||||
test('computed properties', function() {
|
||||
assert.equal(element._computeFileStatus('A'), 'A');
|
||||
assert.equal(element._computeFileStatus(undefined), 'M');
|
||||
assert.equal(element._computeFileStatus(null), 'M');
|
||||
|
||||
assert.equal(element._computeFileDisplayName('/foo/bar/baz'),
|
||||
'/foo/bar/baz');
|
||||
assert.equal(element._computeFileDisplayName('/COMMIT_MSG'),
|
||||
'Commit message');
|
||||
|
||||
assert.equal(element._computeClass('clazz', '/foo/bar/baz'), 'clazz');
|
||||
assert.equal(element._computeClass('clazz', '/COMMIT_MSG'),
|
||||
'clazz invisible');
|
||||
});
|
||||
|
||||
test('file review status', function(done) {
|
||||
element.changeNum = '42';
|
||||
element.patchNum = '2';
|
||||
|
Reference in New Issue
Block a user