Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions formwork/src/Panel/Navigation/NavigationItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,12 @@ public function badge(): ?string
{
return $this->data['badge'] ?? null;
}

/**
* Get navigation item icon
*/
public function icon(): ?string
{
return $this->data['icon'] ?? null;
}
}
1 change: 1 addition & 0 deletions panel/assets/icons/svg/chart-line.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions panel/assets/icons/svg/files.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions panel/assets/icons/svg/gear.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion panel/assets/icons/svg/home.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion panel/assets/icons/svg/page-home.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions panel/assets/icons/svg/pages.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions panel/assets/icons/svg/toolbox.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions panel/assets/icons/svg/users.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions panel/config/navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,49 @@
'uri' => '/dashboard/',
'permissions' => 'panel.dashboard',
'badge' => null,
'icon' => 'home',
],
'pages' => [
'label' => $translation->translate('panel.pages.pages'),
'uri' => '/pages/',
'permissions' => 'panel.pages',
'badge' => $site->descendants()->count(),
'icon' => 'pages',
],
'files' => [
'label' => $translation->translate('panel.files.files'),
'uri' => '/files/',
'permissions' => 'panel.files',
'badge' => null,
'icon' => 'files',
],
'statistics' => [
'label' => $translation->translate('panel.statistics.statistics'),
'uri' => '/statistics/',
'permissions' => 'panel.statistics',
'badge' => null,
'icon' => 'chart-line',
],
'users' => [
'label' => $translation->translate('panel.users.users'),
'uri' => '/users/',
'permissions' => 'panel.users',
'badge' => $site->users()->count(),
'icon' => 'users',
],
'options' => [
'label' => $translation->translate('panel.options.options'),
'uri' => '/options/',
'permissions' => 'panel.options',
'badge' => null,
'icon' => 'gear',
],
'tools' => [
'label' => $translation->translate('panel.tools.tools'),
'uri' => '/tools/',
'permissions' => 'panel.tools',
'badge' => null,
'icon' => 'toolbox',
],
'logout' => [
'label' => $translation->translate('panel.login.logout'),
Expand Down
6 changes: 5 additions & 1 deletion panel/src/scss/components/_sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
.sidebar-navigation > li {
position: relative;
padding: 0.25rem 0;
padding-left: 1rem;
padding-left: 0.75rem;
margin: 0;
margin-bottom: 0.5rem;
}
Expand All @@ -61,6 +61,10 @@
color: var(--color-base-100);
}

.sidebar-navigation > li .icon {
margin-right: 0.375rem;
}

.sidebar-navigation > .active {
font-weight: 600;
}
Expand Down
3 changes: 2 additions & 1 deletion panel/views/dashboard/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<div data-view="dashboard">
<div class="header">
<div class="header-icon"><?= $this->icon('home') ?></div>
<div class="header-title"><?= $this->translate('panel.dashboard.dashboard') ?></div>
</div>

Expand Down Expand Up @@ -62,4 +63,4 @@
</div>
<?= $lastModifiedPages ?>
</section>
</div>
</div>
1 change: 1 addition & 0 deletions panel/views/files/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

<div data-view="files">
<div class="header">
<div class="header-icon"><?= $this->icon('files') ?></div>
<div class="header-title"><?= $this->translate('panel.files.files') ?></div>
<div>
<?php if ($panel->user()->permissions()->has('panel.files.upload')) : ?>
Expand Down
1 change: 1 addition & 0 deletions panel/views/options/site.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<form method="post" enctype="multipart/form-data" class="options-form" data-form="site-options-form">
<div class="header">
<div class="header-icon"><?= $this->icon('gear') ?></div>
<div class="header-title"><?= $this->translate('panel.options.options') ?></div>
<div>
<button type="submit" class="button button-accent button-right" data-command="save"><?= $this->icon('check-circle') ?> <?= $this->translate('panel.modal.action.save') ?></button>
Expand Down
1 change: 1 addition & 0 deletions panel/views/options/system.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<form method="post" enctype="multipart/form-data" class="options-form" data-form="system-options-form">
<div class="header">
<div class="header-icon"><?= $this->icon('gear') ?></div>
<div class="header-title"><?= $this->translate('panel.options.options') ?></div>
<div>
<button type="submit" class="button button-accent button-right" data-command="save"><?= $this->icon('check-circle') ?> <?= $this->translate('panel.modal.action.save') ?></button>
Expand Down
3 changes: 2 additions & 1 deletion panel/views/pages/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<div class="header">
<div class="flex mr-auto overflow-hidden">
<div class="min-w-0 flex">
<div class="header-icon"><?= $this->icon('pages') ?></div>
<div class="header-title mr-4"><?= $this->translate('panel.pages.pages') ?></div>
<?php foreach ($parent->ancestors()->reverse()->with($parent) as $page) : ?>
<div class="text-color-gray-medium mr-4">/</div>
Expand Down Expand Up @@ -38,4 +39,4 @@
</div>
</div>
<?= $pagesTree ?>
</section>
</section>
3 changes: 3 additions & 0 deletions panel/views/partials/sidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
<?php foreach ($panel->navigation() as $item) : ?>
<?php if ($item->permissions() === null || $panel->user()->permissions()->has($item->permissions())) : ?>
<li class="<?= $this->classes(['active' => $location === $item->id()]) ?>">
<?php if ($item->icon()) : ?>
<?= $this->icon($item->icon()) ?>
<?php endif ?>
<a href="<?= $panel->uri($item->uri()) ?>"><?= $this->escape($item->label()) ?></a>
<?php if ($item->badge()) : ?>
<span class="badge"><?= $item->badge() ?></span>
Expand Down
3 changes: 2 additions & 1 deletion panel/views/statistics/index.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php $this->layout('panel') ?>

<div class="header">
<div class="header-icon"><?= $this->icon('chart-line') ?></div>
<div class="header-title"><?= $this->translate('panel.statistics.statistics') ?></div>
</div>

Expand Down Expand Up @@ -116,4 +117,4 @@
</table>
</section>
</div>
</div>
</div>
3 changes: 2 additions & 1 deletion panel/views/tools/backups.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<?php $this->modals()->add('deleteFile') ?>

<div class="header">
<div class="header-icon"><?= $this->icon('toolbox') ?></div>
<div class="header-title"><?= $this->translate('panel.tools.tools') ?></div>
</div>

Expand Down Expand Up @@ -50,4 +51,4 @@
<button type="button" class="button button-link backup-delete" data-modal="deleteFileModal" data-modal-action="" title="<?= $this->translate('panel.tools.backup.delete') ?>" aria-label="<?= $this->translate('panel.tools.backup.delete') ?>"><?= $this->icon('trash') ?></button>
</td>
</tr>
</template>
</template>
3 changes: 2 additions & 1 deletion panel/views/tools/info.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php $this->layout('panel') ?>

<div class="header">
<div class="header-icon"><?= $this->icon('toolbox') ?></div>
<div class="header-title"><?= $this->translate('panel.tools.tools') ?></div>
</div>

Expand Down Expand Up @@ -43,4 +44,4 @@
</div>
</section>
<?php endforeach ?>
</div>
</div>
3 changes: 2 additions & 1 deletion panel/views/tools/updates.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php $this->layout('panel') ?>

<div class="header">
<div class="header-icon"><?= $this->icon('toolbox') ?></div>
<div class="header-title"><?= $this->translate('panel.tools.tools') ?></div>
</div>

Expand All @@ -24,4 +25,4 @@
<p><strong class="current-version-name">Formwork <?= $currentVersion ?></strong> <?= $this->translate('panel.updates.latestVersionAvailable') ?></p>
</div>
</div>
</section>
</section>
3 changes: 2 additions & 1 deletion panel/views/users/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<?php $this->modals()->addMultiple(['newUser', 'deleteUser']) ?>

<div class="header">
<div class="header-icon"><?= $this->icon('users') ?></div>
<div class="header-title"><?= $this->translate('panel.users.users') ?> <span class="badge"><?= $users->count() ?></span></div>
<div>
<button type="button" class="button button-accent" data-modal="newUserModal" <?php if (!$panel->user()->permissions()->has('panel.users.create')) : ?> disabled<?php endif ?>><?= $this->icon('plus-circle') ?> <?= $this->translate('panel.users.newUser') ?></button>
Expand Down Expand Up @@ -33,4 +34,4 @@
</div>
<?php endforeach ?>
</div>
</section>
</section>
3 changes: 2 additions & 1 deletion panel/views/users/profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<form method="post" enctype="multipart/form-data" data-form="user-profile-form">
<div class="header">
<div class="header-icon"><?= $this->icon('user') ?></div>
<div class="header-title"><?= $this->translate('user.user') ?></div>
<?php if ($panel->user()->canChangeOptionsOf($user)) : ?>
<div>
Expand Down Expand Up @@ -38,4 +39,4 @@
<?php $this->insert('fields', ['fields' => $fields]) ?>
<input type="hidden" name="csrf-token" value="<?= $csrfToken ?>">
<?php endif ?>
</form>
</form>