less javascript for user img

This commit is contained in:
Jean-Baptiste Pasquier 2019-04-16 14:56:25 +02:00
parent 02d30beff8
commit f60b720d37
No known key found for this signature in database
GPG Key ID: F2702E6D22ED4D62
4 changed files with 6 additions and 15 deletions

4
.gitignore vendored
View File

@ -7,8 +7,4 @@
/www/scripts/
/www/lib/
/www/oidc-client-config.json
!/www/lib/sib-core
!/www/lib/sib-router
!/www/lib/sib-chat
!/www/lib/sib-oidc
*.iml

View File

@ -3,10 +3,7 @@
//script(src="/lib/webcomponentsjs/webcomponents-loader.js")
//- script(src="lib/html-imports.js")
script(
type="module"
src="https://unpkg.com/@startinblox/oidc@0.5"
)
script(type="module" src="https://unpkg.com/@startinblox/oidc@0.5")
script(src="/scripts/index.js")

View File

@ -12,11 +12,15 @@ sib-notifications(
bind-user
)
sib-widget(name="user-picture")
template
img(name="${name}",src="\${value || '/images/user.jpg'}",style="max-width:100%; max-height: 100%;")
details#user-controls
summary(tabindex='0' role='button')
sib-display#user-controls__profile(
data-fields='first_name, account.picture',
widget-account.picture='sib-display-img',
widget-account.picture='user-picture',
bind-user
)
#user-controls__panel

View File

@ -6,12 +6,6 @@ document.addEventListener('DOMContentLoaded', function (event) {
if (!navBar || !btnToggle) return;
document.querySelectorAll('img[name$="account.picture"]').forEach(function (e) {
if (!e.src || e.src == window.location) {
e.src = '/images/user.jpg';
}
});
btnToggle.addEventListener('click', e => {
navBar.classList.toggle('open');
e.stopPropagation();