Files
gerrit/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list.html
Becky Siegel c52764277a Display whole commit width up to 72ch if screen size allows
Previously, when the screen size shrunk, the commit message and related
changes both got smaller. This caused the commit message to be difficult
to read.

This change sets flex-shrink to 0 on the commit container so that the
related changes absorbs all of the shrinkage instead. Because this can,
in certain cases, cause related changes to be unreadable, two step have
been taken to alleviate this:
  1) On hover of related change, display full text
  2) Add a new breakpoint at 60em, which moves related change below the
     commit message, before entering the full mobile view.

The rule to determine if the related changes toggle is needed is updated
to take into account this new view, so that it fits without jank
assuming there is space, and if not adds a minimal height that can be
expanded.

Bug: Issue 5706
Change-Id: Icae07d67a5c6738f7fcd0e3b0e189abed4332cfa
2017-05-15 13:28:02 -07:00

170 lines
5.3 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="../../../behaviors/base-url-behavior/base-url-behavior.html">
<link rel="import" href="../../../behaviors/rest-client-behavior/rest-client-behavior.html">
<link rel="import" href="../../../bower_components/polymer/polymer.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: 60em) {
.mobile {
display: block;
}
hr {
border: 0;
border-top: 1px solid #ddd;
height: 0;
margin-bottom: 1em;
}
}
</style>
<div>
<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)]]"
title$="[[related.commit.subject]]">
[[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)]]"
title$="[[change.project]]: [[change.branch]]: [[change.subject]]">
[[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)]]"
title$="[[change.project]]: [[change.branch]]: [[change.subject]]">
[[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)]]"
title$="[[change.subject]]">
[[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)]]"
title$="[[change.branch]]: [[change.subject]]">
[[change.branch]]: [[change.subject]]
</a>
</div>
</template>
</section>
</div>
<div hidden$="[[!loading]]">Loading...</div>
<gr-rest-api-interface id="restAPI"></gr-rest-api-interface>
</template>
<script src="gr-related-changes-list.js"></script>
</dom-module>