Skip to content

Commit

Permalink
Merge pull request #27 from odiseoteam/1.8
Browse files Browse the repository at this point in the history
Improvements
  • Loading branch information
bigboss86 authored May 14, 2024
2 parents a29844d + dc207a4 commit 1001f2d
Show file tree
Hide file tree
Showing 26 changed files with 250 additions and 196 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ["8.0", "8.1"]
symfony: ["5.4.*", "^6.0"]
sylius: ["^1.12"]
node: ["14.x", "16.x", "18.x"]
mysql: ["5.7", "8.0"]
php: ["8.1", "8.2", "8.3"]
symfony: ["^5.4", "^6.4"]
sylius: ["~1.12.0", "~1.13.0"]
node: ["20.x"]
mysql: ["8.0"]

env:
APP_ENV: test
Expand All @@ -46,7 +46,7 @@ jobs:

-
name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: "${{ matrix.node }}"

Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:

-
name: Cache Composer
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }}
Expand Down Expand Up @@ -121,7 +121,7 @@ jobs:

-
name: Cache Yarn
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }}
Expand Down Expand Up @@ -182,7 +182,7 @@ jobs:

-
name: Run Behat
run: vendor/bin/behat --colors --strict -vvv --no-interaction || vendor/bin/behat --colors --strict -vvv --no-interaction --rerun
run: vendor/bin/behat --colors --strict -vvv --no-interaction -f progress || vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --rerun

-
name: Upload Behat logs
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<a href="https://odiseo.com.ar/" target="_blank" title="Odiseo">
<a href="https://odiseo.io/" target="_blank" title="Odiseo">
<img src="https://github.com/odiseoteam/SyliusVendorPlugin/blob/master/sylius-vendor-plugin.png" alt="Sylius Vendor Plugin" />
</a>
<br />
Expand Down
45 changes: 26 additions & 19 deletions behat.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@ imports:
- tests/Behat/Resources/suites.yaml

default:
formatters:
pretty:
verbose: true
paths: false
snippets: false

extensions:
DMore\ChromeExtension\Behat\ServiceContainer\ChromeExtension: ~
Robertfausk\Behat\PantherExtension: ~

FriendsOfBehat\MinkDebugExtension:
directory: etc/build
Expand All @@ -15,32 +22,30 @@ default:
files_path: "%paths.base%/vendor/sylius/sylius/src/Sylius/Behat/Resources/fixtures/"
base_url: "https://127.0.0.1:8080/"
default_session: symfony
javascript_session: chrome_headless
javascript_session: panther
sessions:
symfony:
symfony: ~
chrome_headless:
chromedriver:
chrome:
api_url: http://127.0.0.1:9222
validate_certificate: false
chrome:
selenium2:
browser: chrome
capabilities:
browserName: chrome
browser: chrome
version: ""
marionette: null # https://github.com/Behat/MinkExtension/pull/311
chrome:
switches:
- "start-fullscreen"
- "start-maximized"
- "no-sandbox"
extra_capabilities:
chrome_headless_second_session:
chrome:
api_url: http://127.0.0.1:9222
validate_certificate: false
panther:
panther:
manager_options:
connection_timeout_in_ms: 5000
request_timeout_in_ms: 120000
chromedriver_arguments:
- --log-path=etc/build/chromedriver.log
- --verbose
capabilities:
acceptSslCerts: true
acceptInsecureCerts: true
unexpectedAlertBehaviour: accept
firefox:
selenium2:
browser: firefox
show_auto: false

FriendsOfBehat\SymfonyExtension:
Expand All @@ -53,3 +58,5 @@ default:
FriendsOfBehat\SuiteSettingsExtension:
paths:
- "features"

SyliusLabs\SuiteTagsExtension: ~
30 changes: 15 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
"description": "Vendor plugin for Sylius. Add Vendor (Brand) to your products",
"license": "MIT",
"require": {
"php": "^8.0",
"php": "^8.1",
"sylius/sylius": "^1.12",
"sylius/mailer-bundle": "^1.8 || ^2.0@beta",
"symfony/webpack-encore-bundle": "^1.15"
},
"require-dev": {
"behat/behat": "^3.6.1",
"behat/mink-selenium2-driver": "^1.4",
"dbrekelmans/bdi": "^1.1",
"dmore/behat-chrome-extension": "^1.3",
"dmore/chrome-mink-driver": "^2.7",
"friends-of-behat/mink": "^1.8",
Expand All @@ -31,24 +31,24 @@
"phpspec/phpspec": "^7.2",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^1.8.1",
"phpstan/phpstan-doctrine": "1.3.40",
"phpstan/phpstan-doctrine": "1.3.69",
"phpstan/phpstan-strict-rules": "^1.3.0",
"phpstan/phpstan-webmozart-assert": "^1.2.0",
"phpunit/phpunit": "^9.5",
"phpunit/phpunit": "^10.5",
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"robertfausk/behat-panther-extension": "^1.1",
"sylius-labs/coding-standard": "^4.2",
"symfony/browser-kit": "^5.4 || ^6.0",
"symfony/debug-bundle": "^5.4 || ^6.0",
"symfony/dotenv": "^5.4 || ^6.0",
"symfony/flex": "^2.2.2",
"symfony/intl": "^5.4 || ^6.0",
"symfony/web-profiler-bundle": "^5.4 || ^6.0",
"vimeo/psalm": "5.12.0"
"sylius-labs/suite-tags-extension": "^0.2",
"symfony/browser-kit": "^5.4 || ^6.4",
"symfony/debug-bundle": "^5.4 || ^6.4",
"symfony/dotenv": "^5.4 || ^6.4",
"symfony/flex": "^2.4",
"symfony/intl": "^5.4 || ^6.4",
"symfony/web-profiler-bundle": "^5.4 || ^6.4",
"vimeo/psalm": "5.24.0"
},
"conflict": {
"symfony/framework-bundle": "6.2.8",
"api-platform/core": "2.7.17",
"behat/mink-selenium2-driver": ">=1.7.0"
"symfony/framework-bundle": "6.2.8"
},
"suggest": {
"stefandoorn/sitemap-plugin": "Adds vendors to the Sylius sitemap plugin"
Expand All @@ -63,7 +63,7 @@
},
"extra": {
"symfony": {
"require": "^5.4 || ^6.0"
"require": "^5.4 || ^6.4"
}
},
"autoload": {
Expand Down
4 changes: 2 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
parameters:
level: max
reportUnmatchedIgnoredErrors: false
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
paths:
- src
- tests/Behat
Expand All @@ -18,6 +16,8 @@ parameters:
- 'tests/Application/src/**.php'

ignoreErrors:
- identifier: missingType.iterableValue
- identifier: missingType.generics
- '/Parameter #1 \$configuration of method Symfony\\Component\\DependencyInjection\\Extension\\Extension::processConfiguration\(\) expects Symfony\\Component\\Config\\Definition\\ConfigurationInterface, Symfony\\Component\\Config\\Definition\\ConfigurationInterface\|null given\./'
- '/Cannot cast mixed to int./'
- '/Cannot cast mixed to string./'
Expand Down
2 changes: 0 additions & 2 deletions src/Resources/config/routing/shop/partial/vendor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ odiseo_sylius_vendor_plugin_shop_partial_vendor_show_by_slug:
arguments:
- $slug
- "expr:service('sylius.context.locale').getLocaleCode()"
requirements:
slug: .+

odiseo_sylius_vendor_plugin_shop_partial_vendor_index_by_channel:
path: /by-channel
Expand Down
4 changes: 1 addition & 3 deletions src/Resources/config/routing/shop/vendor_product.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
odiseo_sylius_vendor_plugin_shop_vendor_product_index:
path: /{slug}/products
path: /{slug}
methods: [GET]
defaults:
_controller: sylius.controller.product::indexAction
_sylius:
template: "@OdiseoSyliusVendorPlugin/Shop/Vendor/Product/index.html.twig"
grid: odiseo_sylius_vendor_plugin_shop_vendor_product
requirements:
slug: .+
34 changes: 29 additions & 5 deletions src/Resources/config/sylius_ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,43 @@ sylius_ui:
template: "@OdiseoSyliusVendorPlugin/Admin/Layout/_vendor_js.html.twig"
priority: 5

odiseo_sylius_vendor_plugin.shop.vendor.product.index.before_vertical_menu:
odiseo_sylius_vendor_plugin.shop.vendor.product.index.header.content:
blocks:
breadcrumb:
template: "@OdiseoSyliusVendorPlugin/Shop/Vendor/Product/Index/Header/_breadcrumb.html.twig"
priority: 20
legacy:
template: "@SyliusUi/Block/_legacySonataEvent.html.twig"
priority: 15
context:
event: odiseo_sylius_vendor_plugin.shop.vendor.product.index.before_vertical_menu
event: odiseo_sylius_vendor_plugin.shop.vendor.product.index.header
content:
template: "@OdiseoSyliusVendorPlugin/Shop/Vendor/Product/Index/Header/_content.html.twig"
priority: 10

odiseo_sylius_vendor_plugin.shop.vendor.product.index.after_vertical_menu:
odiseo_sylius_vendor_plugin.shop.vendor.product.index.content:
blocks:
legacy:
before_header_legacy:
template: "@SyliusUi/Block/_legacySonataEvent.html.twig"
priority: 25
context:
event: odiseo_sylius_vendor_plugin.shop.vendor.product.index.before_header
header:
template: "@OdiseoSyliusVendorPlugin/Shop/Vendor/Product/Index/_headerWidget.html.twig"
priority: 20
after_header_legacy:
template: "@SyliusUi/Block/_legacySonataEvent.html.twig"
priority: 15
context:
event: odiseo_sylius_vendor_plugin.shop.vendor.product.index.after_header
content:
template: "@OdiseoSyliusVendorPlugin/Shop/Vendor/Product/Index/_content.html.twig"
priority: 10
after_content_legacy:
template: "@SyliusUi/Block/_legacySonataEvent.html.twig"
priority: 5
context:
event: odiseo_sylius_vendor_plugin.shop.vendor.product.index.after_vertical_menu
event: odiseo_sylius_vendor_plugin.shop.vendor.product.index.after_content

odiseo_sylius_vendor_plugin.shop.vendor.product.index.before_list:
blocks:
Expand Down
8 changes: 4 additions & 4 deletions src/Resources/views/Shop/Vendor/Index/_pagination.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
{{ 'sylius.ui.show'|trans }} {{ resources.data.maxPerPage }}
<i class="dropdown icon"></i>
<div class="menu">
{% for limit in paginationLimits|filter(limit => limit != resources.data.maxPerPage) %}
{% set path = path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')|merge(app.request.query.all)|merge({'limit': limit})) %}
<a class="item" href="{{ path }}">{{ limit }}</a>
{% endfor %}
{% for limit in paginationLimits|filter(limit => limit != resources.data.maxPerPage) %}
{% set path = path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')|merge(app.request.query.all)|merge({'limit': limit})) %}
<a class="item" href="{{ path }}">{{ limit }}</a>
{% endfor %}
</div>
</div>
</div>
Expand Down
65 changes: 32 additions & 33 deletions src/Resources/views/Shop/Vendor/Index/_sorting.html.twig
Original file line number Diff line number Diff line change
@@ -1,42 +1,41 @@
{% if resources.data.nbResults > 0 %}
{% set route = app.request.attributes.get('_route') %}
{% set route_parameters = app.request.attributes.all('_route_params')|merge(app.request.query.all) %}

{% set route = app.request.attributes.get('_route') %}
{% set route_parameters = app.request.attributes.all('_route_params')|merge(app.request.query.all) %}
{% set criteria = app.request.query.all('criteria') %}

{% set criteria = app.request.query.all('criteria') %}
{% set default_path = path(route, route_parameters|merge({'sorting': null, 'criteria': criteria})) %}
{% set from_a_to_z_path = path(route, route_parameters|merge({'sorting': {'name': 'asc'}, 'criteria': criteria})) %}
{% set from_z_to_a_path = path(route, route_parameters|merge({'sorting': {'name': 'desc'}, 'criteria': criteria})) %}
{% set oldest_first_path = path(route, route_parameters|merge({'sorting': {'createdAt': 'asc'}, 'criteria': criteria})) %}
{% set newest_first_path = path(route, route_parameters|merge({'sorting': {'createdAt': 'desc'}, 'criteria': criteria})) %}

{% set default_path = path(route, route_parameters|merge({'sorting': null, 'criteria': criteria})) %}
{% set from_a_to_z_path = path(route, route_parameters|merge({'sorting': {'name': 'asc'}, 'criteria': criteria})) %}
{% set from_z_to_a_path = path(route, route_parameters|merge({'sorting': {'name': 'desc'}, 'criteria': criteria})) %}
{% set oldest_first_path = path(route, route_parameters|merge({'sorting': {'createdAt': 'asc'}, 'criteria': criteria})) %}
{% set newest_first_path = path(route, route_parameters|merge({'sorting': {'createdAt': 'desc'}, 'criteria': criteria})) %}
{% if app.request.query.all()['sorting'] is not defined or app.request.query.all()['sorting'] is empty %}
{% set current_sorting_label = 'sylius.ui.by_position'|trans|lower %}
{% elseif app.request.query.all()['sorting'].name is defined and app.request.query.all()['sorting'].name == 'asc'%}
{% set current_sorting_label = 'sylius.ui.from_a_to_z'|trans|lower %}
{% elseif app.request.query.all()['sorting'].name is defined and app.request.query.all()['sorting'].name == 'desc'%}
{% set current_sorting_label = 'sylius.ui.from_z_to_a'|trans|lower %}
{% elseif app.request.query.all()['sorting'].createdAt is defined and app.request.query.all()['sorting'].createdAt == 'desc'%}
{% set current_sorting_label = 'sylius.ui.newest_first'|trans|lower %}
{% elseif app.request.query.all()['sorting'].createdAt is defined and app.request.query.all()['sorting'].createdAt == 'asc'%}
{% set current_sorting_label = 'sylius.ui.oldest_first'|trans|lower %}
{% endif %}

{% if app.request.query.all()['sorting'] is not defined or app.request.query.all()['sorting'] is empty %}
{% set current_sorting_label = 'sylius.ui.by_position'|trans|lower %}
{% elseif app.request.query.all()['sorting'].name is defined and app.request.query.all()['sorting'].name == 'asc'%}
{% set current_sorting_label = 'sylius.ui.from_a_to_z'|trans|lower %}
{% elseif app.request.query.all()['sorting'].name is defined and app.request.query.all()['sorting'].name == 'desc'%}
{% set current_sorting_label = 'sylius.ui.from_z_to_a'|trans|lower %}
{% elseif app.request.query.all()['sorting'].createdAt is defined and app.request.query.all()['sorting'].createdAt == 'desc'%}
{% set current_sorting_label = 'sylius.ui.newest_first'|trans|lower %}
{% elseif app.request.query.all()['sorting'].createdAt is defined and app.request.query.all()['sorting'].createdAt == 'asc'%}
{% set current_sorting_label = 'sylius.ui.oldest_first'|trans|lower %}
{% endif %}

<div class="ui right floated small header">
<div class="content">
{{ 'sylius.ui.sort'|trans }}
<div class="ui inline dropdown">
<div class="text">{{ current_sorting_label }}</div>
<i class="dropdown icon"></i>
<div class="menu">
<a class="item" href="{{ default_path }}" data-text="{{ 'sylius.ui.by_position'|trans|lower }}">{{ 'sylius.ui.by_position'|trans }}</a>
<a class="item" href="{{ from_a_to_z_path }}" data-text="{{ 'sylius.ui.from_a_to_z'|trans|lower }}">{{ 'sylius.ui.from_a_to_z'|trans }}</a>
<a class="item" href="{{ from_z_to_a_path }}" data-text="{{ 'sylius.ui.from_z_to_a'|trans|lower }}">{{ 'sylius.ui.from_z_to_a'|trans }}</a>
<a class="item" href="{{ newest_first_path }}" data-text="{{ 'sylius.ui.newest_first'|trans|lower }}">{{ 'sylius.ui.newest_first'|trans }}</a>
<a class="item" href="{{ oldest_first_path }}" data-text="{{ 'sylius.ui.oldest_first'|trans|lower }}">{{ 'sylius.ui.oldest_first'|trans }}</a>
<div class="ui right floated small header">
<div class="content">
{{ 'sylius.ui.sort'|trans }}
<div class="ui inline dropdown">
<div class="text">{{ current_sorting_label }}</div>
<i class="dropdown icon"></i>
<div class="menu">
<a class="item" href="{{ default_path }}" data-text="{{ 'sylius.ui.by_position'|trans|lower }}">{{ 'sylius.ui.by_position'|trans }}</a>
<a class="item" href="{{ from_a_to_z_path }}" data-text="{{ 'sylius.ui.from_a_to_z'|trans|lower }}">{{ 'sylius.ui.from_a_to_z'|trans }}</a>
<a class="item" href="{{ from_z_to_a_path }}" data-text="{{ 'sylius.ui.from_z_to_a'|trans|lower }}">{{ 'sylius.ui.from_z_to_a'|trans }}</a>
<a class="item" href="{{ newest_first_path }}" data-text="{{ 'sylius.ui.newest_first'|trans|lower }}">{{ 'sylius.ui.newest_first'|trans }}</a>
<a class="item" href="{{ oldest_first_path }}" data-text="{{ 'sylius.ui.oldest_first'|trans|lower }}">{{ 'sylius.ui.oldest_first'|trans }}</a>
</div>
</div>
</div>
</div>
</div>
{% endif %}
Loading

0 comments on commit 1001f2d

Please sign in to comment.