mirror of
https://github.com/jbcr/core.git
synced 2026-04-03 06:42:30 +02:00
Working on sidebar
This commit is contained in:
@@ -26,10 +26,10 @@
|
||||
{{item.name}}
|
||||
</p>
|
||||
<a class="admin__sidebar--link" :href="item.link" v-else-if="item.singleton">
|
||||
<i class="fas mr-2 link--icon" :class="item.icon_one"></i><span class="link--text">{{item.name}}</span>
|
||||
<i class="fas mr-2 link--icon" :class="item.icon"></i><span class="link--text">{{item.name}}</span>
|
||||
</a>
|
||||
<a :href="item.link" class="admin__sidebar--link" :class="{ 'has-menu': item.submenu !== null || item.contenttype !== null }" v-else>
|
||||
<i class="fas mr-2 link--icon" :class="item.icon_one"></i><span class="link--text">{{item.name}}</span>
|
||||
<i class="fas mr-2 link--icon" :class="item.icon"></i><span class="link--text">{{item.name}}</span>
|
||||
|
||||
<template v-if="item.submenu !== null || item.contenttype !== null">
|
||||
<i class="fas fa-caret-right link--caret"></i>
|
||||
@@ -41,7 +41,7 @@
|
||||
</li>
|
||||
<li v-if="item.submenu !== null" v-for="(record, index) in item.submenu" :key="index">
|
||||
<a :href="record.editlink">
|
||||
<i class="fas mr-2" :class="record.icon_one"></i><span v-html="record.name"></span>
|
||||
<i class="fas mr-2" :class="record.icon"></i><span v-html="record.name"></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -54,14 +54,14 @@ class MenuBuilder
|
||||
|
||||
$menu->addChild('Dashboard', ['uri' => 'homepage', 'extras' => [
|
||||
'name' => 'Dashboard',
|
||||
'icon_one' => 'fa-tachometer-alt',
|
||||
'icon' => 'fa-tachometer-alt',
|
||||
'link' => '/bolt/',
|
||||
]]);
|
||||
|
||||
$menu->addChild('Content', ['uri' => 'content', 'extras' => [
|
||||
'name' => 'Content',
|
||||
'type' => 'separator',
|
||||
'icon_one' => 'fa-file',
|
||||
'icon' => 'fa-file',
|
||||
]]);
|
||||
|
||||
$contenttypes = $this->config->get('contenttypes');
|
||||
@@ -72,8 +72,7 @@ class MenuBuilder
|
||||
'singular_name' => $contenttype['singular_name'],
|
||||
'slug' => $contenttype['slug'],
|
||||
'singular_slug' => $contenttype['singular_slug'],
|
||||
'icon_one' => $contenttype['icon_one'],
|
||||
'icon_many' => $contenttype['icon_many'],
|
||||
'icon' => $contenttype['icon_many'],
|
||||
'link' => $this->urlGenerator->generate('bolt_contentlisting', ['contenttype' => $contenttype['slug']]),
|
||||
'link_new' => $this->urlGenerator->generate('bolt_edit_record', ['id' => $contenttype['slug']]),
|
||||
'contenttype' => $contenttype['slug'],
|
||||
@@ -86,114 +85,114 @@ class MenuBuilder
|
||||
$menu->addChild('Settings', ['uri' => 'settings', 'extras' => [
|
||||
'name' => 'Settings',
|
||||
'type' => 'separator',
|
||||
'icon_one' => 'fa-wrench',
|
||||
'icon' => 'fa-wrench',
|
||||
]]);
|
||||
|
||||
// Configuration submenu
|
||||
|
||||
$menu->addChild('Configuration', ['uri' => 'configuration', 'extras' => [
|
||||
'name' => 'Configuration',
|
||||
'icon_one' => 'fa-flag',
|
||||
'icon' => 'fa-flag',
|
||||
'link' => '/bolt/finder/config',
|
||||
]]);
|
||||
|
||||
$menu['Configuration']->addChild('Users & Permissions', ['uri' => 'users', 'extras' => [
|
||||
'name' => 'Users & Permissions',
|
||||
'icon_one' => 'fa-group',
|
||||
'icon' => 'fa-group',
|
||||
'link' => '/bolt/finder/config',
|
||||
]]);
|
||||
|
||||
$menu['Configuration']->addChild('Main configuration', ['uri' => 'config', 'extras' => [
|
||||
'name' => 'Main configuration',
|
||||
'icon_one' => 'fa-cog',
|
||||
'icon' => 'fa-cog',
|
||||
'link' => '/bolt/editfile/config?file=/bolt/config.yaml',
|
||||
]]);
|
||||
|
||||
$menu['Configuration']->addChild('ContentTypes', ['uri' => 'contenttypes', 'extras' => [
|
||||
'name' => 'ContentTypes',
|
||||
'icon_one' => 'fa-paint-brush',
|
||||
'icon' => 'fa-paint-brush',
|
||||
'link' => '/bolt/editfile/config?file=/bolt/contenttypes.yml',
|
||||
]]);
|
||||
|
||||
$menu['Configuration']->addChild('Taxonomy', ['uri' => 'taxonomy', 'extras' => [
|
||||
'name' => 'Taxonomy',
|
||||
'icon_one' => 'fa-tags',
|
||||
'icon' => 'fa-tags',
|
||||
'link' => '/bolt/editfile/config?file=/bolt/taxonomy.yml',
|
||||
]]);
|
||||
|
||||
$menu['Configuration']->addChild('Menu set up', ['uri' => 'menusetup', 'extras' => [
|
||||
'name' => 'Menu set up',
|
||||
'type' => 'separator',
|
||||
'icon_one' => 'fa-list',
|
||||
'icon' => 'fa-list',
|
||||
'link' => '/bolt/editfile/config?file=/bolt/menu.yml',
|
||||
]]);
|
||||
|
||||
$menu['Configuration']->addChild('Routing set up', ['uri' => 'routing', 'extras' => [
|
||||
'name' => 'Routing set up',
|
||||
'icon_one' => 'fa-random',
|
||||
'icon' => 'fa-random',
|
||||
'link' => '/bolt/editfile/config?file=/bolt/routing.yml',
|
||||
]]);
|
||||
|
||||
$menu['Configuration']->addChild('Check database', ['uri' => 'database', 'extras' => [
|
||||
'name' => 'Check database',
|
||||
'type' => 'separator',
|
||||
'icon_one' => 'fa-database',
|
||||
'icon' => 'fa-database',
|
||||
'link' => '/bolt/finder/config',
|
||||
]]);
|
||||
|
||||
$menu['Configuration']->addChild('Clear the cache', ['uri' => 'cache', 'extras' => [
|
||||
'name' => 'Clear the cache',
|
||||
'icon_one' => 'fa-eraser',
|
||||
'icon' => 'fa-eraser',
|
||||
'link' => '/bolt/finder/config',
|
||||
]]);
|
||||
|
||||
$menu['Configuration']->addChild('Change Log', ['uri' => 'else', 'extras' => [
|
||||
'name' => 'Change Log',
|
||||
'icon_one' => 'fa-archive',
|
||||
'icon' => 'fa-archive',
|
||||
'link' => '/bolt/finder/config',
|
||||
]]);
|
||||
|
||||
$menu['Configuration']->addChild('System Log', ['uri' => 'else', 'extras' => [
|
||||
'name' => 'System Log',
|
||||
'icon_one' => 'fa-archive',
|
||||
'icon' => 'fa-archive',
|
||||
'link' => '/bolt/finder/config',
|
||||
]]);
|
||||
|
||||
$menu['Configuration']->addChild('Set-up checks', ['uri' => 'else', 'extras' => [
|
||||
'name' => 'Set-up checks',
|
||||
'icon_one' => 'fa-support',
|
||||
'icon' => 'fa-support',
|
||||
'link' => '/bolt/finder/config',
|
||||
]]);
|
||||
|
||||
$menu['Configuration']->addChild('Translations: Messages', ['uri' => 'else', 'extras' => [
|
||||
'name' => 'Translations: Messages',
|
||||
'type' => 'separator',
|
||||
'icon_one' => 'fa-flag',
|
||||
'icon' => 'fa-flag',
|
||||
'link' => '/bolt/finder/config',
|
||||
]]);
|
||||
|
||||
// File Management submenu
|
||||
$menu->addChild('File Management', ['uri' => 'content-files', 'extras' => [
|
||||
'name' => 'File Management',
|
||||
'icon_one' => 'fa-flag',
|
||||
'icon' => 'fa-flag',
|
||||
'link' => '/bolt/finder/files',
|
||||
]]);
|
||||
|
||||
$menu['File Management']->addChild('Uploaded files', ['uri' => 'content-files', 'extras' => [
|
||||
'name' => 'Uploaded files',
|
||||
'icon_one' => 'fa-folder-open-o',
|
||||
'icon' => 'fa-folder-open-o',
|
||||
'link' => '/bolt/finder/files',
|
||||
]]);
|
||||
|
||||
$menu['File Management']->addChild('View/edit Templates', ['uri' => 'theme-files', 'extras' => [
|
||||
'name' => 'View/edit Templates',
|
||||
'icon_one' => 'fa-desktop',
|
||||
'icon' => 'fa-desktop',
|
||||
'link' => '/bolt/finder/themes',
|
||||
]]);
|
||||
|
||||
$menu->addChild('Extensions', ['uri' => 'extensions', 'extras' => [
|
||||
'name' => 'Extensions',
|
||||
'icon_one' => 'fa-cubes',
|
||||
'icon' => 'fa-cubes',
|
||||
'link' => '/bolt/extensions',
|
||||
]]);
|
||||
|
||||
@@ -208,7 +207,7 @@ class MenuBuilder
|
||||
$contenttype = ContentTypeFactory::get($slug, $this->config->get('contenttypes'));
|
||||
|
||||
/** @var Content $records */
|
||||
$records = $this->content->findAll(1, $contenttype);
|
||||
$records = $this->content->findLatest($contenttype, 5);
|
||||
|
||||
$result = [];
|
||||
|
||||
@@ -216,9 +215,10 @@ class MenuBuilder
|
||||
foreach ($records as $record) {
|
||||
$result[] = [
|
||||
'id' => $record->getId(),
|
||||
'title' => $record->magicTitle(),
|
||||
'name' => $record->magicTitle(),
|
||||
'link' => $record->magicLink(),
|
||||
'editlink' => $record->magicEditLink(),
|
||||
'icon' => $record->getDefinition()->get('icon_one'),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -241,8 +241,7 @@ class MenuBuilder
|
||||
'singular_name' => $submenuChild->getExtra('singular_name'),
|
||||
'slug' => $submenuChild->getExtra('slug'),
|
||||
'singular_slug' => $submenuChild->getExtra('singular_slug'),
|
||||
'icon_one' => $submenuChild->getExtra('icon_one'),
|
||||
'icon_many' => $submenuChild->getExtra('icon_many'),
|
||||
'icon' => $submenuChild->getExtra('icon'),
|
||||
'link' => $submenuChild->getExtra('link'),
|
||||
'link_new' => $submenuChild->getExtra('link_new'),
|
||||
'contenttype' => $submenuChild->getExtra('contenttype'),
|
||||
@@ -251,6 +250,8 @@ class MenuBuilder
|
||||
'active' => $submenuChild->getExtra('active'),
|
||||
];
|
||||
}
|
||||
} else {
|
||||
$submenu = $child->getExtra('submenu');
|
||||
}
|
||||
|
||||
$menuData[] = [
|
||||
@@ -258,15 +259,14 @@ class MenuBuilder
|
||||
'singular_name' => $child->getExtra('singular_name'),
|
||||
'slug' => $child->getExtra('slug'),
|
||||
'singular_slug' => $child->getExtra('singular_slug'),
|
||||
'icon_one' => $child->getExtra('icon_one'),
|
||||
'icon_many' => $child->getExtra('icon_many'),
|
||||
'icon' => $child->getExtra('icon'),
|
||||
'link' => $child->getExtra('link'),
|
||||
'link_new' => $child->getExtra('link_new'),
|
||||
'contenttype' => $child->getExtra('contenttype'),
|
||||
'singleton' => $child->getExtra('singleton'),
|
||||
'type' => $child->getExtra('type'),
|
||||
'active' => $child->getExtra('active'),
|
||||
'submenu' => $child->hasChildren() ? $submenu : null,
|
||||
'submenu' => $submenu,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -44,18 +44,21 @@ class ContentRepository extends ServiceEntityRepository
|
||||
return $this->createPaginator($qb->getQuery(), $page);
|
||||
}
|
||||
|
||||
public function findLatest(): ?array
|
||||
public function findLatest(ContentType $contenttype = null, $amount = 6): ?array
|
||||
{
|
||||
$qb = $this->getQueryBuilder()
|
||||
->addSelect('a')
|
||||
->innerJoin('content.author', 'a')
|
||||
->where('content.publishedAt <= :now')
|
||||
->orderBy('content.publishedAt', 'DESC')
|
||||
->setParameter('now', new \DateTime());
|
||||
->orderBy('content.modifiedAt', 'DESC');
|
||||
|
||||
if ($contenttype) {
|
||||
$qb->where('content.contentType = :ct')
|
||||
->setParameter('ct', $contenttype['slug']);
|
||||
}
|
||||
|
||||
$result = $qb->getQuery()->getResult();
|
||||
|
||||
return array_slice($result, 0, 6);
|
||||
return array_slice($result, 0, $amount);
|
||||
}
|
||||
|
||||
public function findOneBySlug(string $slug)
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<div id="sidebar">
|
||||
<admin-sidebar
|
||||
:brand="'{{ asset('assets/brand.svg') }}'"
|
||||
:menu="{{ sidebarmenu() }}"
|
||||
:menu="{{ sidebarmenu() }}"
|
||||
:version="'{{ version|default('unknown') }}'"
|
||||
></admin-sidebar >
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user