web: add placeholder config, fix sizing of sidebar brand

This commit is contained in:
Jens Langhammer 2020-12-01 13:16:13 +01:00
parent 7bb26b5903
commit 71fbb23a2f
4 changed files with 278 additions and 9 deletions

View File

@ -4,8 +4,8 @@ from django.conf.urls.static import static
from django.contrib import admin from django.contrib import admin
from django.urls import include, path from django.urls import include, path
from django.views.generic import RedirectView from django.views.generic import RedirectView
from structlog import get_logger
from django.views.i18n import JavaScriptCatalog from django.views.i18n import JavaScriptCatalog
from structlog import get_logger
from passbook.core.views import error from passbook.core.views import error
from passbook.lib.utils.reflection import get_apps from passbook.lib.utils.reflection import get_apps
@ -57,7 +57,7 @@ for _passbook_app in get_apps():
urlpatterns += [ urlpatterns += [
path("administration/django/", admin.site.urls), path("administration/django/", admin.site.urls),
path("metrics/", MetricsView.as_view(), name="metrics"), path("metrics/", MetricsView.as_view(), name="metrics"),
path("-/jsi18n/", JavaScriptCatalog.as_view(), name='javascript-catalog'), path("-/jsi18n/", JavaScriptCatalog.as_view(), name="javascript-catalog"),
] ]
if settings.DEBUG: if settings.DEBUG:

View File

@ -102,6 +102,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -167,6 +172,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -310,6 +320,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -432,6 +447,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -573,6 +593,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -635,6 +660,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: User Serializer description: User Serializer
@ -722,6 +752,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -884,6 +919,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -1006,6 +1046,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -1128,6 +1173,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -1250,6 +1300,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -1371,6 +1426,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -1493,6 +1553,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -1615,6 +1680,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -1705,6 +1775,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -1827,6 +1902,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -1949,6 +2029,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -2071,6 +2156,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -2193,6 +2283,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -2315,6 +2410,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -2437,6 +2537,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -2559,6 +2664,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -2681,6 +2791,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -2746,6 +2861,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -2868,6 +2988,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -2990,6 +3115,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -3112,6 +3242,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -3176,6 +3311,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -3297,6 +3437,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -3418,6 +3563,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -3571,6 +3721,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -3636,6 +3791,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -3758,6 +3918,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -3880,6 +4045,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -4002,6 +4172,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -4067,6 +4242,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -4189,6 +4369,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -4311,6 +4496,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -4433,6 +4623,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -4555,6 +4750,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -4677,6 +4877,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -4739,6 +4944,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -4921,6 +5131,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -5043,6 +5258,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -5165,6 +5385,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -5287,6 +5512,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -5409,6 +5639,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -5531,6 +5766,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -5653,6 +5893,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -5775,6 +6020,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -5897,6 +6147,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''
@ -6019,6 +6274,11 @@ paths:
description: A page number within the paginated result set. description: A page number within the paginated result set.
required: false required: false
type: integer type: integer
- name: page_size
in: query
description: Number of results to return per page.
required: false
type: integer
responses: responses:
'200': '200':
description: '' description: ''

View File

@ -143,6 +143,10 @@ export class Sidebar extends LitElement {
PageStyle, PageStyle,
NavStyle, NavStyle,
css` css`
.pf-c-nav__list .sidebar-brand {
max-height: 82px;
margin-bottom: 0.5rem;
}
.pf-c-nav__link { .pf-c-nav__link {
--pf-c-nav__link--PaddingTop: 0.5rem; --pf-c-nav__link--PaddingTop: 0.5rem;
--pf-c-nav__link--PaddingRight: 0.5rem; --pf-c-nav__link--PaddingRight: 0.5rem;
@ -207,7 +211,7 @@ export class Sidebar extends LitElement {
return html`<div class="pf-c-page__sidebar-body"> return html`<div class="pf-c-page__sidebar-body">
<nav class="pf-c-nav" aria-label="Global"> <nav class="pf-c-nav" aria-label="Global">
<ul class="pf-c-nav__list"> <ul class="pf-c-nav__list">
<li class="pf-c-nav__item"> <li class="pf-c-nav__item sidebar-brand">
<pb-sidebar-brand></pb-sidebar-brand> <pb-sidebar-brand></pb-sidebar-brand>
</li> </li>
${SIDEBAR_ITEMS.map((i) => this.renderItem(i))} ${SIDEBAR_ITEMS.map((i) => this.renderItem(i))}

View File

@ -5,10 +5,15 @@ import PageStyle from "@patternfly/patternfly/components/Page/page.css";
import GlobalsStyle from "@patternfly/patternfly/base/patternfly-globals.css"; import GlobalsStyle from "@patternfly/patternfly/base/patternfly-globals.css";
import { Config } from "../../api/config"; import { Config } from "../../api/config";
export const DefaultConfig: Config = {
branding_logo: " /static/dist/assets/images/logo.svg",
branding_title: "passbook",
};
@customElement("pb-sidebar-brand") @customElement("pb-sidebar-brand")
export class SidebarBrand extends LitElement { export class SidebarBrand extends LitElement {
@property() @property()
config?: Config; config: Config = DefaultConfig;
static get styles() { static get styles() {
return [ return [
@ -44,12 +49,12 @@ export class SidebarBrand extends LitElement {
if (!this.config) { if (!this.config) {
return html``; return html``;
} }
return html` <a href="" class="pf-c-page__header-brand-link"> return html` <a href="#/" class="pf-c-page__header-brand-link">
<div class="pf-c-brand pb-brand"> <div class="pf-c-brand pb-brand">
<img src="${this.config?.branding_logo}" alt="passbook icon" loading="lazy" /> <img src="${this.config.branding_logo}" alt="passbook icon" loading="lazy" />
${this.config?.branding_title ${this.config.branding_title
? html`<span>${this.config.branding_title}</span>` ? html`<span>${this.config.branding_title}</span>`
: ""} : ""}
</div> </div>
</a>`; </a>`;
} }