Merge "Highlight file list header on old patch sets"

This commit is contained in:
Andrew Bonventre 2016-08-25 20:58:25 +00:00 committed by Gerrit Code Review
commit fb4f3a844c
3 changed files with 32 additions and 2 deletions

View File

@ -137,6 +137,12 @@ limitations under the License.
border: 1px solid #ddd;
margin: 1em var(--default-horizontal-margin);
}
.patchInfo--oldPatchSet .patchInfo-header {
background-color: #fff9c4;
}
.patchInfo--oldPatchSet .latestPatchContainer {
display: initial;
}
.patchInfo-header,
gr-file-list {
padding: .5em calc(var(--default-horizontal-margin) / 2);
@ -147,6 +153,9 @@ limitations under the License.
display: flex;
justify-content: space-between;
}
.latestPatchContainer {
display: none;
}
@media screen and (max-width: 50em) {
.header {
align-items: flex-start;
@ -254,12 +263,12 @@ limitations under the License.
</div>
</div>
</section>
<section class="patchInfo">
<section class$="patchInfo [[_computePatchInfoClass(_patchRange.patchNum, _allPatchSets)]]">
<div class="patchInfo-header">
<div>
<label class="patchSelectLabel" for="patchSetSelect">Patch set</label>
<select id="patchSetSelect" on-change="_handlePatchChange">
<template is="dom-repeat" items="{{_allPatchSets}}" as="patchNumber">
<template is="dom-repeat" items="[[_allPatchSets]]" as="patchNumber">
<option value$="[[patchNumber]]" selected$="[[_computePatchIndexIsSelected(index, _patchRange.patchNum)]]">
<span>[[patchNumber]]</span>
/
@ -273,6 +282,10 @@ limitations under the License.
class="download"
on-tap="_handleDownloadTap">Download</gr-button>
</span>
<span class="latestPatchContainer">
/
<a href$="/c/[[_change._number]]">Go to latest patch set</a>
</span>
</div>
<gr-commit-info
change="[[_change]]"

View File

@ -390,6 +390,14 @@
return allPatchSets[allPatchSets.length - 1];
},
_computePatchInfoClass: function(patchNum, allPatchSets) {
if (parseInt(patchNum, 10) ===
this._computeLatestPatchNum(allPatchSets)) {
return '';
}
return 'patchInfo--oldPatchSet';
},
_computeAllPatchSets: function(change) {
var patchNums = [];
for (var rev in change.revisions) {

View File

@ -364,5 +364,14 @@ limitations under the License.
assert(openSpy.lastCall.calledWithExactly(FocusTarget.CCS),
'_openReplyDialog should have been passed CCS');
});
test('class is applied to file list on old patch set', function() {
var allPatcheSets = [1, 2, 4];
assert.equal(element._computePatchInfoClass('1', allPatcheSets),
'patchInfo--oldPatchSet');
assert.equal(element._computePatchInfoClass('2', allPatcheSets),
'patchInfo--oldPatchSet');
assert.equal(element._computePatchInfoClass('4', allPatcheSets), '');
});
});
</script>