Files
gerrit/polygerrit-ui/app/elements/shared/gr-hovercard-account/gr-hovercard-account_html.ts
Ben Rohlfs 1fd14cb530 Fix reloading of page when changing attention set from hovercard
The code was assuming that you are on the change page, but you can also
change the attention set from a hovercard in a dashboard row, so we need
generic reload behavior.

So we have added a 'reload' event to the app that can be fired from
anywhere and would trigger reloading the current page.

Change-Id: Ia2c2a46119351cb4bc7cf6218005dcd13bfc5681
2020-07-22 10:06:02 +02:00

138 lines
3.9 KiB
TypeScript

/**
* @license
* Copyright (C) 2020 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.
*/
import '../gr-hovercard/gr-hovercard-shared-style';
import {html} from '@polymer/polymer/lib/utils/html-tag';
export const htmlTemplate = html`
<style include="gr-hovercard-shared-style">
.top,
.attention,
.status,
.voteable {
padding: var(--spacing-s) var(--spacing-l);
}
.top {
display: flex;
padding-top: var(--spacing-xl);
min-width: 300px;
}
gr-avatar {
height: 48px;
width: 48px;
margin-right: var(--spacing-l);
}
.title,
.email {
color: var(--deemphasized-text-color);
}
.status iron-icon {
width: 14px;
height: 14px;
vertical-align: top;
position: relative;
top: 2px;
}
.action {
border-top: 1px solid var(--border-color);
padding: var(--spacing-s) var(--spacing-l);
--gr-button: {
padding: var(--spacing-s) var(--spacing-m);
}
}
.attention {
background-color: var(--emphasis-color);
}
.attention iron-icon {
width: 14px;
height: 14px;
vertical-align: top;
position: relative;
top: 3px;
}
</style>
<div id="container" role="tooltip" tabindex="-1">
<template is="dom-if" if="[[_isShowing]]">
<div class="top">
<div class="avatar">
<gr-avatar account="[[account]]" image-size="56"></gr-avatar>
</div>
<div class="account">
<h3 class="name heading-3">[[account.name]]</h3>
<div class="email">[[account.email]]</div>
</div>
</div>
<template is="dom-if" if="[[account.status]]">
<div class="status">
<span class="title">
<iron-icon icon="gr-icons:calendar"></iron-icon>
Status:
</span>
<span class="value">[[account.status]]</span>
</div>
</template>
<template is="dom-if" if="[[voteableText]]">
<div class="voteable">
<span class="title">Voteable:</span>
<span class="value">[[voteableText]]</span>
</div>
</template>
<template
is="dom-if"
if="[[_computeShowLabelNeedsAttention(_config, highlightAttention, account, change)]]"
>
<div class="attention">
<iron-icon icon="gr-icons:attention"></iron-icon>
<span>
[[_computeText(account, _selfAccount)]] turn to take action.
</span>
</div>
</template>
<template
is="dom-if"
if="[[_computeShowActionAddToAttentionSet(_config, highlightAttention, account, change)]]"
>
<div class="action">
<gr-button
class="addToAttentionSet"
link=""
no-uppercase=""
on-click="_handleClickAddToAttentionSet"
>
Add to attention set
</gr-button>
</div>
</template>
<template
is="dom-if"
if="[[_computeShowActionRemoveFromAttentionSet(_config, highlightAttention, account, change)]]"
>
<div class="action">
<gr-button
class="removeFromAttentionSet"
link=""
no-uppercase=""
on-click="_handleClickRemoveFromAttentionSet"
>
Remove from attention set
</gr-button>
</div>
</template>
</template>
</div>
<gr-rest-api-interface id="restAPI"></gr-rest-api-interface>
`;