Use classes helper

This commit is contained in:
Giuseppe Criscione 2024-05-01 16:33:37 +02:00
parent 0375d6c2b7
commit 538d1a162d
4 changed files with 13 additions and 5 deletions

View File

@ -4,7 +4,7 @@
<label class="form-label" for="username"><?= $this->translate('panel.login.username') ?>:</label>
<input class="form-input" id="username" type="text" required name="username" <?php if (!empty($username)) : ?>value="<?= $username ?>" <?php else : ?>autofocus<?php endif ?> maxlength="20">
<label class="form-label" for="password"><?= $this->translate('panel.login.password') ?>:</label>
<input class="form-input<?php if (!empty($error)) : ?> form-input-invalid<?php endif ?>" <?php if (!empty($error)) : ?>autofocus <?php endif ?>id="password" type="password" required name="password">
<input class="<?= $this->classes(['form-input', 'form-input-invalid' => !empty($error)]) ?>" <?php if (!empty($error)) : ?>autofocus <?php endif ?>id="password" type="password" required name="password">
<input type="hidden" name="csrf-token" value="<?= $csrfToken ?>">
<button type="submit" class="button button-accent mt-8"><?= $this->icon('arrow-right-circle') ?> <?= $this->translate('panel.login.login') ?></button>
</form>

View File

@ -19,7 +19,7 @@
<input type="hidden" id="language" name="language" value="<?= $currentLanguage ?>">
<?php endif ?>
<div>
<a class="button button-link<?php if (!$page->published() || !$page->routable()) : ?> disabled<?php endif ?>" role="button" <?php if ($page->published() && $page->routable()) : ?>href="<?= $page->uri(includeLanguage: $currentLanguage ?: true) ?>" <?php endif ?> target="formwork-preview-<?= $page->uid() ?>" title="<?= $this->translate('panel.pages.preview') ?>" aria-label="<?= $this->translate('panel.pages.preview') ?>"><?= $this->icon('eye') ?></a>
<a class="<?= $this->classes(['button', 'button-link', 'disabled' => !$page->published() || !$page->routable()]) ?>" role="button" <?php if ($page->published() && $page->routable()) : ?>href="<?= $page->uri(includeLanguage: $currentLanguage ?: true) ?>" <?php endif ?> target="formwork-preview-<?= $page->uid() ?>" title="<?= $this->translate('panel.pages.preview') ?>" aria-label="<?= $this->translate('panel.pages.preview') ?>"><?= $this->icon('eye') ?></a>
<?php if ($panel->user()->permissions()->has('pages.delete')) : ?>
<button type="button" class="button button-link" data-modal="deletePageModal" data-modal-action="<?= $panel->uri('/pages/' . trim($page->route(), '/') . '/delete/' . ($currentLanguage ? 'language/' . $currentLanguage . '/' : '')) ?>" title="<?= $this->translate('panel.pages.deletePage') ?>" aria-label="<?= $this->translate('panel.pages.deletePage') ?>" <?php if (!$page->isDeletable()) : ?> disabled<?php endif ?>><?= $this->icon('trash') ?></button>
<?php endif ?>

View File

@ -11,7 +11,14 @@
<?php foreach ($pages as $page) : ?>
<?php $routable = $page->published() && $page->routable() ?>
<?php $date = $this->datetime($page->contentFile()->lastModifiedTime()) ?>
<li class="pages-tree-item <?php if ($includeChildren) : ?>pages-tree-level-<?= $page->level() ?> <?php endif ?><?php if ($page->hasChildren()) : ?>has-children <?php endif ?><?= $page->orderable() ? 'is-orderable' : 'is-not-orderable' ?>" data-route="<?= $page->route() ?>">
<li class="<?= $this->classes([
'pages-tree-item',
'pages-tree-level-' . $page->level() => $includeChildren,
'has-children' => $page->hasChildren(),
'is-orderable' => $page->orderable(),
'is-not-orderable' => !$page->orderable()
])
?>" data-route="<?= $page->route() ?>">
<div class="pages-tree-row">
<div class="pages-tree-item-cell page-details">
<div class="page-title flex">
@ -45,7 +52,7 @@
<span class="page-status-label"><?= $this->translate('panel.pages.status.' . $page->status()) ?></span>
</div>
<div class="pages-tree-item-cell page-actions">
<a class="button button-link<?php if (!$page->published() || !$page->routable()) : ?> disabled<?php endif ?>" role="button" <?php if ($page->published() && $page->routable()) : ?>href="<?= $page->uri(includeLanguage: false) ?>" <?php endif ?> target="formwork-preview-<?= $page->uid() ?>" title="<?= $this->translate('panel.pages.preview') ?>" aria-label="<?= $this->translate('panel.pages.preview') ?>"><?= $this->icon('eye') ?></a>
<a class="<?= $this->classes(['button', 'button-link', 'disabled' => !$page->published() || !$page->routable()]) ?>" role="button" <?php if ($page->published() && $page->routable()) : ?>href="<?= $page->uri(includeLanguage: false) ?>" <?php endif ?> target="formwork-preview-<?= $page->uid() ?>" title="<?= $this->translate('panel.pages.preview') ?>" aria-label="<?= $this->translate('panel.pages.preview') ?>"><?= $this->icon('eye') ?></a>
<?php if ($panel->user()->permissions()->has('pages.delete')) : ?>
<button type="button" class="button button-link" data-modal="deletePageModal" data-modal-action="<?= $panel->uri('/pages/' . trim($page->route(), '/') . '/delete/') ?>" title="<?= $this->translate('panel.pages.deletePage') ?>" aria-label="<?= $this->translate('panel.pages.deletePage') ?>" <?php if (!$page->isDeletable()) : ?> disabled<?php endif ?>><?= $this->icon('trash') ?></button>
<?php endif ?>

View File

@ -1,10 +1,11 @@
<?php var_dump($this::class) ?>
<nav class="menu">
<div class="container">
<a class="menu-header" href="<?= $site->uri() ?>"><?= $site->title() ?></a>
<button type="button" class="button menu-toggle" data-toggle="main-menu" aria-expanded="false">&#9776;</button>
<div class="menu-list menu-collapse" id="main-menu">
<?php foreach ($site->children()->published()->listed() as $item) : ?>
<a class="menu-item<?php if ($item->isCurrent()) : ?> active<?php endif ?>" href="<?= $item->uri() ?>"><?= $item->get('menu', $item->title()) ?></a>
<a class="<?= $this->classes(['menu-item', 'active' => $item->isCurrent()]) ?>" href="<?= $item->uri() ?>"><?= $item->get('menu', $item->title()) ?></a>
<?php endforeach ?>
</div>
</div>