client/nav: add user avatar
This commit is contained in:
parent
1086bca3c2
commit
c543b77aed
4 changed files with 22 additions and 3 deletions
|
@ -97,9 +97,11 @@ nav.plain-nav ul li a {
|
|||
|
||||
nav.text-nav {
|
||||
margin: 1em 0;
|
||||
line-height: 2.3em;
|
||||
vertical-align: middle;
|
||||
}
|
||||
nav.text-nav ul li a {
|
||||
padding: 0.3em 1.2em;
|
||||
padding: 0 1.2em;
|
||||
}
|
||||
nav.text-nav ul li:not(.active) a {
|
||||
color: var(--inactive-tab-text-color);
|
||||
|
@ -120,6 +122,7 @@ nav.text-nav ul li.active a {
|
|||
#top-nav ul li {
|
||||
float: left;
|
||||
}
|
||||
#top-nav ul li[data-name=account],
|
||||
#top-nav ul li[data-name=register],
|
||||
#top-nav ul li[data-name=login],
|
||||
#top-nav ul li[data-name=logout],
|
||||
|
@ -129,6 +132,17 @@ nav.text-nav ul li.active a {
|
|||
#top-nav .access-key {
|
||||
text-decoration: underline;
|
||||
}
|
||||
#top-nav .thumbnail, #top-nav span {
|
||||
vertical-align: middle;
|
||||
}
|
||||
#top-nav .thumbnail {
|
||||
width: 1.5em;
|
||||
height: 1.5em;
|
||||
margin: calc((2.3em - 1.5em) / 2);
|
||||
margin-right: 0.6em;
|
||||
margin-left: calc(0.6em - 1.2em);
|
||||
float: left;
|
||||
}
|
||||
|
||||
.messages {
|
||||
margin: 0 auto;
|
||||
|
|
|
@ -3,7 +3,10 @@
|
|||
-->{{#each items}}<!--
|
||||
-->{{#if this.available}}<!--
|
||||
--><li data-name='{{@key}}'><!--
|
||||
--><a href='{{this.url}}' accesskey='{{this.accessKey}}'>{{this.name}}</a><!--
|
||||
--><a href='{{this.url}}' accesskey='{{this.accessKey}}'><!--
|
||||
-->{{#if this.imageUrl}}{{thumbnail this.imageUrl}}{{/if}}<!--
|
||||
--><span class='text'>{{this.name}}</span><!--
|
||||
--></a><!--
|
||||
--></li><!--
|
||||
-->{{/if}}<!--
|
||||
-->{{/each}}<!--
|
||||
|
|
|
@ -10,6 +10,7 @@ class NavigationItem {
|
|||
this.name = name;
|
||||
this.url = url;
|
||||
this.available = true;
|
||||
this.imageUrl = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,6 +47,7 @@ class TopNavController {
|
|||
|
||||
updateVisibility() {
|
||||
this.items.account.url = '/user/' + api.userName;
|
||||
this.items.account.imageUrl = api.user ? api.user.avatarUrl : null;
|
||||
|
||||
const b = Object.keys(this.items);
|
||||
for (let key of b) {
|
||||
|
|
|
@ -13,7 +13,7 @@ class TopNavView {
|
|||
const target = this.navHolder;
|
||||
const source = this.template(ctx);
|
||||
|
||||
for (let link of source.querySelectorAll('a')) {
|
||||
for (let link of source.querySelectorAll('a span.text')) {
|
||||
const regex = new RegExp(
|
||||
'(' + link.getAttribute('accesskey') + ')', 'i');
|
||||
link.innerHTML = link.textContent.replace(
|
||||
|
|
Loading…
Reference in a new issue