Merge "Move patch set and download actions to the file list"

This commit is contained in:
Andrew Bonventre
2016-08-23 18:09:16 +00:00
committed by Gerrit Code Review
3 changed files with 62 additions and 53 deletions

View File

@@ -79,17 +79,11 @@ limitations under the License.
color: #999; color: #999;
text-transform: capitalize; text-transform: capitalize;
} }
section {
margin: 10px 0;
padding: 10px var(--default-horizontal-margin);
}
/* Strong specificity here is needed due to /* Strong specificity here is needed due to
https://github.com/Polymer/polymer/issues/2531 */ https://github.com/Polymer/polymer/issues/2531 */
.container section.changeInfo { .container section.changeInfo {
border-bottom: 1px solid #ddd;
display: flex; display: flex;
margin-top: 0; padding: 0 var(--default-horizontal-margin);
padding-top: 0;
} }
.changeInfo-column:not(:last-of-type) { .changeInfo-column:not(:last-of-type) {
margin-right: 1em; margin-right: 1em;
@@ -138,9 +132,17 @@ limitations under the License.
font-size: .9em; font-size: .9em;
overflow: hidden; overflow: hidden;
} }
.patchInfo {
border: 1px solid #ddd;
margin: 1em var(--default-horizontal-margin);
}
.patchInfo-header,
gr-file-list { gr-file-list {
margin-bottom: 1em; padding: .5em calc(var(--default-horizontal-margin) / 2);
padding: 0 var(--default-horizontal-margin); }
.patchInfo-header {
background-color: #f6f6f6;
border-bottom: 1px solid #ebebeb;
} }
@media screen and (max-width: 50em) { @media screen and (max-width: 50em) {
.header { .header {
@@ -158,7 +160,7 @@ limitations under the License.
min-width: initial; min-width: initial;
width: 90vw; width: 90vw;
} }
.download { .downloadContainer {
display: none; display: none;
} }
.reply { .reply {
@@ -203,21 +205,6 @@ limitations under the License.
<span>[[_change.subject]]</span> <span>[[_change.subject]]</span>
<span class="changeStatus">[[_computeChangeStatus(_change, _patchRange.patchNum)]]</span> <span class="changeStatus">[[_computeChangeStatus(_change, _patchRange.patchNum)]]</span>
</span> </span>
<span class="header-actions">
<gr-button class="download" on-tap="_handleDownloadTap">Download</gr-button>
<span>
<label class="patchSelectLabel" for="patchSetSelect">Patch set</label>
<select id="patchSetSelect" on-change="_handlePatchChange">
<template is="dom-repeat" items="{{_allPatchSets}}" as="patchNumber">
<option value$="[[patchNumber]]" selected$="[[_computePatchIndexIsSelected(index, _patchRange.patchNum)]]">
<span>[[patchNumber]]</span>
/
<span>[[_computeLatestPatchNum(_allPatchSets)]]</span>
</option>
</template>
</select>
</span>
</span>
</div> </div>
<section class="changeInfo"> <section class="changeInfo">
<div class="changeInfo-column changeMetadata"> <div class="changeInfo-column changeMetadata">
@@ -265,6 +252,27 @@ limitations under the License.
</div> </div>
</div> </div>
</section> </section>
<section class="patchInfo">
<div class="patchInfo-header">
<span>
<label class="patchSelectLabel" for="patchSetSelect">Patch set</label>
<select id="patchSetSelect" on-change="_handlePatchChange">
<template is="dom-repeat" items="{{_allPatchSets}}" as="patchNumber">
<option value$="[[patchNumber]]" selected$="[[_computePatchIndexIsSelected(index, _patchRange.patchNum)]]">
<span>[[patchNumber]]</span>
/
<span>[[_computeLatestPatchNum(_allPatchSets)]]</span>
</option>
</template>
</select>
</span>
<span class="downloadContainer">
/
<gr-button link
class="download"
on-tap="_handleDownloadTap">Download</gr-button>
</span>
</div>
<gr-file-list id="fileList" <gr-file-list id="fileList"
change="[[_change]]" change="[[_change]]"
change-num="[[_changeNum]]" change-num="[[_changeNum]]"
@@ -274,6 +282,7 @@ limitations under the License.
revisions="[[_change.revisions]]" revisions="[[_change.revisions]]"
projectConfig="[[_projectConfig]]" projectConfig="[[_projectConfig]]"
selected-index="{{viewState.selectedFileIndex}}"></gr-file-list> selected-index="{{viewState.selectedFileIndex}}"></gr-file-list>
</section>
<gr-messages-list id="messageList" <gr-messages-list id="messageList"
change-num="[[_changeNum]]" change-num="[[_changeNum]]"
messages="[[_change.messages]]" messages="[[_change.messages]]"

View File

@@ -184,17 +184,17 @@ limitations under the License.
labels: {}, labels: {},
}; };
flushAsynchronousOperations(); flushAsynchronousOperations();
var selectEl = element.$$('.header select'); var selectEl = element.$$('.patchInfo-header select');
assert.ok(selectEl); assert.ok(selectEl);
var optionEls = var optionEls = Polymer.dom(element.root).querySelectorAll(
Polymer.dom(element.root).querySelectorAll('.header option'); '.patchInfo-header option');
assert.equal(optionEls.length, 4); assert.equal(optionEls.length, 4);
assert.isFalse( assert.isFalse(element.$$('.patchInfo-header option[value="1"]')
element.$$('.header option[value="1"]').hasAttribute('selected')); .hasAttribute('selected'));
assert.isTrue( assert.isTrue(element.$$('.patchInfo-header option[value="2"]')
element.$$('.header option[value="2"]').hasAttribute('selected')); .hasAttribute('selected'));
assert.isFalse( assert.isFalse(element.$$('.patchInfo-header option[value="3"]')
element.$$('.header option[value="3"]').hasAttribute('selected')); .hasAttribute('selected'));
assert.equal(optionEls[3].value, 13); assert.equal(optionEls[3].value, 13);
var showStub = sinon.stub(page, 'show'); var showStub = sinon.stub(page, 'show');
@@ -236,17 +236,17 @@ limitations under the License.
labels: {}, labels: {},
}; };
flushAsynchronousOperations(); flushAsynchronousOperations();
var selectEl = element.$$('.header select'); var selectEl = element.$$('.patchInfo-header select');
assert.ok(selectEl); assert.ok(selectEl);
var optionEls = var optionEls = Polymer.dom(element.root).querySelectorAll(
Polymer.dom(element.root).querySelectorAll('.header option'); '.patchInfo-header option');
assert.equal(optionEls.length, 4); assert.equal(optionEls.length, 4);
assert.isFalse( assert.isFalse(element.$$('.patchInfo-header option[value="1"]')
element.$$('.header option[value="1"]').hasAttribute('selected')); .hasAttribute('selected'));
assert.isTrue( assert.isTrue(element.$$('.patchInfo-header option[value="2"]')
element.$$('.header option[value="2"]').hasAttribute('selected')); .hasAttribute('selected'));
assert.isFalse( assert.isFalse(element.$$('.patchInfo-header option[value="3"]')
element.$$('.header option[value="3"]').hasAttribute('selected')); .hasAttribute('selected'));
assert.equal(optionEls[3].value, 13); assert.equal(optionEls[3].value, 13);
var showStub = sinon.stub(page, 'show'); var showStub = sinon.stub(page, 'show');

View File

@@ -20,7 +20,7 @@ limitations under the License.
--selection-background-color: #ebf5fb; --selection-background-color: #ebf5fb;
--default-text-color: #000; --default-text-color: #000;
--view-background-color: #fff; --view-background-color: #fff;
--default-horizontal-margin: 1.25rem; --default-horizontal-margin: 1rem;
--font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
--monospace-font-family: 'Source Code Pro', Menlo, 'Lucida Console', Monaco, monospace; --monospace-font-family: 'Source Code Pro', Menlo, 'Lucida Console', Monaco, monospace;