Skip to content

Commit d5c04ee

Browse files
sophie-mulardjuchi
authored andcommitted
Include PageType crud tools page
1 parent 7ff0f80 commit d5c04ee

File tree

4 files changed

+47
-36
lines changed

4 files changed

+47
-36
lines changed

src/Resources/config/services.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ services:
4646
sherlockode_sylius_acb.scope_extension:
4747
class: Sherlockode\SyliusAdvancedContentPlugin\Twig\Extension\ScopeExtension
4848
arguments:
49-
- '@sherlockode_advanced_content.configuration_manager'
5049
- '@sherlockode_sylius_acb.scope_initializer'
5150
tags:
5251
- { name: twig.extension }

src/Resources/views/AdvancedContentBundle/Common/Macros/classes.html.twig

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
{%- macro buttonPrimary() -%}
99
ui button primary
1010
{%- endmacro -%}
11+
{%- macro buttonSuccess() -%}
12+
ui button primary
13+
{%- endmacro -%}
1114
{%- macro buttonIcon() -%}
1215
ui button icon basic
1316
{%- endmacro -%}

src/Resources/views/tools.html.twig

+43-16
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,12 @@
55
{% form_theme exportForm '@SyliusAdmin/Form/theme.html.twig' %}
66

77
{% import '@SyliusUi/Macro/headers.html.twig' as headers %}
8+
{% import "@SherlockodeAdvancedContent/Common/Macros/tabs.html.twig" as tabUtils %}
89

910
{% block title %}{{ 'tools.label'|trans }} {{ parent() }}{% endblock %}
1011

11-
{% block content %}
12-
{{ headers.default('tools.label'|trans, 'cogs') }}
13-
14-
{% if sylius_acb_is_scopes_enabled() and not sylius_acb_is_scopes_up_to_date() %}
15-
<div class="ui segment">
16-
<h3 class="ui dividing header">{{ 'sherlockode_sylius_acb.scopes.segment_title'|trans({}, 'messages') }}</h3>
17-
<p>
18-
{{ 'sherlockode_sylius_acb.scopes.details'|trans({}, 'messages') }}
19-
</p>
20-
<a href="{{ path('sherlockode_sylius_acb_admin_scope_init') }}" class="ui primary button">
21-
{{ 'sherlockode_sylius_acb.scopes.button'|trans({}, 'messages') }}
22-
</a>
23-
</div>
24-
{% endif %}
12+
{% set tabs = [] %}
13+
{% set importExportContent %}
2514
<div class="ui segment">
2615
<h3 class="ui dividing header">{{ 'tools.import.title'|trans }}</h3>
2716
<p>{{ 'tools.import.description'|trans }}</p>
@@ -30,7 +19,7 @@
3019
{{ form_errors(importForm) }}
3120
{{ form_row(importForm.file) }}
3221
<div class="ui hidden divider"></div>
33-
<div class="ui buttons">
22+
<div class="ui buttons" style="display: inline;">
3423
<button class="ui primary button" type="submit">{{ 'tools.import.btn'|trans }}</button>
3524
</div>
3625
{{ form_end(importForm) }}
@@ -65,7 +54,7 @@
6554
</div>
6655
</div>
6756
<div class="ui hidden divider"></div>
68-
<div class="ui buttons">
57+
<div class="ui buttons" style="display: inline;">
6958
<button class="ui primary button" type="submit">{{ 'tools.export.btn'|trans }}</button>
7059
</div>
7160
{% if exportForm._token is defined %}
@@ -74,4 +63,42 @@
7463
{{ form_end(exportForm, {'render_rest': false}) }}
7564
</div>
7665
</div>
66+
{% endset %}
67+
{% set tabs = tabs|merge([{
68+
'id': 'import-export',
69+
'active': true,
70+
'label': 'tools.import_export'|trans,
71+
'content': importExportContent
72+
}]) %}
73+
74+
{% set configurationContent %}
75+
<div class="ui segment">
76+
<h3 class="ui dividing header">{{ 'page_type.label'|trans }}</h3>
77+
<p>
78+
{{ 'page_type.description'|trans }}
79+
</p>
80+
{{ include('@SherlockodeAdvancedContent/Tools/_pageTypes.html.twig', {'pageTypes': pageTypes, 'form': pageTypeForm}) }}
81+
</div>
82+
{% if acb_is_scopes_enabled() and not sylius_acb_is_scopes_up_to_date() %}
83+
<div class="ui segment">
84+
<h3 class="ui dividing header">{{ 'sherlockode_sylius_acb.scopes.segment_title'|trans({}, 'messages') }}</h3>
85+
<p>
86+
{{ 'sherlockode_sylius_acb.scopes.details'|trans({}, 'messages') }}
87+
</p>
88+
<a href="{{ path('sherlockode_sylius_acb_admin_scope_init') }}" class="ui primary button">
89+
{{ 'sherlockode_sylius_acb.scopes.button'|trans({}, 'messages') }}
90+
</a>
91+
</div>
92+
{% endif %}
93+
{% endset %}
94+
{% set tabs = tabs|merge([{
95+
'id': 'configuration',
96+
'active': false,
97+
'label': 'tools.configuration'|trans,
98+
'content': configurationContent
99+
}]) %}
100+
101+
{% block content %}
102+
{{ headers.default('tools.label'|trans, 'cogs') }}
103+
{{ tabUtils.buildTabs(tabs) }}
77104
{% endblock %}

src/Twig/Extension/ScopeExtension.php

+1-19
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,23 @@
22

33
namespace Sherlockode\SyliusAdvancedContentPlugin\Twig\Extension;
44

5-
use Sherlockode\AdvancedContentBundle\Manager\ConfigurationManager;
65
use Sherlockode\SyliusAdvancedContentPlugin\Scope\ScopeInitializer;
76
use Twig\Extension\AbstractExtension;
87
use Twig\TwigFunction;
98

109
class ScopeExtension extends AbstractExtension
1110
{
12-
/**
13-
* @var ConfigurationManager
14-
*/
15-
private $configurationManager;
16-
1711
/**
1812
* @var ScopeInitializer
1913
*/
2014
private $scopeInitializer;
2115

2216
/**
23-
* @param ConfigurationManager $configurationManager
24-
* @param ScopeInitializer $scopeInitializer
17+
* @param ScopeInitializer $scopeInitializer
2518
*/
2619
public function __construct(
27-
ConfigurationManager $configurationManager,
2820
ScopeInitializer $scopeInitializer
2921
) {
30-
$this->configurationManager = $configurationManager;
3122
$this->scopeInitializer = $scopeInitializer;
3223
}
3324

@@ -39,19 +30,10 @@ public function __construct(
3930
public function getFunctions()
4031
{
4132
return [
42-
new TwigFunction('sylius_acb_is_scopes_enabled', [$this, 'isScopesEnabled']),
4333
new TwigFunction('sylius_acb_is_scopes_up_to_date', [$this, 'isScopesUpToDate']),
4434
];
4535
}
4636

47-
/**
48-
* @return bool
49-
*/
50-
public function isScopesEnabled(): bool
51-
{
52-
return $this->configurationManager->isScopesEnabled();
53-
}
54-
5537
/**
5638
* @return bool
5739
*/

0 commit comments

Comments
 (0)