...
 
This diff is collapsed.
......@@ -101,6 +101,11 @@
.toolbar {
justify-content: space-between;
background-color: #d1dae0;
--pb-navigation-hidden: {
visibility: visible;
opacity: 0.2;
}
}
[drawer-toggle] {
......
......@@ -47,7 +47,7 @@
</template>
</a>
<paper-dialog id="loginDialog">
<paper-dialog id="loginDialog" no-cancel-on-outside-click no-cancel-on-esc-key>
<h2>Login</h2>
<paper-dialog-scrollable>
<form action="login">
......@@ -113,6 +113,13 @@
type: Array,
value: []
},
/**
* If set to true, automatically show login dialog if user is not logged in
*/
auto: {
type: Boolean,
value: false
},
/**
* Label to show if not logged in
*/
......@@ -162,6 +169,11 @@
ready(){
super.ready();
Polymer.RenderStatus.afterNextRender(this, () => {
this.$.checkLogin.body = null;
this.$.checkLogin.generateRequest();
});
}
_show(ev) {
......@@ -197,6 +209,8 @@
this.password = null;
if (this.$.loginDialog.opened) {
this._invalid = true;
} else if (this.auto) {
this.$.loginDialog.open();
}
}
this.emitTo('pb-login', resp);
......
......@@ -3,6 +3,13 @@
<dom-module id="pb-navigation">
<template>
<style>
.inactive {
visibility: hidden;
@apply --pb-navigation-hidden;
}
</style>
<a id="button" on-click="_handleClick"><slot></slot></a>
</template>
......@@ -11,6 +18,12 @@
* Navigate backward/forward in a document. This component does not implement any functionality itself.
* It just sends a `pb-navigate` event when clicked.
*
* ## CSS Mixins
*
* | Custom property | Description | Default|
* | ----------------|-------------|--------|
* |--pb-navigation-hidden | Mixin applied if navigation is not available (because there's no next/previous page) | {visibility: hidden,}|
*
* @customElement
* @polymer
* @appliesMixin PbMixin
......@@ -65,9 +78,17 @@
_update(ev) {
if (this.direction === 'forward') {
this.$.button.disabled = !ev.detail.data.next;
if (ev.detail.data.next) {
this.$.button.className = '';
} else {
this.$.button.className = 'inactive';
}
} else {
this.$.button.disabled = !ev.detail.data.previous;
if (ev.detail.data.previous) {
this.$.button.className = '';
} else {
this.$.button.className = 'inactive';
}
}
}
}
......
......@@ -268,8 +268,7 @@
<paper-item>pl</paper-item>
</pb-lang>
</pb-media-query>
<pb-login id="login" login-label="i18n(login)" logout-label="i18n(logout)" data-template="browse:current-user"
group="tei">
<pb-login id="login" login-label="i18n(login)" logout-label="i18n(logout)" group="tei">
<iron-icon slot="icon" icon="account-circle"></iron-icon>
</pb-login>
<pb-progress indeterminate="indeterminate" bottom-item="bottom-item"/>
......
......@@ -71,7 +71,7 @@
<paper-item>gr</paper-item>
<paper-item>pl</paper-item>
</pb-lang>
<pb-login id="login" login-label="i18n(login)" logout-label="i18n(logout)" data-template="browse:current-user"
<pb-login id="login" login-label="i18n(login)" logout-label="i18n(logout)"
group="tei">
<iron-icon slot="icon" icon="account-circle"></iron-icon>
</pb-login>
......
......@@ -51,27 +51,6 @@ function app:check-login($node as node(), $model as map(*)) {
templates:process($node/*[1], $model)
};
declare function app:current-user($node as node(), $model as map(*)) {
let $user := request:get-attribute($config:login-domain || ".user")
let $loggedIn := exists($user)
return
element { node-name($node) } {
$node/@*,
if ($loggedIn) then
attribute logged-in { "logged-in" }
else
(),
attribute user { $user },
attribute groups {
if ($user) then
'[' || string-join(sm:get-user-groups($user) ! ('"' || . || '"'), ',') || ']'
else
'[]'
},
templates:process($node/node(), $model)
}
};
declare
%templates:wrap
function app:sort($items as element()*, $sortBy as xs:string?) {
......
......@@ -176,7 +176,7 @@
<paper-item>it</paper-item>
<paper-item>pl</paper-item>
</pb-lang>
<pb-login login-label="i18n(login)" logout-label="i18n(logout)" data-template="browse:current-user"
<pb-login login-label="i18n(login)" logout-label="i18n(logout)"
group="tei">
<iron-icon slot="icon" icon="account-circle"></iron-icon>
</pb-login>
......
......@@ -153,7 +153,7 @@
<paper-item>it</paper-item>
<paper-item>pl</paper-item>
</pb-lang>
<pb-login login-label="i18n(login)" logout-label="i18n(logout)" data-template="browse:current-user"
<pb-login login-label="i18n(login)" logout-label="i18n(logout)"
group="tei">
<iron-icon slot="icon" icon="account-circle"></iron-icon>
</pb-login>
......
......@@ -212,7 +212,7 @@
<paper-item>pl</paper-item>
</pb-lang>
</pb-media-query>
<pb-login id="login" login-label="i18n(login)" logout-label="i18n(logout)" data-template="browse:current-user"
<pb-login id="login" login-label="i18n(login)" logout-label="i18n(logout)"
group="tei">
<iron-icon slot="icon" icon="account-circle"></iron-icon>
</pb-login>
......
......@@ -153,7 +153,7 @@
<paper-item>it</paper-item>
<paper-item>pl</paper-item>
</pb-lang>
<pb-login login-label="i18n(login)" logout-label="i18n(logout)" data-template="browse:current-user"
<pb-login login-label="i18n(login)" logout-label="i18n(logout)"
group="tei">
<iron-icon slot="icon" icon="account-circle"></iron-icon>
</pb-login>
......
......@@ -78,7 +78,7 @@
<paper-item>pl</paper-item>
</pb-lang>
</pb-media-query>
<pb-login id="login" login-label="i18n(login)" logout-label="i18n(logout)" group="tei" data-template="browse:current-user">
<pb-login id="login" login-label="i18n(login)" logout-label="i18n(logout)" group="tei">
</pb-login>
<paper-dialog id="downloadDialog">
<h2>
......
......@@ -105,7 +105,7 @@
<paper-item>pl</paper-item>
</pb-lang>
</pb-media-query>
<pb-login id="login" login-label="i18n(login)" logout-label="i18n(logout)" group="tei" data-template="browse:current-user">
<pb-login id="login" login-label="i18n(login)" logout-label="i18n(logout)" group="tei">
</pb-login>
<paper-dialog id="downloadDialog">
<h2>
......