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

View File

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

View File

@ -364,5 +364,14 @@ limitations under the License.
assert(openSpy.lastCall.calledWithExactly(FocusTarget.CCS), assert(openSpy.lastCall.calledWithExactly(FocusTarget.CCS),
'_openReplyDialog should have been passed 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> </script>