Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EZP-28127: Create extendable left sidebar #28

Merged
merged 4 commits into from
Oct 26, 2017
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
44 changes: 0 additions & 44 deletions src/bundle/DependencyInjection/Compiler/MenuPass.php

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

/**
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
namespace EzSystems\EzPlatformAdminUiBundle\DependencyInjection\Configuration\Parser;

use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\AbstractParser;
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ContextualizerInterface;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;

class LocationIds extends AbstractParser
{
/**
* Adds semantic configuration definition.
*
* @param NodeBuilder $nodeBuilder Node just under ezpublish.system.<siteaccess>
*/
public function addSemanticConfig(NodeBuilder $nodeBuilder)
{
$nodeBuilder
->arrayNode('location_ids')
->info('System locations id configuration')
->children()
->scalarNode('content')->isRequired()->end()
->scalarNode('media')->isRequired()->end()
->scalarNode('users')->isRequired()->end()
->end()
->end();
}

public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer)
{
if (empty($scopeSettings['location_ids'])) {
return;
}

$settings = $scopeSettings['location_ids'];
$keys = ['content', 'media', 'users'];

foreach ($keys as $key) {
if (!isset($settings[$key]) || empty($settings[$key])) {
continue;
}

$contextualizer->setContextualParameter(
sprintf('location_ids.%s', $key),
$currentScope,
$settings[$key]
);
}
}
}
6 changes: 4 additions & 2 deletions src/bundle/EzPlatformAdminUiBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\EzPublishCoreExtension;
use EzSystems\EzPlatformAdminUi\SiteAccess\AdminFilter;
use EzSystems\EzPlatformAdminUiBundle\DependencyInjection\Compiler\MenuPass;
use EzSystems\EzPlatformAdminUiBundle\DependencyInjection\Compiler\SystemInfoTabGroupPass;
use EzSystems\EzPlatformAdminUiBundle\DependencyInjection\Compiler\TabPass;
use EzSystems\EzPlatformAdminUiBundle\DependencyInjection\Compiler\UiConfigProviderPass;
use EzSystems\EzPlatformAdminUiBundle\DependencyInjection\Configuration\Parser\LocationIds;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;

Expand All @@ -25,6 +25,9 @@ public function build(ContainerBuilder $container)
new AdminFilter()
);

$core->addConfigParser(new LocationIds());
$core->addDefaultSettings(__DIR__ . '/Resources/config', ['ezpublish_default_settings.yml']);

$this->addCompilerPasses($container);
}

Expand All @@ -34,7 +37,6 @@ public function build(ContainerBuilder $container)
private function addCompilerPasses(ContainerBuilder $container)
{
$container->addCompilerPass(new TabPass());
$container->addCompilerPass(new MenuPass());
$container->addCompilerPass(new UiConfigProviderPass());
$container->addCompilerPass(new SystemInfoTabGroupPass());
}
Expand Down
79 changes: 0 additions & 79 deletions src/bundle/Menu/Builder.php

This file was deleted.

4 changes: 4 additions & 0 deletions src/bundle/Resources/config/ezpublish_default_settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
parameters:
ezsettings.default.location_ids.content: 2
ezsettings.default.location_ids.media: 43
ezsettings.default.location_ids.users: 5
126 changes: 8 additions & 118 deletions src/bundle/Resources/config/services/menu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,126 +4,16 @@ services:
autoconfigure: true
public: true

EzSystems\EzPlatformAdminUi\Menu\Registry:
#
# Menu Builders
#

#KNP Builders
EzSystems\EzPlatformAdminUi\Menu\Builder:
EzSystems\EzPlatformAdminUi\Menu\MainMenuBuilder:
public: true
arguments:
$identifier: 'main'
tags:
- { name: knp_menu.menu_builder, method: createMainMenu, alias: main }
- { name: knp_menu.menu_builder, method: build, alias: ezplatform_admin_ui.menu.main }

#Menus
ezplatform.menu.main:
class: EzSystems\EzPlatformAdminUi\Menu\Menu
arguments:
$identifier: 'main'
tags:
- { name: ezplatform.menu, identifier: main }

ezplatform.menu.main.content:
class: EzSystems\EzPlatformAdminUi\Menu\Item
arguments:
$identifier: content
$icon: 'content-list'
tags:
- { name: ezplatform.menu.item, parent: ezplatform.menu.main, priority: 10 }

ezplatform.menu.main.content.structure:
class: EzSystems\EzPlatformAdminUi\Menu\Item
arguments:
$identifier: content_structure
$name: 'Content Structure'
$url: { route: _ezpublishLocation, routeParameters: { locationId: 2 } }
tags:
- { name: ezplatform.menu.item, parent: ezplatform.menu.main.content, priority: 10 }

ezplatform.menu.main.content.media:
class: EzSystems\EzPlatformAdminUi\Menu\Item
arguments:
$identifier: media
$url: { route: _ezpublishLocation, routeParameters: { locationId: 43 } }
tags:
- { name: ezplatform.menu.item, parent: ezplatform.menu.main.content, priority: 10 }

ezplatform.menu.main.admin:
class: EzSystems\EzPlatformAdminUi\Menu\Item
arguments:
$identifier: admin
$icon: 'panel'
tags:
- { name: ezplatform.menu.item, parent: ezplatform.menu.main, priority: 20 }

ezplatform.menu.main.admin.systeminfo:
class: EzSystems\EzPlatformAdminUi\Menu\Item
arguments:
$identifier: systeminfo
$name: 'System Info'
$url: { route: ezplatform.systeminfo }
tags:
- { name: ezplatform.menu.item, parent: ezplatform.menu.main.admin, priority: 10 }

ezplatform.menu.main.admin.sections:
class: EzSystems\EzPlatformAdminUi\Menu\Item
arguments:
$identifier: sections
$url: { route: ezplatform.section.list }
tags:
- { name: ezplatform.menu.item, parent: ezplatform.menu.main.admin, priority: 20 }

ezplatform.menu.main.admin.roles:
class: EzSystems\EzPlatformAdminUi\Menu\Item
arguments:
$identifier: roles
$url: { route: ezplatform.role.list }
tags:
- { name: ezplatform.menu.item, parent: ezplatform.menu.main.admin, priority: 30 }

ezplatform.menu.main.admin.languages:
class: EzSystems\EzPlatformAdminUi\Menu\Item
arguments:
$identifier: languages
$url: { route: ezplatform.language.list }
tags:
- { name: ezplatform.menu.item, parent: ezplatform.menu.main.admin, priority: 40 }

ezplatform.menu.main.admin.contenttypes:
class: EzSystems\EzPlatformAdminUi\Menu\Item
arguments:
$identifier: contenttypes
$name: 'Content Types'
$url: { route: ezplatform.content_type_group.list }
tags:
- { name: ezplatform.menu.item, parent: ezplatform.menu.main.admin, priority: 50 }


ezplatform.menu.sidebar:
class: EzSystems\EzPlatformAdminUi\Menu\Menu
arguments:
$identifier: 'sidebar'
tags:
- { name: ezplatform.menu, identifier: sidebar }

ezplatform.menu.sidebar.search:
class: EzSystems\EzPlatformAdminUi\Menu\Item
arguments:
$identifier: search
$enabled: false
tags:
- { name: ezplatform.menu.item, parent: ezplatform.menu.sidebar, priority: 10 }

ezplatform.menu.sidebar.browse:
class: EzSystems\EzPlatformAdminUi\Menu\Item
arguments:
$identifier: browse
tags:
- { name: ezplatform.menu.item, parent: ezplatform.menu.sidebar, priority: 20 }

ezplatform.menu.sidebar.trash:
class: EzSystems\EzPlatformAdminUi\Menu\Item
arguments:
$identifier: trash
$url: { route: ezplatform.trash.list }
EzSystems\EzPlatformAdminUi\Menu\LeftSidebarBuilder:
public: true
tags:
- { name: ezplatform.menu.item, parent: ezplatform.menu.sidebar, priority: 30 }
- { name: knp_menu.menu_builder, method: build, alias: ezplatform_admin_ui.menu.content.sidebar_left }
1 change: 1 addition & 0 deletions src/bundle/Resources/config/services/service_aliases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ services:
factory: 'eZ\Publish\API\Repository\Repository:getPermissionResolver'

eZ\Publish\Core\Helper\FieldsGroups\FieldsGroupsList: '@ezpublish.fields_groups.list'
eZ\Publish\Core\MVC\ConfigResolverInterface: '@ezpublish.config.resolver'

# Repository Forms
EzSystems\RepositoryForms\Form\Type\Role\LimitationType: '@ezrepoforms.policy.limitation.form'
Expand Down
19 changes: 1 addition & 18 deletions src/bundle/Resources/views/admin/trash/list.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,7 @@
<div id="react-udw"></div>
<div class="row align-items-stretch ez-main-row">
<div class="col-sm-1 bg-dark pt-4 ez-side-menu"> {# @todo sidebars should be moved to layout.html.twig !! #}
<button class="btn btn-dark btn-block" disabled>
<svg class="ez-icon ez-icon-search">
<use xlink:href="{{ asset('bundles/ezplatformadminui/img/ez-icons.svg') }}#search"></use>
</svg>
Search
</button>
<button class="btn btn-dark btn-block btn--udw-browse" data-starting-location-id="2">
<svg class="ez-icon ez-icon-browse">
<use xlink:href="{{ asset('bundles/ezplatformadminui/img/ez-icons.svg') }}#browse"></use>
</svg>
Browse
</button>
<a class="btn btn-dark btn-block" href="{{ path('ezplatform.trash.list') }}">
<svg class="ez-icon ez-icon-trash">
<use xlink:href="{{ asset('bundles/ezplatformadminui/img/ez-icons.svg') }}#trash"></use>
</svg>
Trash
</a>
{{ knp_menu_render('ezplatform_admin_ui.menu.content.sidebar_left', {'template': '@EzPlatformAdminUi/parts/menu/sidebar_left.html.twig'}) }}
</div>
<div class="col-sm-10 px-0">
<section class="container mt-5">
Expand Down
Loading