This commit is contained in:
Jason Robbins 2020-11-09 16:17:14 -05:00
Родитель 631d817155
Коммит 53f895ba5e
3 изменённых файлов: 20 добавлений и 3 удалений

Просмотреть файл

@ -26,6 +26,7 @@ class ChromedashAccordion extends LitElement {
border-radius: var(--accordion-border-radius);
padding: var(--content-padding-quarter);
width: var(--max-content-width);
cursor: pointer;
}
`];
}
@ -37,11 +38,15 @@ class ChromedashAccordion extends LitElement {
toggle() {
this.opened = !this.opened;
if (this.id) {
const anchor = this.opened ? this.id : '';
history.replaceState(null, null, '#' + anchor);
}
}
render() {
return html`
<h3 @click=${this.toggle}>
<h3 @click=${this.toggle} title="Click to expand">
<iron-icon
icon="chromestatus:${this.opened ? 'expand-less' : 'expand-more'}">
</iron-icon>

Просмотреть файл

@ -61,6 +61,16 @@ if (SHOW_TOAST) {
}, 500);
}
// Open an accordion that was bookmarked open
if (location.hash) {
const targetId = decodeURIComponent(location.hash.substr(1));
const targetEl = document.getElementById(targetId);
if (targetEl && targetEl.tagName == 'CHROMEDASH-ACCORDION') {
targetEl.opened = true;
}
}
exports.subscribeToFeature = subscribeToFeature;
exports.shareFeature = shareFeature;
})(window);

Просмотреть файл

@ -241,12 +241,14 @@
</section>
</div>
<chromedash-accordion title="Feature details by stage">
<chromedash-accordion
id="details"
title="Additional fields by process phase">
<chromedash-feature-detail
feature='{{ feature_json }}'
process='{{ process_json }}'
fielddefs='{{ field_defs_json }}'
dismissedcues='{{ user.dismissed_cues }}'>
dismissedcues='{{ user.dismissed_cues|default:"[]" }}'>
</chromedash-feature-detail>
</chromedash-accordion>