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

[2.x] feat(upgrade): bump codebase to latest sylius version #41

Open
wants to merge 1 commit into
base: feat/migration-sylius-latest-v1
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- 8.2
- 8.3
symfony:
- '6.4.*'
- '7.1.*'
env:
APP_ENV: test
steps:
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/sylius.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ jobs:
- 8.2
- 8.3
sylius:
- 1.12.0
- 1.13.0
- 1.14.0
- 2.0.0
symfony:
- 6.4
- 7.1
node:
- 14.x
- 20.x
env:
APP_ENV: test
package-name: synolia/sylius-maintenance-plugin
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ CONSOLE=cd ${TEST_DIRECTORY} && php bin/console -e test
COMPOSER=cd ${TEST_DIRECTORY} && composer
YARN=cd ${TEST_DIRECTORY} && yarn

SYLIUS_VERSION=1.14.0
SYMFONY_VERSION=6.4
PHP_VERSION=8.2
SYLIUS_VERSION=2.0
SYMFONY_VERSION=7.1
PHP_VERSION=8.3
PLUGIN_NAME=synolia/sylius-maintenance-plugin

###
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
| | Version |
|:-------|:--------|
| PHP | ^8.2 |
| Sylius | ^1.12 |
| Sylius | ~2.0 |

## Installation

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"require": {
"php": "^8.2",
"jaybizzle/crawler-detect": "^1.2",
"sylius/sylius": "^1.12",
"sylius/sylius": "~2.0.0",
"webmozart/assert": "^1.11"
},
"require-dev": {
Expand Down
52 changes: 52 additions & 0 deletions config/twig_hooks/admin/maintenance/update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
sylius_twig_hooks:
hooks:
'synolia.sylius_admin.maintenance':
sidebar:
template: '@SyliusAdmin/shared/crud/common/sidebar.html.twig'
priority: 200
navbar:
template: '@SyliusAdmin/shared/crud/common/navbar.html.twig'
priority: 100
content:
template: '@SyliusAdmin/shared/crud/common/content.html.twig'
priority: 0

'synolia.sylius_admin.maintenance.content':
flashes:
template: '@SyliusAdmin/shared/crud/common/content/flashes.html.twig'
priority: 400
header:
template: '@SyliusAdmin/shared/crud/common/content/header.html.twig'
priority: 300
form:
template: '@SynoliaSyliusMaintenancePlugin/admin/maintenance/content/form.html.twig'
priority: 200
footer:
template: '@SyliusAdmin/shared/crud/common/content/footer.html.twig'
priority: 100

'synolia.sylius_admin.maintenance.content.header':
breadcrumbs:
template: '@SynoliaSyliusMaintenancePlugin/admin/maintenance/content/header/breadcrumbs.html.twig'
priority: 100
title_block:
template: '@SyliusAdmin/shared/crud/common/content/header/title_block.html.twig'
priority: 0

'synolia.sylius_admin.maintenance.content.header.title_block':
title:
template: '@SyliusAdmin/shared/crud/common/content/header/title_block/title.html.twig'
configuration:
title: 'maintenance.ui.title'
priority: 100
actions:
template: '@SyliusAdmin/shared/crud/update/content/header/title_block/actions.html.twig'
priority: 0

'synolia.sylius_admin.maintenance.content.header.title_block.actions':
cancel:
template: '@SynoliaSyliusMaintenancePlugin/admin/maintenance/content/header/title_block/actions/cancel.html.twig'
priority: 100
update:
template: '@SyliusAdmin/shared/crud/common/content/header/title_block/actions/update.html.twig'
priority: 0
Binary file modified images/maintenance.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 57 additions & 0 deletions templates/admin/maintenance/content/form.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{% from '@SyliusAdmin/shared/helper/button.html.twig' import default as btn %}

{% if form is not defined %}
{% set form = hookable_metadata.context.form %}
{% endif %}

{% form_theme form '@SyliusAdmin/shared/form_theme.html.twig' %}

<div class="container-xl">
{{ form_start(form, {'attr': {'novalidate': 'novalidate', 'id': form.vars.id}}) }}
<div class="row">
<div class="col-12 col-md-12">
<div class="card">
<div class="card-body">
<div class="row align-items-center">
<div class="col-12 col-md-6">
{{ form_row(form.enabled) }}
</div>
<div class="col-12 col-md-6">
{% if form.channels is defined %}
{{ form_row(form.channels) }}
{% endif %}
</div>
<div class="col-12 col-md-6">
{{ form_row(form.ipAddresses) }}
</div>
<div class="col-12 col-md-6">
<div class="mb-3 field">
<label class="form-label">
{{ 'maintenance.ui.form.token_storage.help'|trans }}
</label>
{{ btn({
class: 'btn-secondary',
url: path('sylius_admin_maintenance_token_storage'),
text: 'maintenance.ui.form.token_storage.button'|trans
}) }}
</div>
</div>
<div class="col-12">
{{ form_row(form.customMessage) }}
</div>
<div class="col-12 col-md-6">
{{ form_row(form.startDate) }}
</div>
<div class="col-12 col-md-6">
{{ form_row(form.endDate) }}
</div>
<div class="col-12 col-md-6">
{{ form_row(form.allowBots) }}
</div>
</div>
</div>
</div>
</div>
</div>
{{ form_end(form) }}
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% from '@SyliusAdmin/shared/helper/breadcrumbs.html.twig' import breadcrumbs %}

{{ breadcrumbs([
{ name: 'sylius.ui.dashboard', url: path('sylius_admin_dashboard'), active: false },
{ name: 'maintenance.ui.title'|trans, active: false},
{ name: 'sylius.ui.edit'|trans, active: false }
]) }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% import '@SyliusAdmin/shared/helper/button.html.twig' as button %}

{% set index_url = sylius_generate_redirect_path(app.request.headers.get('referer')) %}

{{ button.cancel(sylius_test_form_attribute('cancel-changes-button')|merge({ text: 'sylius.ui.cancel'|trans, url: index_url, class: 'btn' })) }}
11 changes: 11 additions & 0 deletions templates/admin/maintenance/layout.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{% extends '@SyliusAdmin/shared/layout/base.html.twig' %}

{% block title %}
{{ 'maintenance.ui.title'|trans }}
{% endblock %}

{% block body %}
<div class="page-wrapper">
{% hook 'synolia.sylius_admin.maintenance' %}
</div>
{% endblock %}
2 changes: 1 addition & 1 deletion tests/PHPUnit/AssertTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ protected function assertSiteIsUp(): void
{
self::assertResponseIsSuccessful();
self::assertPageTitleContains('Fashion Web Store');
self::assertSelectorTextContains('#footer', 'Powered by Sylius');
self::assertSelectorTextContains('footer', 'Powered by Sylius');
}

protected function assertSiteIsInMaintenance(string $message = 'maintenance.ui.message'): void
Expand Down
Loading