Files
gerrit/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list.html
Becky Siegel a7a04f7f93 Hide related change list when it is longer than other content
Related content loads after everything else. Find the height of the
existing content, and don't let related changes take up any more space.
Conditionally add an expand/collapse button if the content exceeds the
allotted space.

Bug: Issue 5431
Change-Id: I9ac798d8dd4125e59df51e46f4a18099a87319cb
2017-03-10 21:37:55 +00:00

165 lines
4.9 KiB
HTML

<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<link rel="import" href="../../../bower_components/polymer/polymer.html">
<link rel="import" href="../../../behaviors/rest-client-behavior.html">
<link rel="import" href="../../shared/gr-rest-api-interface/gr-rest-api-interface.html">
<dom-module id="gr-related-changes-list">
<template>
<style>
:host {
display: block;
}
h3 {
margin: .5em 0 0;
}
section {
margin-bottom: 1.4em; /* Same as line height for collapse purposes */
}
a {
display: block;
}
.changeContainer,
a {
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.changeContainer {
display: flex;
}
.changeContainer.thisChange:before {
content: '➔';
width: 1.2em
}
h4,
section div {
display: flex
}
h4:before,
section div:before {
content: ' ';
width: 1.2em
}
.relatedChanges a {
display: inline-block;
}
.strikethrough {
color: #666;
text-decoration: line-through;
}
.status {
color: #666;
font-weight: bold;
margin-left: .25em;
}
.notCurrent {
color: #e65100;
}
.indirectAncestor {
color: #33691e;
}
.submittable {
color: #1b5e20;
}
.hidden,
.mobile {
display: none;
}
@media screen and (max-width: 50em) {
.mobile {
display: block;
}
hr {
border: 0;
border-top: 1px solid #ddd;
height: 0;
margin-bottom: 1em;
}
}
</style>
<div hidden$="[[!loading]]">Loading...</div>
<div hidden$="[[loading]]">
<hr class="mobile">
<section class="relatedChanges" hidden$="[[!_relatedResponse.changes.length]]" hidden>
<h4>Relation chain</h4>
<template
is="dom-repeat"
items="[[_relatedResponse.changes]]"
as="related">
<div class$="rightIndent [[_computeChangeContainerClass(change, related)]]">
<a href$="[[_computeChangeURL(related._change_number, related._revision_number)]]"
class$="[[_computeLinkClass(related)]]">
[[related.commit.subject]]
</a>
<span class$="[[_computeChangeStatusClass(related)]]">
([[_computeChangeStatus(related)]])
</span>
</div>
</template>
</section>
<section hidden$="[[!_submittedTogether.length]]" hidden>
<h4>Submitted together</h4>
<template is="dom-repeat" items="[[_submittedTogether]]" as="change">
<div>
<a href$="[[_computeChangeURL(change._number)]]"
class$="[[_computeLinkClass(change)]]">
[[change.project]]: [[change.branch]]: [[change.subject]]
</a>
</div>
</template>
</section>
<section hidden$="[[!_sameTopic.length]]" hidden>
<h4>Same topic</h4>
<template is="dom-repeat" items="[[_sameTopic]]" as="change">
<div>
<a href$="[[_computeChangeURL(change._number)]]"
class$="[[_computeLinkClass(change)]]">
[[change.project]]: [[change.branch]]: [[change.subject]]
</a>
</div>
</template>
</section>
<section hidden$="[[!_conflicts.length]]" hidden>
<h4>Merge conflicts</h4>
<template is="dom-repeat" items="[[_conflicts]]" as="change">
<div>
<a href$="[[_computeChangeURL(change._number)]]"
class$="[[_computeLinkClass(change)]]">
[[change.subject]]
</a>
</div>
</template>
</section>
<section hidden$="[[!_cherryPicks.length]]" hidden>
<h4>Cherry picks</h4>
<template is="dom-repeat" items="[[_cherryPicks]]" as="change">
<div>
<a href$="[[_computeChangeURL(change._number)]]"
class$="[[_computeLinkClass(change)]]">
[[change.branch]]: [[change.subject]]
</a>
</div>
</template>
</section>
</div>
<gr-rest-api-interface id="restAPI"></gr-rest-api-interface>
</template>
<script src="gr-related-changes-list.js"></script>
</dom-module>