diff --git a/assets/controllers/drawer_controller.js b/assets/controllers/drawer_controller.js new file mode 100644 index 00000000..57cc9c29 --- /dev/null +++ b/assets/controllers/drawer_controller.js @@ -0,0 +1,35 @@ +import { Controller } from '@hotwired/stimulus' + +/* + * The sidebar as a drawer on small screens: a modal (target "dialog"), so focus stays inside + * and Escape closes it. A click on the dimmed page beside it closes it too, and so does widening the + * window until the sidebar shows (lg). + */ +export default class extends Controller { + static targets = ['dialog'] + + connect () { + this.wide = window.matchMedia('(min-width: 64rem)') + this.onWide = (event) => event.matches && this.close() + this.wide.addEventListener('change', this.onWide) + } + + disconnect () { + this.wide.removeEventListener('change', this.onWide) + } + + open () { + this.dialogTarget.showModal() + } + + close () { + this.dialogTarget.close() + } + + // a click on the dialog element itself, not on its content, is a click on the backdrop + closeOnBackdrop (event) { + if (event.target === this.dialogTarget) { + this.close() + } + } +} diff --git a/assets/controllers/menu_controller.js b/assets/controllers/menu_controller.js new file mode 100644 index 00000000..ccade462 --- /dev/null +++ b/assets/controllers/menu_controller.js @@ -0,0 +1,89 @@ +import { Controller } from '@hotwired/stimulus' + +/* + * A small menu behind a "⋯" button: the button (menu#toggle) opens the panel (target "panel") below + * itself. The panel is positioned fixed, so a scrolling container can't cut it off. Escape, a click + * outside or a click on one of its items closes it; arrow keys move between the items. Scrolling or + * resizing closes it too: a fixed panel would stay put while its row moves away (a table swiped + * sideways on a phone). + */ +export default class extends Controller { + static targets = ['button', 'panel'] + + connect () { + this.onOutside = (event) => { + if (!this.element.contains(event.target)) { + this.close() + } + } + this.onKey = (event) => this.key(event) + this.onScroll = (event) => { + if (!this.panelTarget.contains(event.target)) { + this.close() + } + } + this.onResize = () => this.close() + } + + disconnect () { + this.close() + } + + toggle (event) { + event.stopPropagation() + this.panelTarget.hidden ? this.open() : this.close() + } + + open () { + const box = this.buttonTarget.getBoundingClientRect() + const panel = this.panelTarget + panel.hidden = false + // below the button, aligned to its right edge, and inside the window + const left = Math.max(8, Math.min(box.right - panel.offsetWidth, window.innerWidth - panel.offsetWidth - 8)) + const below = box.bottom + 4 + panel.offsetHeight <= window.innerHeight + panel.style.left = `${left}px` + panel.style.top = `${below ? box.bottom + 4 : box.top - panel.offsetHeight - 4}px` + this.buttonTarget.setAttribute('aria-expanded', 'true') + document.addEventListener('click', this.onOutside, true) + document.addEventListener('keydown', this.onKey) + // capture: scroll events don't bubble, and the scrolling box may be any ancestor + document.addEventListener('scroll', this.onScroll, true) + window.addEventListener('resize', this.onResize) + this.items()[0]?.focus({ preventScroll: true }) + } + + close () { + if (this.panelTarget.hidden) { + return + } + this.panelTarget.hidden = true + this.buttonTarget.setAttribute('aria-expanded', 'false') + document.removeEventListener('click', this.onOutside, true) + document.removeEventListener('keydown', this.onKey) + document.removeEventListener('scroll', this.onScroll, true) + window.removeEventListener('resize', this.onResize) + } + + // an item was chosen: it does its own work (htmx, link), the menu only closes + choose () { + this.close() + } + + key (event) { + const items = this.items() + const index = items.indexOf(document.activeElement) + if (event.key === 'Escape') { + event.stopPropagation() + this.close() + this.buttonTarget.focus() + } else if (event.key === 'ArrowDown' || event.key === 'ArrowUp') { + event.preventDefault() + const next = (index + (event.key === 'ArrowDown' ? 1 : -1) + items.length) % items.length + items[next]?.focus() + } + } + + items () { + return [...this.panelTarget.querySelectorAll('a, button:not([disabled])')] + } +} diff --git a/assets/controllers/mobilenav_controller.js b/assets/controllers/mobilenav_controller.js deleted file mode 100644 index 5100bfd1..00000000 --- a/assets/controllers/mobilenav_controller.js +++ /dev/null @@ -1,16 +0,0 @@ -import { Controller } from '@hotwired/stimulus' - -export default class extends Controller { - static outlets = [ 'mobilenav' ] - static classes = [ 'closed' ] - - trigger({ params: { mode } }) { - this.mobilenavOutlet.toggle(mode) - } - - toggle(mode) { - // Add animation classes only now to avoid fouc - this.element.classList.add('transition-transform', 'duration-300') - this.element.classList.toggle(this.closedClass, 'close' === mode) - } -} \ No newline at end of file diff --git a/assets/controllers/sidebar_menu_controller.js b/assets/controllers/sidebar_menu_controller.js deleted file mode 100644 index bbc60879..00000000 --- a/assets/controllers/sidebar_menu_controller.js +++ /dev/null @@ -1,30 +0,0 @@ -import { Controller } from '@hotwired/stimulus' - -export default class extends Controller { - - static classes = ['closed', 'iconClosed', 'iconExpanded'] - static targets = ['submenu', 'button', 'icon'] - static values = { expanded: Boolean } - - toggleSubmenu() { - this.expandedValue = !this.expandedValue - } - - expandedValueChanged(expanded) { - this.submenuTarget.classList.toggle(this.closedClass, false === expanded) - if (false === this.hasButtonTarget) { - return - } - this.buttonTarget.setAttribute('aria-expanded', expanded) - if (false === this.hasIconTarget) { - return - } - if (true === expanded) { - this.iconTarget.classList.add(...this.iconExpandedClasses) - this.iconTarget.classList.remove(...this.iconClosedClasses) - } else { - this.iconTarget.classList.add(...this.iconClosedClasses) - this.iconTarget.classList.remove(...this.iconExpandedClasses) - } - } -} \ No newline at end of file diff --git a/assets/fonts/lato-400-italic.woff2 b/assets/fonts/lato-400-italic.woff2 new file mode 100644 index 00000000..851630ff Binary files /dev/null and b/assets/fonts/lato-400-italic.woff2 differ diff --git a/assets/fonts/lato-400.woff2 b/assets/fonts/lato-400.woff2 new file mode 100644 index 00000000..ff60934d Binary files /dev/null and b/assets/fonts/lato-400.woff2 differ diff --git a/assets/fonts/lato-700.woff2 b/assets/fonts/lato-700.woff2 new file mode 100644 index 00000000..11de83fe Binary files /dev/null and b/assets/fonts/lato-700.woff2 differ diff --git a/assets/fonts/lato-900.woff2 b/assets/fonts/lato-900.woff2 new file mode 100644 index 00000000..72a9bc30 Binary files /dev/null and b/assets/fonts/lato-900.woff2 differ diff --git a/assets/images/ep-logo.svg b/assets/images/ep-logo.svg new file mode 100644 index 00000000..596f5347 --- /dev/null +++ b/assets/images/ep-logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/styles/_admin.css b/assets/styles/_admin.css new file mode 100644 index 00000000..f298e908 --- /dev/null +++ b/assets/styles/_admin.css @@ -0,0 +1,64 @@ +/* Admin-only additions to ep-design.css, built on its tokens */ +@layer base { + .htmx-indicator { + @apply invisible; + } + + .htmx-request .htmx-indicator, + .htmx-request.htmx-indicator { + @apply visible; + } + + /* checked boxes and radios in the brand colour (@tailwindcss/forms fills them with currentColor) */ + [type="checkbox"], + [type="radio"] { + @apply text-brand; + } + + /* thin scrollbars without a track for inner scrolling areas, as in app.css */ + body * { + scrollbar-width: thin; + scrollbar-color: var(--color-line) transparent; + } +} + +@layer components { + .badge { + @apply inline-flex items-center px-1.5 py-0.5 text-xs font-bold whitespace-nowrap; + } + + .tippy-box { + @apply bg-brand; + } + + .tippy-box[data-placement^='top'] > .tippy-arrow::before { + border-top-color: var(--color-brand); + } + + .tippy-box[data-placement^='bottom'] > .tippy-arrow::before { + border-bottom-color: var(--color-brand); + } + + .tippy-box[data-placement^='left'] > .tippy-arrow::before { + border-left-color: var(--color-brand); + } + + .tippy-box[data-placement^='right'] > .tippy-arrow::before { + border-right-color: var(--color-brand); + } +} + +/* a list in a card, scrolling sideways when it is wider than the content column */ +@layer components { + .data-table-wrapper { + @apply mb-8 overflow-x-auto border border-line bg-white; + } + + .data-table-wrapper__inner { + @apply min-w-full align-middle; + } + + .data-table tbody tr { + @apply hover:bg-brand-light/50; + } +} diff --git a/assets/styles/_components_admin.css b/assets/styles/_components_admin.css deleted file mode 100644 index b0d40ca2..00000000 --- a/assets/styles/_components_admin.css +++ /dev/null @@ -1,10 +0,0 @@ -@import "./components/autocomplete.css"; -@import "./components/badge.css"; -@import "./components/button.css"; -@import "./components/datatable.css"; -@import "./components/datepicker.css"; -@import "./components/forms.css"; -@import "./components/pagination.css"; -@import "./components/toast.css"; -@import "./components/tooltip.css"; -@import "./components/typography.css"; diff --git a/assets/styles/admin.css b/assets/styles/admin.css index 17d01b4e..9b2ce85c 100644 --- a/assets/styles/admin.css +++ b/assets/styles/admin.css @@ -1,4 +1,12 @@ +/* The admin in the E&P corporate design; shares nothing with app.css, so the frontend stays as it is */ @import "tailwindcss" source(none); -@import "./_theme.css"; -@import "./_base.css" layer(base); -@import "./_components_admin.css" layer(components); +@import "toastify-js/src/toastify.css"; +@import "tippy.js/dist/tippy.css"; +@import "./ep-design.css"; +@import "./_admin.css"; + +@source "../../templates"; +@source "../../src"; +@source "../../assets"; + +@plugin "@tailwindcss/forms"; diff --git a/assets/styles/ep-design.css b/assets/styles/ep-design.css new file mode 100644 index 00000000..7c1d1409 --- /dev/null +++ b/assets/styles/ep-design.css @@ -0,0 +1,316 @@ +/* + * E&P corporate design for the internal Symfony tools, taken from the E&P apps template (Gitea EP/apps, + * frontend/app/globals.css, frontend/components/): Lato, deep blue as the brand colour, magenta only + * for the one main action of a page, square shapes, light blue page. + * Status colours (green, red, amber) always come with text, never alone. + * + * Import after Tailwind: @import "tailwindcss"; @import "./ep-design.css"; @plugin "@tailwindcss/forms"; + * The toast styles expect toastify-js (@import "toastify-js/src/toastify.css" before this file). + */ + +/* + * Lato (OFL) ships with the app, so browsers load nothing from Google: 400 (and italic), 700, 900. No 600: + * font-semibold renders as 700, like font-bold; font-black is 900. The weights are not remapped. + */ +@font-face { + font-family: "Lato"; + font-style: normal; + font-weight: 400; + font-display: swap; + src: url("../fonts/lato-400.woff2") format("woff2"); +} + +@font-face { + font-family: "Lato"; + font-style: italic; + font-weight: 400; + font-display: swap; + src: url("../fonts/lato-400-italic.woff2") format("woff2"); +} + +@font-face { + font-family: "Lato"; + font-style: normal; + font-weight: 700; + font-display: swap; + src: url("../fonts/lato-700.woff2") format("woff2"); +} + +@font-face { + font-family: "Lato"; + font-style: normal; + font-weight: 900; + font-display: swap; + src: url("../fonts/lato-900.woff2") format("woff2"); +} + +@theme { + --font-sans: "Lato", ui-sans-serif, system-ui, sans-serif; + + /* square everywhere; rounded-full stays round. Plain `rounded` reads --radius. */ + --radius: 0px; + --radius-xs: 0px; + --radius-sm: 0px; + --radius-md: 0px; + --radius-lg: 0px; + --radius-xl: 0px; + --radius-2xl: 0px; + --radius-3xl: 0px; + --radius-4xl: 0px; + + --color-brand: #18527b; /* E&P deep blue, 8.5:1 on white */ + --color-brand-dark: #103c5b; + --color-brand-mid: #165883; + --color-brand-bright: #009fff; /* underlines and focus, never text */ + --color-brand-light: #e3eef8; + + --color-page: #ebf3fa; /* page background */ + --color-line: #d8e3ed; /* borders */ + --color-ink: #27272a; /* text */ + --color-muted: #52525b; /* secondary text, 7.7:1 on white */ + + --color-accent: #c4097c; /* magenta of the main action */ + --color-accent-from: #960167; + --color-accent-to: #fa1a8c; +} + +/* + * Tailwind 3 defaults that Tailwind 4 changed: borders were a light gray instead of currentColor, + * and buttons had a pointer cursor. + */ +@layer base { + *, + ::after, + ::before, + ::backdrop, + ::file-selector-button { + border-color: var(--color-line, currentcolor); + } + + button:not(:disabled), + [role="button"]:not(:disabled) { + cursor: pointer; + } + + /* modals: centred (Preflight resets the browser's margin: auto), the page behind dimmed and blurred */ + dialog:modal { + margin: auto; + max-height: 85vh; + } + + dialog::backdrop { + background: rgb(39 39 42 / 0.35); + backdrop-filter: blur(3px); + } + + /* visible keyboard focus everywhere (WCAG 2.4.7) */ + :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible { + outline: 3px solid var(--color-brand-bright); + outline-offset: 2px; + } +} + +/* + * Components as in the apps template (frontend/components/ui.ts, Field.tsx, Alert.tsx). Magenta + * only for the one main action of a page. + */ +@layer components { + .btn, + .btn-primary, + .btn-secondary { + @apply inline-flex items-center justify-center gap-2 px-4 py-2.5 text-xs font-bold uppercase tracking-wide no-underline transition-colors disabled:cursor-not-allowed; + } + + .btn-primary { + @apply text-white; + background-image: linear-gradient(120deg, var(--color-accent-from), #9e036a 40%, var(--color-accent-to)); + } + + .btn-primary:hover { + background-image: linear-gradient(120deg, #7d0156, #8a035d 40%, #e3107c); + } + + .btn-primary:disabled { + background-image: none; + background-color: #64748b; + } + + .btn-secondary { + @apply border border-brand bg-white text-brand hover:bg-brand hover:text-white; + } + + /* small actions in toolbars and on cards, next to the one main action */ + .btn-tool { + @apply inline-flex items-center gap-1 rounded border border-line bg-white px-2 py-1 text-sm text-ink hover:border-brand hover:text-brand disabled:cursor-default disabled:border-line disabled:text-gray-400; + } + + /* the "⋯" behind which the actions of a card or row wait (menu_controller.js); finger-sized on touch screens */ + .btn-more { + @apply inline-flex h-6 w-6 pointer-coarse:h-10 pointer-coarse:w-10 shrink-0 items-center justify-center rounded text-muted hover:bg-page hover:text-brand aria-expanded:bg-page aria-expanded:text-brand; + } + + .menu-panel { + @apply fixed z-40 min-w-48 border border-line bg-white py-1 text-sm shadow-lg; + } + + .menu-item { + @apply block w-full px-3 py-1.5 pointer-coarse:py-3 text-left text-ink no-underline hover:bg-page hover:text-brand focus:bg-page; + } + + .menu-item-danger { + @apply block w-full px-3 py-1.5 pointer-coarse:py-3 text-left text-red-800 hover:bg-page hover:text-red-900 focus:bg-page; + } + + .input { + @apply block w-full border border-slate-500 bg-white px-3 py-2 text-sm text-slate-900 placeholder:text-slate-500 focus:border-brand-bright aria-[invalid=true]:border-red-700 aria-[invalid=true]:ring-1 aria-[invalid=true]:ring-red-700 disabled:bg-slate-100 disabled:text-slate-600; + } + + .field-label { + @apply block text-xs font-bold uppercase tracking-wide text-slate-700; + } + + /* white box on the light blue page */ + .card { + @apply border border-line bg-white; + } + + .section-title { + @apply text-base font-bold uppercase tracking-wide text-brand; + } + + /* a row of tabs; the base line is an inset shadow, so a row that scrolls sideways doesn't scroll vertically too */ + .tabs { + @apply flex overflow-x-auto shadow-[inset_0_-1px_0_var(--color-line)]; + } + + .tab { + @apply shrink-0 whitespace-nowrap border-b-4 border-transparent px-3 py-2 text-sm text-ink no-underline hover:text-brand; + } + + .tab[aria-current], + .tab[aria-selected="true"] { + @apply border-brand-bright font-bold text-brand; + } + + /* the main views as tabs in the header (_partials/_header.html.twig), for apps with few views */ + .header-tab { + @apply flex items-center whitespace-nowrap border-b-4 border-transparent px-3 text-ink no-underline hover:text-brand; + } + + .header-tab[aria-current] { + @apply border-brand-bright font-bold text-brand; + } + + /* + * Sidebar navigation for apps with many views (_partials/_sidebar_menu.html.twig): on the light + * blue page, the current item is a white box. + */ + .sidebar-heading { + @apply px-2 pt-5 pb-1 text-[11px] font-bold uppercase tracking-wide text-muted; + } + + .sidebar-link { + @apply flex w-full items-center gap-x-3 p-2 text-left text-sm leading-6 font-bold text-ink no-underline hover:bg-white/60 hover:text-brand; + } + + .sidebar-sublink { + @apply block py-2 pr-2 pl-10 text-sm leading-6 text-ink no-underline hover:bg-white/60 hover:text-brand; + } + + :is(.sidebar-link, .sidebar-sublink)[aria-current], + .sidebar-link--ancestor { + @apply bg-white text-brand; + } + + .sidebar-group > summary { + @apply list-none; + } + + .sidebar-group > summary::-webkit-details-marker { + display: none; + } + + /* chevron of a group that opens in place */ + .sidebar-group > summary::after { + @apply ml-auto size-2 shrink-0 rotate-45 border-r-2 border-b-2 border-current opacity-60 transition-transform content-['']; + } + + .sidebar-group[open] > summary::after { + @apply -rotate-135; + } + + /* the sidebar as a drawer from the left on small screens (drawer_controller.js) */ + dialog.drawer { + @apply m-0 h-dvh max-h-none w-80 max-w-[calc(100vw-4rem)] bg-page p-0; + } + + /* lists in a card: the outer cells line up with the card's padding */ + .data-table { + @apply w-full; + } + + .data-table thead tr { + @apply border-b-2 border-brand text-left text-[11px] font-bold uppercase tracking-wide text-brand; + } + + .data-table th { + @apply px-2 py-2; + } + + .data-table td { + @apply px-2 py-1.5; + } + + .data-table :is(th, td):first-child { + @apply pl-5; + } + + .data-table :is(th, td):last-child { + @apply pr-5; + } + + .data-table tbody tr { + @apply border-b last:border-b-0; + } + + /* notices (_partials/_alert.html.twig): light, with a coloured bar on the left */ + .notice { + @apply border-l-4 px-4 py-2; + } + + /* toasts (toast_controller.js) in the colours of the notices */ + .toastify { + @apply max-w-sm rounded-none border-l-4 bg-none px-4 py-3 text-sm shadow-lg; + } + + .toastify--success { + @apply border-emerald-700 bg-emerald-50 text-emerald-950; + } + + .toastify--error { + @apply border-red-700 bg-red-50 text-red-950; + } + + .toastify--warning { + @apply border-amber-600 bg-amber-50 text-amber-950; + } + + .toastify--info { + @apply border-brand bg-brand-light text-ink; + } + + .toastify .toast-close { + @apply ml-3 text-current opacity-60 hover:opacity-100; + } +} + +@media (prefers-reduced-motion: reduce) { + *, + *::before, + *::after { + animation-duration: 0.01ms !important; + animation-iteration-count: 1 !important; + transition-duration: 0.01ms !important; + scroll-behavior: auto !important; + } +} diff --git a/config/packages/knp_menu.yaml b/config/packages/knp_menu.yaml index 6ecd9e54..56322e6e 100644 --- a/config/packages/knp_menu.yaml +++ b/config/packages/knp_menu.yaml @@ -1,3 +1,3 @@ knp_menu: twig: - template: _partials/_menu.html.twig + template: admin/_partials/_sidebar_menu.html.twig diff --git a/templates/_partials/_flashes_admin.html.twig b/templates/_partials/_flashes_admin.html.twig index b4a772b6..41065207 100644 --- a/templates/_partials/_flashes_admin.html.twig +++ b/templates/_partials/_flashes_admin.html.twig @@ -1,5 +1,5 @@ {% if app.session.flashBag.peek('error')|length > 0 %} - {% include '_partials/_toast.html.twig' with { level: 'warning', messages: app.flashes('error') } %} + {% include '_partials/_toast.html.twig' with { level: 'error', messages: app.flashes('error') } %} {% endif %} {% if app.session.flashBag.peek('success')|length > 0 %} {% include '_partials/_toast.html.twig' with { level: 'success', messages: app.flashes('success') } %} diff --git a/templates/_partials/_list_filter_bar.html.twig b/templates/_partials/_list_filter_bar.html.twig index b0335787..5ddd0b64 100644 --- a/templates/_partials/_list_filter_bar.html.twig +++ b/templates/_partials/_list_filter_bar.html.twig @@ -28,9 +28,10 @@ name="q" value="{{ filter.q }}" placeholder="{{ form.q.vars.attr.placeholder|default('Suchen…') }}" - class="block w-64 rounded-md border-0 py-1.5 pl-9 text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset focus:ring-primary text-sm"> + aria-label="Suchen" + class="input w-64 pl-9">
- {{ icon('search', 'w-4 h-4 text-gray-500') }} + {{ icon('search', 'w-4 h-4 text-muted') }}
@@ -39,13 +40,13 @@ hx-get="{{ path(modal_route, app.request.query.all) }}" hx-target="body" hx-swap="beforeend" - class="button button--secondary button--small inline-flex items-center gap-1.5"> + class="btn-tool"> {{ icon('filter', 'w-4 h-4') }} Filter{% if filter.activeCount > 0 %} ({{ filter.activeCount }}){% endif %} {% if filter.isActive %} - + zurücksetzen {% endif %} @@ -54,11 +55,11 @@ {% if chips|length > 0 %}
{% for chip in chips %} - + {{ chip.label }}: {{ chip.value }} {% if chip.isRemovable %} {{ icon('close', 'w-3 h-3') }} diff --git a/templates/_partials/_menu.html.twig b/templates/_partials/_menu.html.twig deleted file mode 100644 index e9e77c88..00000000 --- a/templates/_partials/_menu.html.twig +++ /dev/null @@ -1,83 +0,0 @@ -{% extends 'knp_menu.html.twig' %} - -{% block list %} - {% if item.hasChildren and options.depth is not same as(0) and item.displayChildren %} - {% if item.level == 0 %} -
- -
- {% else %} -
    - {{ block('children') }} -
- {% endif %} - {% endif %} -{% endblock %} - -{% block item %} - {% if item.displayed %} -
  • - {%- if item.hasChildren and item.displayChildren %} -
    - {%- endif %} - {%- if item.uri is not empty %} - {{ block('linkElement') }} - {%- else %} - {{ block('spanElement') }} - {%- endif %} - {{ block('list') }} - {%- if item.hasChildren and item.displayChildren %} -
    - {%- endif %} -
  • - {% endif %} -{% endblock %} - -{% block linkElement %} - {% import _self as knp_menu %} - - {{ block('label') }} - -{% endblock %} - -{% block spanElement %} - {% import _self as knp_menu %} - {% if item.hasChildren %} - - {% elseif item.extras.divider is defined %} -
    - {% else %} -
    - {{ block('label') }} -
    - {% endif %} -{% endblock %} - -{% block label %} - {% if item.extras.icon is defined %} - {{ icon(item.extras.icon, 'h-5 w-5 shrink-0 ' ~ ((matcher.isCurrent(item) or matcher.isAncestor(item)) ? 'text-gray-600' : 'text-gray-400')) }} - {{ item.label|raw }} - {% else %} - {{ item.label|raw }} - {% endif %} -{% endblock %} - diff --git a/templates/_partials/_paginator_sliding.html.twig b/templates/_partials/_paginator_sliding.html.twig index 008383f1..4e9a4c20 100644 --- a/templates/_partials/_paginator_sliding.html.twig +++ b/templates/_partials/_paginator_sliding.html.twig @@ -1,12 +1,13 @@ {% if pageCount > 0 %} -
    +
    -
    +
    {{ 'paginator.info'|trans({ '{from}': firstItemNumber, '{to}': lastItemNumber, '{total}': totalCount })|raw }}
    -{%- endblock checkbox_widget -%} +{% endblock %} +{# the box in front of its label, the hint below #} {% block checkbox_row %} -
    -
    - {{ form_widget(form) }} -
    -
    - - {{- form_errors(form) -}} -
    + {% set describedBy = [help ? id ~ '_help', errors|length ? id ~ '_errors']|filter(v => v) %} +
    + + {{ form_help(form) }} + {{ form_errors(form) }}
    {% endblock %} -{%- block choice_widget_collapsed -%} - {%- set attr = attr|merge({'class': (attr.class|default('') ~ ' block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset text-sm')|trim }) -%} - {%- if errors|length -%} - {%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-500 placeholder-red-500 focus:ring-red-500' }) -%} - {% else %} - {%- set attr = attr|merge({'class': attr.class|default('') ~ ' placeholder:text-gray-400 focus:ring-primary' }) -%} - {%- endif -%} - {%- if disabled is defined and disabled == true -%} - {%- set attr = attr|merge({'class': attr.class|default('') ~ ' cursor-not-allowed' }) -%} - {%- endif -%} - {{ parent() }} -{%- endblock choice_widget_collapsed -%} - -{%- block choice_widget_expanded -%} - {%- for child in form %} -
    -
    - -
    -
    - {{- form_widget(child) -}} -
    -
    - {% endfor -%} -{%- endblock choice_widget_expanded -%} - -{%- block birthday_widget -%} -
    - {{ form_widget(form.children['day']) }} - {{ form_widget(form.children['month']) }} - {{ form_widget(form.children['year']) }} -
    -{%- endblock -%} - -{% block abbreviated_date_widget %} - {%- set class = 'flex items-center space-x-1 ' ~ attr.class|default('') -%} - {%- do form.setRendered -%} - {%- if errors|length -%} - {%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-500 placeholder-red-500 focus:ring-red-500' }) -%} - {%- endif -%} -
    - {{ form_widget(form.month, { 'attr': attr })}} - / - {{ form_widget(form.year, { 'attr': attr })}} -
    -{% endblock %} - -{%- block money_widget -%} - {% set currency_class = 'absolute top-1/2 transform -translate-y-1/2 right-0 mr-2' %} - {% if errors|length %} - {% set currency_class = currency_class ~ ' text-red-500' %} - {% else %} - {% set currency_class = currency_class ~ ' text-gray-600' %} +{% block form_label %} + {% if label is not same as(false) %} + {% set label_attr = label_attr|merge({class: 'field-label mb-1 ' ~ (label_attr.class ?? '')}) %} + {{ parent() }} {% endif %} +{% endblock %} + +{% block form_label_content %} + {{- parent() -}} + {%- if required %} (Pflichtfeld){% endif -%} +{% endblock %} + +{% block form_widget_simple %} + {% set attr = attr|merge({class: 'input ' ~ (attr.class ?? '')}) %} + {{ parent() }} +{% endblock %} + +{% block choice_widget_collapsed %} + {% set attr = attr|merge({class: 'input ' ~ (attr.class ?? '')}) %} + {{ parent() }} +{% endblock %} + +{% block form_help %} + {% if help %} +

    {{ help }}

    + {% endif %} +{% endblock %} + +{% block form_errors %} + {% if errors|length %} +

    + {%- for error in errors %}{{ error.message }}{% if not loop.last %} {% endif %}{% endfor -%} +

    + {% endif %} +{% endblock %} + +{# myep additions for the admin forms #} + +{% block textarea_widget %} + {% set attr = attr|merge({class: 'input ' ~ (attr.class ?? '')}) %} + {{ parent() }} +{% endblock %} + +{# a list of boxes or radios, each in front of its label #} +{% block choice_widget_expanded %} +
    + {% for child in form %} + + {% endfor %} +
    +{% endblock %} + +{# the currency inside the field, on the right #} +{% block money_widget %}
    {{ block('form_widget_simple') }} - {{ money_pattern|replace({'{{ widget }}': ''})|trim }} + {{ money_pattern|replace({'{{ widget }}': ''})|trim }}
    -{%- endblock money_widget -%} - -{%- block datepicker_widget -%} - {%- set minDate = form.vars.min_date ? form.vars.min_date | date('Y-m-d') : null -%} - {%- set maxDate = form.vars.max_date ? form.vars.max_date | date('Y-m-d') : null -%} - {%- set displayValue = value ? value|date('d.m.Y') : '' -%} - {%- set inputClass = 'block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset text-sm' -%} - {%- if errors|length -%} - {%- set inputClass = inputClass ~ ' ring-red-500 placeholder:red-500 focus:ring-red-500' -%} - {%- else -%} - {%- set inputClass = inputClass ~ ' placeholder:text-gray-900 focus:ring-primary' -%} - {%- endif -%} - {%- if disabled is defined and disabled == true -%} - {%- set inputClass = inputClass ~ ' cursor-not-allowed' -%} - {%- endif -%} -
    - - -
    -{%- endblock datepicker_widget %} - -{%- block autocomplete_widget -%} - {%- set attr = attr|merge({'class': (attr.class|default('') ~ ' autocomplete-input block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset text-sm')|trim }) -%} - {%- if errors|length -%} - {%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-500 placeholder-red-500 focus:ring-red-500' }) -%} - {% else %} - {%- set attr = attr|merge({'class': attr.class|default('') ~ ' placeholder:text-gray-400 focus:ring-primary' }) -%} - {%- endif -%} - {%- if disabled is defined and disabled == true -%} - {%- set attr = attr|merge({'class': attr.class|default('') ~ ' cursor-not-allowed' }) -%} - {%- endif -%} -
    - -
      - - -
      - {{ icon('search', 'w-4 h-4 text-gray-700') }} -
      -
      -{%- endblock autocomplete_widget -%} - -{%- block multiselect_widget -%} -
      -
      -
      - {{ icon('dots', 'w-4 h-4 mt-2') }} -
      - -
      -{%- endblock multiselect_widget -%} +{% endblock %} diff --git a/templates/htmx_confirmation_modal.html.twig b/templates/htmx_confirmation_modal.html.twig index 551814f3..79ce90d4 100644 --- a/templates/htmx_confirmation_modal.html.twig +++ b/templates/htmx_confirmation_modal.html.twig @@ -1,28 +1,27 @@ -
      -
      -
      -
      -
      - {{ icon('alert', 'w-8 h-8') }} -
      +
      +
      +
      +
      +
      + {{ icon('alert', 'size-7 shrink-0') }} +

      {% block title %}Bist du sicher?{% endblock %} -

      +
      - +
      {% block content %}{% endblock %}
      -
      diff --git a/templates/htmx_modal_admin.html.twig b/templates/htmx_modal_admin.html.twig index 7cacb9ec..0864efaa 100644 --- a/templates/htmx_modal_admin.html.twig +++ b/templates/htmx_modal_admin.html.twig @@ -1,20 +1,16 @@
      -
      -
      -
      -
      -
      + class="fixed inset-0 z-50 h-full w-full" {{ stimulus_controller('modal') }} {{ stimulus_action('modal', 'close', 'modal-close@window') }}> +
      +
      + -
      -
      +
      +
      {% block content %}{% endblock %}
      diff --git a/templates/layout_admin.html.twig b/templates/layout_admin.html.twig index b2b82879..c0373810 100644 --- a/templates/layout_admin.html.twig +++ b/templates/layout_admin.html.twig @@ -1,49 +1,50 @@ +{# + The admin in the sidebar layout of the E&P corporate design: the KnpMenu menu `admin_main` in a + left sidebar from lg up, below that in a drawer behind the menu button. +#} {% extends 'base_admin.html.twig' %} {% block body %} -
      -
      - - My E&P Admin - - {% if app.user %} -
      - -
      - {% endif %} -
      - -
      - {% block content %}{% endblock %} -
      -
      -
      -
      -
      - - -
      -
      +
      + {% embed 'admin/_partials/_header.html.twig' with { + app_name: 'MyE&P Admin', + home_path: path(app.user ? 'app_admin_dashboard' : 'app_login'), + header_width: 'mx-auto max-w-screen-2xl px-4 lg:px-8', + } %} + {% block header_end %} {% if app.user %} - {{ knp_menu_render(knp_menu_get('admin_main')) }} + + {% endif %} -
      + {% endblock %} + {% endembed %} + +
      + +
      + {% block content %}{% endblock %} +
      + + {% if app.user %} + + {# fills the dialog, so only clicks beside the drawer reach the dialog element itself #} +
      +
      + + +
      + +
      +
      + {% endif %}
      - {% include '_partials/_flashes_admin.html.twig' %} {% endblock %}