diff --git a/README.md b/README.md index 25008c6c2..519b71d48 100755 --- a/README.md +++ b/README.md @@ -1,126 +1,47 @@ # [](https://bitbag.io/contact-us/?utm_source=github&utm_medium=referral&utm_campaign=plugins_cms) -# BitBag SyliusCMSPlugin +# SyliusCMSPlugin ---- [ ](https://packagist.org/packages/bitbag/cms-plugin "License") [  ](https://packagist.org/packages/bitbag/cms-plugin "Version") [  ](https://github.com/BitBagCommerce/SyliusCmsPlugin/actions "Build status") [  ](https://scrutinizer-ci.com/g/BitBagCommerce/SyliusCMSPlugin/ "Scrutinizer") [](https://packagist.org/packages/bitbag/cms-plugin "Total Downloads") [](http://sylius-devs.slack.com) [](https://bitbag.io/contact-us/?utm_source=github&utm_medium=referral&utm_campaign=plugins_cms) -
-
-
+Almost every eCommerce app has to present some content. Managing it is often done via third-party libraries like WordPress,
+eZ Platform, or a built-in content management system. As Sylius does not have a CMS in the standard platform,
+we decided to develop our own, which will be as flexible as Sylius. This plugin allows you to add dynamic blocks and pages
+with content elements to your storefront.
- [Use Case](doc/use_case.md)
+ - [Collections](doc/use_case_collections.md)
+ - [Content Templates](doc/use_case_content_templates.md)
+ - [Pages](doc/use_case_pages.md)
+ - [Blocks](doc/use_case_blocks.md)
+ - [Media](doc/use_case_media.md)
- [Installation](doc/installation.md)
- [Upgrading](UPGRADE.md)
-- [Blocks](doc/blocks.md)
+- [Collections](doc/collections.md)
+- [Content Templates](doc/content_templates.md)
- [Pages](doc/pages.md)
-- [Sections](doc/sections.md)
+- [Blocks](doc/blocks.md)
+- [Page/Block templates](doc/templates.md)
- [Media](doc/media.md)
-- [FAQs](doc/faqs.md)
- [Fixtures](doc/fixtures.md)
- [WYSIWYG](doc/wysiwyg.md)
- [Importing resources](doc/importing-resources.md)
-- [Using Twig functions in the admin panel](doc/twig-functions-in-admin.md)
+- [Legacy data migration](doc/legacy_data_migration.md)
- [Sitemap](doc/sitemap.md)
- [Customization](doc/customization.md)
-## We are here to help
-This **open-source plugin was developed to help the Sylius community**. If you have any additional questions, would like help with installing or configuring the plugin, or need any assistance with your Sylius project - let us know!
-
-[](https://bitbag.io/contact-us/?utm_source=github&utm_medium=referral&utm_campaign=plugins_cms)
-
-Read more about [Sylius CMS](https://bitbag.io/sylius-cms-all-you-need-to-know-3-implementation-methods/?utm_source=github&utm_medium=referral&utm_campaign=plugins_cms)
-
-# About us
-
----
-
-BitBag is a company of people who **love what they do** and do it right. We fulfill the eCommerce technology stack with **Sylius**, Shopware, Akeneo, and Pimcore for PIM, eZ Platform for CMS, and VueStorefront for PWA. Our goal is to provide real digital transformation with an agile solution that scales with the **clients’ needs**. Our main area of expertise includes eCommerce consulting and development for B2C, B2B, and Multi-vendor Marketplaces.
-We are advisers in the first place. We start each project with a diagnosis of problems, and an analysis of the needs and **goals** that the client wants to achieve.
-We build **unforgettable**, consistent digital customer journeys on top of the **best technologies**. Based on a detailed analysis of the goals and needs of a given organization, we create dedicated systems and applications that let businesses grow.{{ text }}
+``` diff --git a/doc/content_elements/heading.md b/doc/content_elements/heading.md new file mode 100644 index 000000000..a82a67b03 --- /dev/null +++ b/doc/content_elements/heading.md @@ -0,0 +1,11 @@ +# Heading content element + +Heading content element allows you to add a heading (from H1 to H6) to your block or page. + +## View in admin panel + + + +## View in front page + + diff --git a/doc/content_elements/heading1.png b/doc/content_elements/heading1.png new file mode 100644 index 000000000..baa1ce118 Binary files /dev/null and b/doc/content_elements/heading1.png differ diff --git a/doc/content_elements/heading2.png b/doc/content_elements/heading2.png new file mode 100644 index 000000000..bf7678611 Binary files /dev/null and b/doc/content_elements/heading2.png differ diff --git a/doc/content_elements/multiple_media.md b/doc/content_elements/multiple_media.md new file mode 100644 index 000000000..92cb2c7df --- /dev/null +++ b/doc/content_elements/multiple_media.md @@ -0,0 +1,12 @@ +# Multiple media content element + +Multiple media content element allows you to add multiple media (images, videos, or files) +from the media library to your block or page. + +## View in admin panel + + + +## View in front page + + diff --git a/doc/content_elements/multiple_media1.png b/doc/content_elements/multiple_media1.png new file mode 100644 index 000000000..f65db2a59 Binary files /dev/null and b/doc/content_elements/multiple_media1.png differ diff --git a/doc/content_elements/multiple_media2.png b/doc/content_elements/multiple_media2.png new file mode 100644 index 000000000..7630818c6 Binary files /dev/null and b/doc/content_elements/multiple_media2.png differ diff --git a/doc/content_elements/pages_collection.md b/doc/content_elements/pages_collection.md new file mode 100644 index 000000000..8213a6854 --- /dev/null +++ b/doc/content_elements/pages_collection.md @@ -0,0 +1,11 @@ +# Pages collection content element + +Pages collection content element renders a pages from a selected collection. + +## View in admin panel + + + +## View in front page + + diff --git a/doc/content_elements/pages_collection1.png b/doc/content_elements/pages_collection1.png new file mode 100644 index 000000000..6d1772cbf Binary files /dev/null and b/doc/content_elements/pages_collection1.png differ diff --git a/doc/content_elements/pages_collection2.png b/doc/content_elements/pages_collection2.png new file mode 100644 index 000000000..4f313f905 Binary files /dev/null and b/doc/content_elements/pages_collection2.png differ diff --git a/doc/content_elements/products_carousel.md b/doc/content_elements/products_carousel.md new file mode 100644 index 000000000..dfee37309 --- /dev/null +++ b/doc/content_elements/products_carousel.md @@ -0,0 +1,11 @@ +# Products carousel content element + +Products carousel content element allows you to add a carousel with shop products to your block or page. + +## View in admin panel + + + +## View in front page + + diff --git a/doc/content_elements/products_carousel1.png b/doc/content_elements/products_carousel1.png new file mode 100644 index 000000000..56438a64d Binary files /dev/null and b/doc/content_elements/products_carousel1.png differ diff --git a/doc/content_elements/products_carousel2.png b/doc/content_elements/products_carousel2.png new file mode 100644 index 000000000..1eefc60c9 Binary files /dev/null and b/doc/content_elements/products_carousel2.png differ diff --git a/doc/content_elements/products_carousel_by_taxon.md b/doc/content_elements/products_carousel_by_taxon.md new file mode 100644 index 000000000..9acb0078e --- /dev/null +++ b/doc/content_elements/products_carousel_by_taxon.md @@ -0,0 +1,12 @@ +# Products carousel by Taxon content element + +Products carousel by Taxon content element allows you to add a carousel +with shop products from specified taxon to your block or page. + +## View in admin panel + + + +## View in front page + + diff --git a/doc/content_elements/products_carousel_by_taxon1.png b/doc/content_elements/products_carousel_by_taxon1.png new file mode 100644 index 000000000..9683f78b1 Binary files /dev/null and b/doc/content_elements/products_carousel_by_taxon1.png differ diff --git a/doc/content_elements/products_grid.md b/doc/content_elements/products_grid.md new file mode 100644 index 000000000..efe77aae6 --- /dev/null +++ b/doc/content_elements/products_grid.md @@ -0,0 +1,12 @@ +# Products grid content element + +Products grid content element allows you to add a grid with +shop products to your block or page. + +## View in admin panel + + + +## View in front page + + diff --git a/doc/content_elements/products_grid1.png b/doc/content_elements/products_grid1.png new file mode 100644 index 000000000..48b4e1973 Binary files /dev/null and b/doc/content_elements/products_grid1.png differ diff --git a/doc/content_elements/products_grid2.png b/doc/content_elements/products_grid2.png new file mode 100644 index 000000000..57374aeb3 Binary files /dev/null and b/doc/content_elements/products_grid2.png differ diff --git a/doc/content_elements/products_grid_by_taxon.md b/doc/content_elements/products_grid_by_taxon.md new file mode 100644 index 000000000..9cccd08b8 --- /dev/null +++ b/doc/content_elements/products_grid_by_taxon.md @@ -0,0 +1,12 @@ +# Products grid by Taxon content element + +Products grid by Taxon content element allows you to add a grid +with shop products from specified taxon to your block or page. + +## View in admin panel + + + +## View in front page + + diff --git a/doc/content_elements/products_grid_by_taxon1.png b/doc/content_elements/products_grid_by_taxon1.png new file mode 100644 index 000000000..2deae902b Binary files /dev/null and b/doc/content_elements/products_grid_by_taxon1.png differ diff --git a/doc/content_elements/single_media.md b/doc/content_elements/single_media.md new file mode 100644 index 000000000..03386d056 --- /dev/null +++ b/doc/content_elements/single_media.md @@ -0,0 +1,12 @@ +# Single media content element + +Single media content element allows you to add a single media (image, video, or file) +from the media library to your block or page. + +## View in admin panel + + + +## View in front page + + diff --git a/doc/content_elements/single_media1.png b/doc/content_elements/single_media1.png new file mode 100644 index 000000000..35009ed5d Binary files /dev/null and b/doc/content_elements/single_media1.png differ diff --git a/doc/content_elements/single_media2.png b/doc/content_elements/single_media2.png new file mode 100644 index 000000000..d21dfb69c Binary files /dev/null and b/doc/content_elements/single_media2.png differ diff --git a/doc/content_elements/spacer.md b/doc/content_elements/spacer.md new file mode 100644 index 000000000..526ddf0ac --- /dev/null +++ b/doc/content_elements/spacer.md @@ -0,0 +1,12 @@ +# Spacer content element + +Spacer content element allows you to add a space in pixels +between content elements to your block or page. + +## View in admin panel + + + +## View in front page + + diff --git a/doc/content_elements/spacer1.png b/doc/content_elements/spacer1.png new file mode 100644 index 000000000..4dc49e262 Binary files /dev/null and b/doc/content_elements/spacer1.png differ diff --git a/doc/content_elements/spacer2.png b/doc/content_elements/spacer2.png new file mode 100644 index 000000000..99dfd6c6c Binary files /dev/null and b/doc/content_elements/spacer2.png differ diff --git a/doc/content_elements/taxons_list.md b/doc/content_elements/taxons_list.md new file mode 100644 index 000000000..e74952287 --- /dev/null +++ b/doc/content_elements/taxons_list.md @@ -0,0 +1,12 @@ +# Taxons list content element + +Taxons list content element allows you to add a list of taxons +to your block or page. + +## View in admin panel + + + +## View in front page + + diff --git a/doc/content_elements/taxons_list1.png b/doc/content_elements/taxons_list1.png new file mode 100644 index 000000000..cae575202 Binary files /dev/null and b/doc/content_elements/taxons_list1.png differ diff --git a/doc/content_elements/taxons_list2.png b/doc/content_elements/taxons_list2.png new file mode 100644 index 000000000..04e34a0a8 Binary files /dev/null and b/doc/content_elements/taxons_list2.png differ diff --git a/doc/content_elements/textarea.md b/doc/content_elements/textarea.md new file mode 100644 index 000000000..413ac41cf --- /dev/null +++ b/doc/content_elements/textarea.md @@ -0,0 +1,12 @@ +# Textarea content element + +Textarea content element allows you to add a simple text area to your block or page +with WYSIWYG editor (CKEditor). + +## View in admin panel + + + +## View in front page + + diff --git a/doc/content_elements/textarea1.png b/doc/content_elements/textarea1.png new file mode 100644 index 000000000..50f56a4fa Binary files /dev/null and b/doc/content_elements/textarea1.png differ diff --git a/doc/content_elements/textarea2.png b/doc/content_elements/textarea2.png new file mode 100644 index 000000000..aba0bd2e9 Binary files /dev/null and b/doc/content_elements/textarea2.png differ diff --git a/doc/content_management.png b/doc/content_management.png index a3136ee59..70c878937 100644 Binary files a/doc/content_management.png and b/doc/content_management.png differ diff --git a/doc/content_template_create_cms.png b/doc/content_template_create_cms.png new file mode 100644 index 000000000..caf6ecdaa Binary files /dev/null and b/doc/content_template_create_cms.png differ diff --git a/doc/content_templates.gif b/doc/content_templates.gif new file mode 100644 index 000000000..25cf4c454 Binary files /dev/null and b/doc/content_templates.gif differ diff --git a/doc/content_templates.md b/doc/content_templates.md new file mode 100644 index 000000000..1dce18372 --- /dev/null +++ b/doc/content_templates.md @@ -0,0 +1,21 @@ +# Content Templates + +Content Templates are a way to define the structure of content elements, which can be used in blocks and pages. + + + +## General usage + +Let's assume you want to create a content template for a blog post. +You want to add following content elements: +- **Title** (textarea) +- **Subtitle** (textarea) +- **Image** (single media) +- **Content** (textarea) +- **Author** (textarea) +- **Products carousel** (products carousel by taxon) + +Then, when you create a page, in the content elements section you can choose the content template you created. +It will create a form with fields you defined in the template. \ +Your job is just to fill them with content. \ +Of course, you can add additional content elements to the form, after you choose the template. It's super flexible! diff --git a/doc/content_templates_cms.png b/doc/content_templates_cms.png new file mode 100644 index 000000000..7e941ced2 Binary files /dev/null and b/doc/content_templates_cms.png differ diff --git a/doc/customization.md b/doc/customization.md index e5e398d9c..f73654d61 100644 --- a/doc/customization.md +++ b/doc/customization.md @@ -9,34 +9,34 @@ You can customize this plugin using: In order to check what services are available with this plugin, run the following command: ```bash -$ bin/console debug:container bitbag_sylius_cms_plugin +$ bin/console debug:container sylius_cms ``` **Note:** -*All forms are prefixed with 'bitbag_sylius_cms_plugin.form.*'* +*All forms are prefixed with 'sylius_cms.form.*'* If you want to check what routes are available with this plugin, use: ```bash -$ bin/console debug:router | grep bitbag_sylius_cms_plugin +$ bin/console debug:router | grep sylius_cms ``` To check parameters available with the plugin, execute: ```bash -$ bin/console debug:container --parameters | grep bitbag +$ bin/console debug:container --parameters | grep sylius_cms ``` ## How to disable localised URLs? -Customise vendor routing in the file `app/Resources/BitBagSyliusCmsPlugin/config/routing.yml` (create if not exist). +Customise vendor routing in the file `app/Resources/SyliusCmsPlugin/config/routing.yml` (create if not exist). Add: ``` -bitbag_sylius_cms_plugin_admin: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/admin.yml" +sylius_cms_admin: + resource: "@SyliusCmsPlugin/Resources/config/routing/admin.yml" prefix: /admin -bitbag_sylius_cms_plugin_shop: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/shop.yml" +sylius_cms_shop: + resource: "@SyliusCmsPlugin/Resources/config/routing/shop.yml" prefix: / sylius_sitemap: diff --git a/doc/faq_cms.png b/doc/faq_cms.png deleted file mode 100644 index 3df5d48f1..000000000 Binary files a/doc/faq_cms.png and /dev/null differ diff --git a/doc/faq_cms_result.png b/doc/faq_cms_result.png deleted file mode 100644 index bce828b55..000000000 Binary files a/doc/faq_cms_result.png and /dev/null differ diff --git a/doc/faq_create_cms.png b/doc/faq_create_cms.png deleted file mode 100644 index 3dc4dd109..000000000 Binary files a/doc/faq_create_cms.png and /dev/null differ diff --git a/doc/faqs.md b/doc/faqs.md deleted file mode 100644 index 2b27b1279..000000000 --- a/doc/faqs.md +++ /dev/null @@ -1,20 +0,0 @@ -# FAQs - -Frequently asked question is a common part of each eCommerce website. You can add the in your admin -panel configuring question, answer and position. All results will be paginated in the store front. - -## General usage - -To render FAQs list, use the `bitbag_sylius_cms_plugin_shop_frequently_asked_question_index` route. - -```twig -{{ 'app.ui.faqs'|trans }} -``` - -## Customization - -If you don't know how to override templates yet, -read [Sylius template customization guide](http://docs.sylius.org/en/latest/customization/template.html). - -You can create a template under `app/Resources/BitBagSyliusCmsPlugin/views/Shop/FrequentlyAskedQuestion` location. -Available templates you can override can be found under [this location](../src/Resources/views/Shop/FrequentlyAskedQuestion). diff --git a/doc/fixtures.md b/doc/fixtures.md index 5b3d2c191..c4cc0a82f 100644 --- a/doc/fixtures.md +++ b/doc/fixtures.md @@ -9,4 +9,4 @@ read [this documentation page](http://docs.sylius.com/en/1.2/book/architecture/f ## General usage -As you can see in [here](../tests/Application/config/packages/bitbag_sylius_cms_plugin.yml), cms fixtures are configured to be run under `default` suite. It means that after installing plugin all you need to do is run `bin/console sylius:fixtures:load` and all of cms fixtures will load as well. +As you can see in [here](../tests/Application/config/packages/sylius_cms.yml), cms fixtures are configured to be run under `default` suite. It means that after installing plugin all you need to do is run `bin/console sylius:fixtures:load` and all of cms fixtures will load as well. diff --git a/doc/importing-resources.md b/doc/importing-resources.md index 8cce460a4..0e8d0e696 100644 --- a/doc/importing-resources.md +++ b/doc/importing-resources.md @@ -21,10 +21,9 @@ are validated against constraints used in the admin panel. What's more, thanks t Currently implemented importers support following column names, which are constants values from below table. **Note:** -- `__locale__` suffix needs to be replaced with a specific locale configured in your admin panel. -- `sections`, `channels` and `products` represent associations that are recognized with comma separated resource codes. -For instance, if you want to associate three sections via the CSV file, you should fill the `sections` column with -`homepage, blog, delivery` value, where each value is a single section code. +- `collections`, `channels`, `locales`, `products`, `products_in_taxons`, `taxons` represent associations that are recognized with comma separated resource codes. +For instance, if you want to associate three collections via the CSV file, you should fill the `collections` column with +`homepage, blog, delivery` value, where each value is a single collection code. | Resource code | Importer columns interface | |---------------|--------------------------------------------------------------------| @@ -39,13 +38,13 @@ As previously mentioned, in order to import a data, you need to pick specific re In order to import data via command, execute: ```bash -$ bin/console bitbag:import:csv [resource code] [path/to/your/csv/file.csv] +$ bin/console cms:import:csv [resource code] [path/to/your/csv/file.csv] ``` For instance, if you wish to import a page, run: ```bash -$ bin/console bitbag:import:csv page ~/Documents/pages.csv +$ bin/console cms:import:csv page ~/Documents/pages.csv ``` ## Importing via admin panel @@ -64,7 +63,7 @@ the resolver needs to create a new resource or update an existing one: ```yaml app.resolver.resource.product: - class: BitBag\SyliusCmsPlugin\Resolver\ResourceResolver + class: Sylius\CmsPlugin\Resolver\ResourceResolver arguments: - "@sylius.repository.product" - "@sylius.factory.product" @@ -80,7 +79,7 @@ declare(strict_types=1); namespace AppBundle\Importer; -use BitBag\SyliusCmsPlugin\Importer\ImporterInterface; +use Sylius\CmsPlugin\Importer\ImporterInterface; interface ProductImporterInterface extends ImporterInterface { @@ -100,8 +99,8 @@ declare(strict_types=1); namespace AppBundle\Importer; -use BitBag\SyliusCmsPlugin\Importer\AbstractImporter; -use BitBag\SyliusCmsPlugin\Resolver\ResourceResolverInterface; +use Sylius\CmsPlugin\Importer\AbstractImporter; +use Sylius\CmsPlugin\Resolver\ResourceResolverInterface; use Doctrine\ORM\EntityManagerInterface; use Sylius\Component\Locale\Context\LocaleContextInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; @@ -181,12 +180,12 @@ final class ProductImporter extends AbstractImporter implements ProductImporterI - "@validator" - "@doctrine.orm.entity_manager" tags: - - { name: bitbag.cmsplugin.importer } + - { name: cms_plugin.importer } ``` 5. :tada: -Now you can use the `$ bin/console bitbag:import:csv product /path/to/products.csv/file` command to upload your products. +Now you can use the `$ bin/console cms:import:csv product /path/to/products.csv/file` command to upload your products. Read the below section to enable the import from UI feature. @@ -213,7 +212,7 @@ sylius_grid: ### Overriding the importer grid template -Create an `_importForm.html.twig` file under `app/Resources/BitBagSyliusCmsPlugin/views/Grid/Form` location. Take a look at +Create an `_importForm.html.twig` file under `app/Resources/SyliusCmsPlugin/views/Grid/Form` location. Take a look at the default [_importForm.html.twig](../src/Resources/views/Grid/Form/_importForm.html.twig) file. ### Example diff --git a/doc/installation.md b/doc/installation.md index 842b00618..51a4a3cc5 100644 --- a/doc/installation.md +++ b/doc/installation.md @@ -1,39 +1,64 @@ -## Installation - - -1. *We work on stable, supported and up-to-date versions of packages. We recommend you to do the same.* - +# Installation + +## Overview: +GENERAL +- [Requirements](#requirements) +- [Composer](#composer) +- [Basic configuration](#basic-configuration) +--- +BACKEND +- [Entities](#entities) +--- +FRONTEND +- [Webpack](#webpack) +--- +ADDITIONAL +- [Tests](#tests) +--- + +## Requirements: +We work on stable, supported and up-to-date versions of packages. We recommend you to do the same. + +| Package | Version | +|---------------|-----------------| +| PHP | \>=8.1 | +| sylius/sylius | 1.12.x - 1.13.x | +| MySQL | \>= 5.7 | +| NodeJS | \>= 18.x | + +## Composer: ```bash -$ composer require bitbag/cms-plugin --no-scripts +composer require bitbag/cms-plugin --no-scripts ``` -2. Add plugin dependencies to your `config/bundles.php` file: +## Basic configuration: +1. Add plugin dependencies to your `config/bundles.php` file (if not added automatically): ```php +# config/bundles.php + return [ ... - FOS\CKEditorBundle\FOSCKEditorBundle::class => ['all' => true], // WYSIWYG editor - BitBag\SyliusCmsPlugin\BitBagSyliusCmsPlugin::class => ['all' => true], + Sylius\CmsPlugin\SyliusCmsPlugin::class => ['all' => true], ]; ``` -The first line above (FOSCKEditorBundle) might have been already added during composer require command. -Install WYSIWYG editor ([FOS CKEditor](https://symfony.com/doc/master/bundles/FOSCKEditorBundle/usage/ckeditor.html)) +2. Install WYSIWYG editor ([FOS CKEditor](https://symfony.com/doc/master/bundles/FOSCKEditorBundle/usage/ckeditor.html)) ```bash -$ bin/console ckeditor:install +bin/console ckeditor:install ``` **Note.** If you have an issue with the ckeditor not running, please try to install it using the `4.22.1` tag: ```bash -$ bin/console ckeditor:install --tag=4.22.1 +bin/console ckeditor:install --tag=4.22.1 ``` For more information regardin `4.22.1` tag please visit the #485 issue. -Since FOSCKEditorBundle 2.0, to make Twig render the WYSIWYG editor, you must add some configuration under the `twig.form_themes` config key: +3. If you are not using Symfony Flex, you need to add the following configuration: ```yaml # Symfony 2/3: app/config/config.yml @@ -42,120 +67,82 @@ Since FOSCKEditorBundle 2.0, to make Twig render the WYSIWYG editor, you must ad twig: form_themes: - '@FOSCKEditor/Form/ckeditor_widget.html.twig' - - '@BitBagSyliusCmsPlugin/Form/ckeditor_widget.html.twig' + - '@SyliusCmsPlugin/Form/ckeditor_widget.html.twig' ``` -3. Import required config in your `config/packages/_sylius.yaml` file: ```yaml # config/packages/_sylius.yaml imports: - ... - - - { resource: "@BitBagSyliusCmsPlugin/Resources/config/config.yml" } -``` + ... + - { resource: "@SyliusCmsPlugin/Resources/config/config.yml" } -4. Import routing in your `config/routes.yaml` file: - -```yaml # config/routes.yaml ... - -bitbag_sylius_cms_plugin: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing.yml" -``` -If You have installed https://github.com/stefandoorn/sitemap-plugin according to its installation instructions -import optional sitemap providers: -```yaml -# config/services.yaml -... -imports: -... - - { resource: "@BitBagSyliusCmsPlugin/Resources/config/services/sitemap_provider.yml" } +sylius_cms: + resource: "@SyliusCmsPlugin/Resources/config/routing.yml" ``` -and plugin dependency to your `config/bundles.php` file: -```php -return [ - ... - - SitemapPlugin\SitemapPlugin::class => ['all' => true], // Sitemap support -]; +4. Install assets: +```bash +bin/console assets:install --symlink +bin/console sylius:theme:assets:install --symlink ``` -you will probably need to change the extension of the imported file in - -```yaml -# config/packages/sitemap_plugin.yaml - - imports: - - { resource: "@SitemapPlugin/Resources/config/config.yaml" } +## Entities +### Update your database +First, please run legacy-versioned migrations by using command: +```bash +bin/console doctrine:migrations:migrate ``` -5. Finish the installation by updating the database schema and installing assets: - +After migration, please create a new diff migration and update database: ```bash -$ bin/console cache:clear - -# If you used migrations in your project... -$ bin/console doctrine:migrations:migrate -# ... or if you use doctrine schema tool. -$ bin/cosole doctrine:schema:update --dump-sql # and --force switch when you're ready :) - -$ bin/console assets:install --symlink -$ bin/console sylius:theme:assets:install --symlink +bin/console doctrine:migrations:diff +bin/console doctrine:migrations:migrate ``` +**Note:** If you are running it on production, add the `-e prod` flag to this command. -Note. In some cases the `--symlink` option [may trow some errors](https://github.com/Sylius/SyliusThemeBundle/issues/91). If you consider running the commands without `--symlink` option, please keep in mind to run them on every potential plugin update. +### Clear application cache by using command: +```bash +bin/console cache:clear +``` +**Note:** If you are running it on production, add the `-e prod` flag to this command. -6. Add plugin assets to your project +## Webpack We recommend you to use Webpack (Encore), for which we have prepared four different instructions on how to add this plugin's assets to your project: - [Import webpack config](./01.1-webpack-config.md)* -- [Add entry to existing config](./01.2-webpack-entry.md)) -- [Import entries in your entry.js files](./01.3-import-entry.md)) -- [Your own custom config](./01.4-custom-solution.md)) +- [Add entry to existing config](./01.2-webpack-entry.md) +- [Import entries in your entry.js files](./01.3-import-entry.md) +- [Your own custom config](./01.4-custom-solution.md) * Default option for plugin development - However, if you are not using Webpack, here are instructions on how to add optimized and compressed assets directly to your project templates: - [Non webpack solution](./01.5-non-webpack.md) -7. Passing required "backend" values to "frontend" - -In order to make plugin finally work you need to declare "route", in admin _scripts.html.twig you can pass: - -``` - -``` - -Any other approach, that will allow cms pages to read this value in js, under "route" key, will work. - -## Testing & running the plugin -```bash -$ composer install -$ cd tests/Application -``` -Copy file `package.json.~1.XX.0.dist` to `package.json` where `~1.XX.0` is the Sylius version you are using. - +### Run commands ```bash -$ cp package.json.~1.12.0.dist package.json +yarn install +yarn encore dev # or prod, depends on your environment ``` +## Tests +To run the tests, execute the commands: ```bash -$ yarn install -$ yarn encore dev -$ APP_ENV=test bin/console assets:install -$ APP_ENV=test bin/console doctrine:schema:create -$ APP_ENV=test symfony server:start --port=8080 -d -$ cd ../.. -$ open http://localhost:8080 -$ vendor/bin/behat -$ vendor/bin/phpspec run +composer install +cd tests/Application +yarn install +yarn encore dev +APP_ENV=test bin/console assets:install +APP_ENV=test bin/console doctrine:schema:create +APP_ENV=test symfony server:start --port=8080 -d +cd ../.. +open http://localhost:8080 +vendor/bin/behat +vendor/bin/phpspec run ``` diff --git a/doc/legacy_data_migration.md b/doc/legacy_data_migration.md new file mode 100644 index 000000000..4ee2ce364 --- /dev/null +++ b/doc/legacy_data_migration.md @@ -0,0 +1,49 @@ +# Legacy data migration + +## Introduction + +You can migrate your blocks & pages from the 4.x version to the 5.x version of the plugin. +To do so, you need to follow the steps below. + +## Steps + +1. Create new CSV files with blocks & pages data in the 4.x format. +See an example in [block_legacy.csv](block_legacy.csv) or [page_legacy.csv](page_legacy.csv). +2. Install the 5.x version of the plugin. +3. Go to the console and run the following command: +```bash +bin/console cms:import:csv page_legacy {file_path}.csv +bin/console cms:import:csv block_legacy {file_path}.csv +``` + +## Info about legacy CSV files columns + +### Blocks + +- **code** - block code. +- **type** - it will be ignored. +- **name_LOCALE** - block name. First occurrence of its column is the default name for the block. +For each locale, there will be created a Heading content element. +- **content_LOCALE** - block content. For each locale, there will be created a Textarea content element. +- **sections** - it will be converted to the block's collections. +- **channels** - block channels. +- **products** - block products. There will be created Products grid content element. +- **image_LOCALE** - block image. For each locale, there will be created a Single media content element. +- **slug_LOCALE** - it will be ignored. + +### Pages + +- **code** - page code. +- **sections** - it will be converted to the page's collections. +- **channels** - page channels. +- **products** - page products. There will be created Products grid content element. +- **slug_LOCALE** - page slug. +- **name_LOCALE** - page name. First occurrence of its column is the default name for the page. +For each locale, there will be created a Heading content element. +- **image_LOCALE** - page image. For each locale, there will be created a Single media content element. +- **meta_keywords_LOCALE** - page meta keywords. +- **meta_description_LOCALE** - page meta description. +- **content_LOCALE** - page content. For each locale, there will be created a Textarea content element. +- **breadcrumb_LOCALE** - it will be ignored. +- **name_when_linked_LOCALE** - for each locale, there will be created a teaser title. +- **description_when_linked_LOCALE** - for each locale, there will be created a teaser content. diff --git a/doc/media.md b/doc/media.md index 542508321..ebd781ae2 100644 --- a/doc/media.md +++ b/doc/media.md @@ -10,50 +10,45 @@ Currently, it supports following media types: ## General usage -You can render media in four ways: +You can render media in two ways: By rendering a media code template: ```twig -{{ bitbag_cms_render_media('media_code') }} +{{ sylius_cms_render_media('media_code') }} ``` - -Rendering a media code directly: +Function above can also take an additional parameter: `template`. ```twig -{{ render(path('bitbag_sylius_cms_plugin_shop_media_render', {'code' : 'file', 'template' : '@App/Some/Template/_path.html.twig'})) }} +{{ sylius_cms_render_media('media_code', '@App/templates/example.html.twig')}} ``` -If you want to list media by specific section. Useful for displaying set of images. For example, using "gallery" section you can group set of images and display them as gallery, or even slider. +Rendering a media code directly: ```twig -{{ render(path('bitbag_sylius_cms_plugin_shop_media_index_by_section_code', {'sectionCode' : 'gallery', 'template' : '@App/Some/Template/_path.html.twig'})) }} +{{ render(path('sylius_cms_shop_media_render', {'code' : 'file', 'template' : '@App/Some/Template/_path.html.twig'})) }} ``` -Or by providing custom twig template. Useful when you want to render media in a different template: +## Media provider -```{{ bitbag_cms_render_media('media_code', '@App/templates/example.html.twig')}}``` +You can add your own media provider by adding a service with a tag named `sylius_cms.media_provider`: -### Media provider - -You can add your own media provider by adding a service with a tag named `bitbag_sylius_cms_plugin.media_provider`: - -```php +```twig app.media_provider.audio: - class: BitBag\SyliusCmsPlugin\MediaProvider\GenericProvider + class: Sylius\CmsPlugin\MediaProvider\GenericProvider arguments: - - "@bitbag_sylius_cms_plugin.media_uploader" + - "@sylius_cms.media_uploader" - "@templating.engine.twig" - - "@@BitBagSyliusCmsPlugin/Shop/Media/Show/audio.html.twig" + - "@@SyliusCmsPlugin/Shop/Media/Show/audio.html.twig" - "media/audio" tags: - - { name: bitbag_sylius_cms_plugin.media_provider, type: audio, label: bitbag_sylius_cms_plugin.ui.audio_provider } + - { name: sylius_cms.media_provider, type: audio, label: sylius_cms.ui.audio_provider } ``` ## Customization -If you don't know how to override templates yet, +If you don't know how to override templates yet, read [Sylius template customization guide](http://docs.sylius.org/en/latest/customization/template.html). -You can create a template under `app/Resources/BitBagSyliusCmsPlugin/views/Shop/Media` location. +Even if you can pass template argument to render media resource, you can change the global templates under `app/templates/bundles/SyliusCmsPlugin/Shop/Media` location. Available templates you can override can be found under [this location](../src/Resources/views/Shop/Media). diff --git a/doc/media_cms.png b/doc/media_cms.png index d5edbe354..e5827414a 100644 Binary files a/doc/media_cms.png and b/doc/media_cms.png differ diff --git a/doc/media_cms_result.png b/doc/media_cms_result.png index c0767e15b..332dc4068 100644 Binary files a/doc/media_cms_result.png and b/doc/media_cms_result.png differ diff --git a/doc/media_create_cms.png b/doc/media_create_cms.png index 32aaa25bc..63f049ec4 100644 Binary files a/doc/media_create_cms.png and b/doc/media_create_cms.png differ diff --git a/doc/page.csv b/doc/page.csv index 47d208dd7..4518d95bf 100644 --- a/doc/page.csv +++ b/doc/page.csv @@ -1,2 +1,2 @@ -code,sections,channels,products,slug_en_US,name_en_US,image_en_US,meta_keywords_en_US,meta_description_en_US,content_en_US,breadcrumb_en_US,name_when_linked_en_US,description_when_linked_en_US -aboutUS,,US_WEB,,about_us,About US,,About US,About US,"",,, +code,name,enabled,collections,channels,slug_en_US,meta_title_en_US,meta_keywords_en_US,meta_description_en_US,slug_de_DE,meta_title_de_DE,meta_keywords_de_DE,meta_description_de_DE +aboutUS,About US,1,,FASHION_WEB,about_us,Meta title en US,About US,About US,about_us,Meta title en DE,About US,About US diff --git a/doc/page_legacy.csv b/doc/page_legacy.csv new file mode 100644 index 000000000..47d208dd7 --- /dev/null +++ b/doc/page_legacy.csv @@ -0,0 +1,2 @@ +code,sections,channels,products,slug_en_US,name_en_US,image_en_US,meta_keywords_en_US,meta_description_en_US,content_en_US,breadcrumb_en_US,name_when_linked_en_US,description_when_linked_en_US +aboutUS,,US_WEB,,about_us,About US,,About US,About US,"",,, diff --git a/doc/pages.md b/doc/pages.md index 6ecac44b1..919362e49 100644 --- a/doc/pages.md +++ b/doc/pages.md @@ -1,69 +1,47 @@ # Pages -Pages represent a customizable web page, you can adjust to your needs in admin panel. +Pages represent a customizable web page, you can adjust to your needs in admin panel. + +## Page sections + +Page contain 4 main editable sections: +- **General settings** - where you can set page name, code, channels, collections and publish at. It also contains a Preview button, which allows you to preview the page. +- **Content elements** - where you can add content elements to the page, read more about content elements [here](content_elements.md). +- **Teaser** - where you can set image, title and content. Teaser is a small preview of the page. It is used during rendering a collection of pages. +- **SEO** - where you can set slug, meta title, meta keywords and meta description. ## General usage +### Rendering the page + Once you created a page in the admin panel, you can render page in two ways: By rendering a page link template: ```twig -{{ render(path('bitbag_sylius_cms_plugin_shop_page_show_link_by_code', {'code' : 'about', 'template' : '@BitBagSyliusCmsPlugin/Shop/Page/Show/_link.html.twig'})) }} +{{ render(path('sylius_cms_shop_page_show_link_by_code', {'code' : 'about', 'template' : '@SyliusCmsPlugin/Shop/Page/Show/_link.html.twig'})) }} ``` Or rendering a page link directly: ```twig -{{ render(path('bitbag_sylius_cms_plugin_shop_page_show', {'slug' : 'about'})) }} -``` - -### Render product pages by section - -Let's assume you associated pages to specific products. You can render them grouped by section in your product view by using - -```twig -{{ bitbag_cms_render_product_pages(product) }} -``` - -Twig function. This is where `nameWhenLinked` and `descriptionWhenLinked` fields are used. If you associate pages to -specific sections, they will be displayed in columns titled with section name. - -### Render link to page from its code - -If you want to create a link to a page from its code, you can do either with `bitbag_cms_render_link_for_code` or `bitbag_cms_get_link_for_code` twig functions. These functions will automatically generate a link with the correct locale. - -You can define attributes to customize the tag. You can also customize the displayed name (by default the function will try to display the name when linked, if it is not defined, it will fallback to the page name). - -If you only need the link, you can use `bitbag_cms_get_link_for_code`. - -You can display a message if the page wasn't found with the `notFoundMessage` option. - -```twig -{{ bitbag_cms_render_link_for_code('code') }} -{{ bitbag_cms_render_link_for_code('code', { attr: { class: 'ui button' }, name: 'Custom name' }) }} -{{ bitbag_cms_render_link_for_code('code', {}, 'custom/template.html.twig') }} -{{ bitbag_cms_get_link_for_code('code') }} -{{ bitbag_cms_render_link_for_code('wrong-code', { notFoundMessage: 'Page not found' }) }} -{{ bitbag_cms_get_link_for_code('wrong-code', { notFoundMessage: 'Page not found' }) }} - +{{ render(path('sylius_cms_shop_page_show', {'slug' : 'about'})) }} ``` -Will render: +### Visiting the page -```html -Name when linked -Custom name - -/{_locale}/pages/{slug} -Page not found -Page not found -``` +Page URL is generated based on the page slug. Full link looks like this: `domain.com/{locale}/page/{slug}`. ## Customization -If you don't know how to override templates yet, +### Override page template + +If you don't know how to override templates yet, read [Sylius template customization guide](http://docs.sylius.org/en/latest/customization/template.html). -You can create a template under `app/Resources/BitBagSyliusCmsPlugin/views/Shop/Page` location. +You can create a template under `app/templates/bundles/SyliusCmsPlugin/Shop/Page` location. Available templates you can override can be found under [this location](../src/Resources/views/Shop/Page). + +### Custom Page Templates + +For more information about custom page templates, check the [documentation](templates.md). diff --git a/doc/pages_cms.png b/doc/pages_cms.png index 711a53e97..1ab5fdc97 100644 Binary files a/doc/pages_cms.png and b/doc/pages_cms.png differ diff --git a/doc/pages_cms_result_1.png b/doc/pages_cms_result_1.png index 094238046..da3100824 100644 Binary files a/doc/pages_cms_result_1.png and b/doc/pages_cms_result_1.png differ diff --git a/doc/pages_cms_result_2.png b/doc/pages_cms_result_2.png index 8e329eac8..3898426d0 100644 Binary files a/doc/pages_cms_result_2.png and b/doc/pages_cms_result_2.png differ diff --git a/doc/pages_create_cms.png b/doc/pages_create_cms.png index df577ae35..d6c6689dd 100644 Binary files a/doc/pages_create_cms.png and b/doc/pages_create_cms.png differ diff --git a/doc/section_cms_result.png b/doc/section_cms_result.png deleted file mode 100644 index e6d365051..000000000 Binary files a/doc/section_cms_result.png and /dev/null differ diff --git a/doc/sections.md b/doc/sections.md deleted file mode 100644 index 755c28c69..000000000 --- a/doc/sections.md +++ /dev/null @@ -1,20 +0,0 @@ -# Sections - -With sections, you can organize your blocks and pages under some specific categories. -For instance, you can create a Blog section and display pages and blocks under it. - -## General usage - -In order to render a page by section code, use: - -```twig - - {{ 'app.ui.blog'|trans }} - -``` - -If you want to list blocks by specific section, use: - -```twig -{{ render(path('bitbag_sylius_cms_plugin_shop_block_index_by_section_code', {'sectionCode' : 'blog', 'template' : '@BitBagSyliusCmsPlugin/Shop/Block/index.html.twig'})) }} -``` diff --git a/doc/sections_cms.png b/doc/sections_cms.png deleted file mode 100644 index b386589ba..000000000 Binary files a/doc/sections_cms.png and /dev/null differ diff --git a/doc/sections_create_cms.png b/doc/sections_create_cms.png deleted file mode 100644 index abcb65a86..000000000 Binary files a/doc/sections_create_cms.png and /dev/null differ diff --git a/doc/sitemap.md b/doc/sitemap.md deleted file mode 100644 index c3c90f812..000000000 --- a/doc/sitemap.md +++ /dev/null @@ -1,11 +0,0 @@ -# Sitemap - -This plugin suggests to install the Sylius sitemap plugin. The plugin is not installed automatically, but to install run: - -```bash - $ composer require stefandoorn/sitemap-plugin ^2.0@alpha -``` - -It's already configured after installation and contains a page & section provider. - -For more information, read the original [SitemapPlugin documentation](https://github.com/stefandoorn/sitemap-plugin). diff --git a/doc/templates.md b/doc/templates.md new file mode 100644 index 000000000..d32b6f821 --- /dev/null +++ b/doc/templates.md @@ -0,0 +1,24 @@ +# Page/Block Templates + +Templates allow you to define and select the layout of your pages and blocks. + +## General usage + +By default, the blocks and pages have its own templates. You can create your own templates and use it in specific blocks or pages. + +### Creating a new template + +1. Go to the `config/packages/cms_plugin.yaml` file. +2. Define your templates in following format: +```yaml +sylius_cms: + templates: + pages: + - "@SyliusCMSPlugin/Shop/MyPage/template.twig" + - "@SyliusCMSPlugin/Shop/MySecondPage/template.twig" + blocks: + - "@SyliusCMSPlugin/Shop/MyPage/template.twig" + - "@SyliusCMSPlugin/Shop/MySecondPage/template.twig +``` +3. Create a new template file. For example, `templates/bundles/SyliusCMSPlugin/Shop/MyPage/template.twig`. +4. Go to the Block/Page form and select your template from the list. diff --git a/doc/twig-functions-in-admin.md b/doc/twig-functions-in-admin.md deleted file mode 100644 index 209aeb957..000000000 --- a/doc/twig-functions-in-admin.md +++ /dev/null @@ -1,27 +0,0 @@ -# Using Twig functions in admin panel - -With CMS 2.0+, you can use some Twig functions in the admin panel content. It's extremely helpful -if you wish to render a block within a page, or what's even more common - a media, for instance an -image or video. - -So far, only following functions are allowed: - -```yaml -parameters: - bitbag_cms.twig.admin_functions: - - bitbag_cms_render_block - - bitbag_cms_render_media -``` - -As this is a parameter, you can easily customize its value in your `config.yml`. - -**Note:** - -*With the parser, you are supposed to use the function with `{{ function_name('foo', 'bar') }}` format. -All characters, including spaces and apostrophes are recognized. Only string parameters are allowed.* - -*If for some reason the function would not be able to execute, an empty string result will be returned.* - -*To render the interpretable content, you need to use a special `{{ bitbag_cms_render_content([resource]) }}` Twig function. -The resource needs to implement [ContentableInterface](../src/Entity/ContentableInterface.php). -For an example, take a look at the Block's [show.html.twig](../src/Resources/views/Shop/Block/show.html.twig)* file. diff --git a/doc/use_case.md b/doc/use_case.md index a1c912296..0d23bcfb1 100644 --- a/doc/use_case.md +++ b/doc/use_case.md @@ -1,6 +1,6 @@ # What is and how to use Sylius CMS Plugin -BitBag Sylius CMS Plugin is a plugin developed for Sylius, +CMS Plugin is a plugin developed for Sylius, a popular open-source e-commerce system based on Symfony. The plugin enhances Sylius with advanced content management capabilities, allowing the creation, editing, and publication of dynamic CMS (Content Management System) pages within an e-commerce store. @@ -12,8 +12,8 @@ This empowers businesses to easily adapt their store's content to meet current n ## What Sylius CMS Plugin provides us with -When using the BitBag Sylius CMS Plugin, administrators gain access to various tiles within the admin panel, each serving a specific purpose. -These tiles include Blocks, Media, Pages, FAQs, and Sections. +When using the Sylius CMS Plugin, administrators gain access to various tiles within the admin panel, each serving a specific purpose. +These tiles include Collections, Templates, Pages, Blocks and Media. ## Brief overview of what each tile offers @@ -23,65 +23,66 @@ In admin panel, the whole CMS functionality is located under "Content Management Our CMS Plugin allows you to manage: -* Sections - the containers for blocks -* Blocks - separate parts for the content -* Media - files, that can be attached to the page -* Pages - whole pages, obtainable by the link -* FAQ - the simple mechanism for Frequently Asked Questions function +* **Collections** - responsible for grouping the pages/blocks/media +* **Content Templates** - allows to create a template of content elements for the page or block +* **Pages** - whole pages, obtainable by the link +* **Blocks** - separate parts for the content, composed of the content elements +* **Media** - images, videos, etc. that can be used in other segments of the CMS --- -### Sections: -The Sections tile allows administrators to create and manage sections within CMS pages. +### Collections: -Sections serve as containers for content blocks and provide a structured way to organize content. -By utilizing sections, administrators can easily arrange and customize the layout of CMS pages to achieve the desired visual and informational structure. +The Collections tile allows administrators to create and manage collections within CMS pages. - +Collections serve as containers for blocks, pages, media and provide a structured way to organize content. +By utilizing collections, administrators can group related content elements together, such as blog posts, product listings, or promotional banners. -More information about Sections you can get [here](use_case_sections.md). + -### Blocks -The Blocks tile allows administrators to create and manage reusable content blocks. - -The Blocks can be utilized across different CMS pages, providing flexibility and consistency in content presentation. Blocks can contain text, images, videos, or any other desired content elements. +More information about Collections you can get [here](use_case_collections.md). - +### Content Templates: -More information about Blocks you can get [here](use_case_blocks.md). - -### Media -The Media tile provides a centralized hub for managing media files within the CMS. +The Content Templates tile allows administrators to create and manage templates built from content elements skeletons. -Administrators can upload and organize images, videos, and other media assets. The files can then be easily inserted into CMS pages, enriching the content with visual elements. - - - -More information about Media you can get [here](use_case_media.md). + ### Pages: + The Pages tile is where administrators can create, edit, and organize CMS pages. -It enables the creation of various types of pages, such as the homepage, informational pages, or blog posts. Administrators can add content, images, and other media, customize the layout, and manage page hierarchy. +It enables the creation of various types of pages, such as the homepage, informational pages, or blog posts.  More information about Pages you can get [here](use_case_pages.md). -### FAQ -The FAQ tile is specifically designed to manage frequently asked questions. +### Blocks -Administrators can create question-and-answer pairs, categorize them, and make them available to customers on relevant pages. This helps provide clear information and addresses common queries for a seamless customer experience. +The Blocks tile allows administrators to create and manage blocks built from content elements. - +The Blocks can be rendered in twig templates, providing flexibility and consistency in content presentation. -More information about the FAQ you can get [here](use_case_faq.md). + + +More information about Blocks you can get [here](use_case_blocks.md). + +### Media + +The Media tile provides a centralized hub for managing media files within the CMS. + +Administrators can upload and organize images, videos, and other media assets. The files can then be easily used in other parts of the CMS. + + + +More information about Media you can get [here](use_case_media.md). ## Summary -In summary, the BitBag Sylius CMS Plugin provides administrators with a range of tiles in the admin panel, including [Sections](use_case_sections.md), [Blocks](use_case_blocks.md), -[Media](use_case_media.md), [Pages](use_case_pages.md) and [FAQ](use_case_faq.md). +In summary, the Sylius CMS Plugin provides administrators with a range of tiles in the admin panel, +including [Collections](use_case_collections.md), [Content Templates](use_case_content_templates.md), [Pages](use_case_pages.md), [Blocks](use_case_blocks.md), [Media](use_case_media.md). -These tiles offer functionalities for managing reusable content blocks, media assets, CMS pages, frequently asked questions, -and page sections. Together, they enable administrators to efficiently create, edit, and organize content within the Sylius e-commerce system, +These tiles offer functionalities for managing CMS segments. +Together, they enable administrators to efficiently create, edit, and organize content within the Sylius e-commerce system, resulting in a more engaging and personalized user experience. diff --git a/doc/use_case_blocks.md b/doc/use_case_blocks.md index 8096e1b5c..bda630961 100644 --- a/doc/use_case_blocks.md +++ b/doc/use_case_blocks.md @@ -1,6 +1,6 @@ # Blocks -With the BitBag SyliusCmsPlugin, administrators can arrange content blocks within sections, including the product page. +With the SyliusCmsPlugin, administrators can create and manage blocks built from content elements. This allows for customized content presentation, showcasing product features, promotions, and relevant information. @@ -20,7 +20,7 @@ By following the steps below, administrators can easily add blocks and customize 1. Please access the administrator panel of the Sylius e-commerce system. 2. Navigate to the CMS section or the designated area for managing blocks. 3. Locate the option to create a new block and click on it. -4. Fill in the required fields in the block creation form, such as the code and content of the block. +4. Fill in the required fields in the block creation form, such as the code and name. 5. Save the block after filling in the necessary details and selecting any desired associations. 6. Repeat the process to add additional blocks, as needed. 7. After refreshing the store page, the newly implemented changes should now be visible. @@ -29,9 +29,9 @@ By following the steps below, administrators can easily add blocks and customize In the form, you will find additional fields, which will help you with your e-commerce related content: -- Products - You can select specific products that are associated with the block. This allows the block to be displayed on the product pages of the selected products. -- Sections - You can choose the sections where the block should be placed. This helps in organizing and structuring the block within the relevant sections of the website. -- Taxons - This field allows you to select specific taxonomies or categories associated with the block. By choosing relevant taxons, the block can be displayed on the pages related to those categories. +- Display for products - You can select specific products that are associated with the block. This allows the block to be displayed on the product pages of the selected products. +- Display for products in taxon - This field allows you to select specific taxon associated with the block. By choosing relevant taxon, the block will be displayed on the product pages related to those taxon. Only "Main Taxon" is taken. +- Display for taxons - This field allows you to select specific taxonomies associated with the block. By choosing relevant taxons, the block can be displayed on the pages related to those taxons. The mentioned form: diff --git a/doc/use_case_collections.md b/doc/use_case_collections.md new file mode 100644 index 000000000..4b5b97185 --- /dev/null +++ b/doc/use_case_collections.md @@ -0,0 +1,40 @@ +# Collections + +With collections, you can organize your blocks, pages and media under specific categories. +For instance, you can create a Blog collection and display pages under it. + +Collections in the Sylius CMS Plugin serve as containers where various elements, such as content blocks, CMS pages, +and media, can be placed. These collections allow administrators to organize and manage the layout and presentation of content on pages. + +The ability to place blocks, pages, and media within collections provides full control over the appearance and structure of CMS pages, +enabling the creation of visually appealing and cohesive content layouts. Collections offer flexibility in designing pages, +allowing for customization and adaptation of displayed content to user preferences and marketing strategies. + +**Note.** If you haven't implemented the collection properly in your code yet, please visit the [Collections](collections.md) tech doc. + +## The process of creating a Collection: + +By following the steps below, administrators can add collections by providing the code, name and type for each collection. +These collections can be then utilized within the CMS pages for organizing and structuring content. + +1. Please access the administrator panel of the Sylius e-commerce system. +2. Navigate to the CMS section or the designated area for managing collections. +3. Select the option to create a new collection. +4. Fill in the required fields in the collection creation form, such as the code, name and type of the collection. +5. Save the collection after providing the necessary details. +6. Repeat the process to add additional collections, as needed. +7. After refreshing the store page, the newly implemented changes should now be visible. + +The mentioned form: + + + +## Result possible to achieve on the front of the store: + +It's possible to attach [Blocks](use_case_blocks.md), [Media](use_case_media.md) and [Pages](use_case_pages.md) to the Collections. This makes you able to [display all](collections.md) the content attached to the single Collection. + +The image below presents you a sample result of Collection rendered on the product page: + + + + diff --git a/doc/use_case_content_templates.md b/doc/use_case_content_templates.md new file mode 100644 index 000000000..fed178459 --- /dev/null +++ b/doc/use_case_content_templates.md @@ -0,0 +1,20 @@ +# Content Templates + +In this plugin, content templates are responsible for defining the structure of content elements, which can be used in blocks and pages. + +## The process of creating a Content Template + +By following these steps below, administrators can easily add and manage content templates. + +1. Please access the administrator panel of the Sylius e-commerce system. +2. Navigate to the CMS section or the designated area for managing content templates. +3. Select the option to create a new content template item. +4. Fill in the required fields in the content template creation form, such as the name and type. +5. Add some content elements. +6. Save the content template item after filling in the necessary details. +7. Repeat the process to add additional content template items, as needed. +8. Now you can use content templates in blocks and pages. + +The mentioned form: + + diff --git a/doc/use_case_faq.md b/doc/use_case_faq.md deleted file mode 100644 index 4b81dbe81..000000000 --- a/doc/use_case_faq.md +++ /dev/null @@ -1,30 +0,0 @@ -# Frequently Asked Questions - -FAQ is a common part of each eCommerce website. You can add them in your admin panel by configuring question, answer, and position. All results will be paginated in the storefront. - -The BitBag SyliusCmsPlugin allows administrators to add and display questions and answers within the FAQ section on various pages, including the product page. - -This feature enables the easy management and presentation of frequently asked questions, providing valuable information to customers within a dedicated FAQ section. - -**Note.** If you haven't implemented the FAQ properly in your code yet, please visit [FAQ](faqs.md) tech doc. - -## The process of creating an FAQ - -1. Please access the administrator panel of the Sylius e-commerce system. -2. Navigate to the CMS section or the specific area designated for managing FAQs. -3. Locate the option to add a new FAQ entry or question. -4. Enter the question in the provided field. -5. Add the corresponding answer to the question in the designated space. -6. Save the newly created FAQ entry. -7. Repeat the process for additional questions and answers as needed. -8. After refreshing the store page, the newly implemented changes should now be visible. - -The mentioned form: - - - -## Result on the front of the store: - -The image below displays a rendered FAQ on your Sylius Store: - - diff --git a/doc/use_case_media.md b/doc/use_case_media.md index 3bcacc8ae..9197014a8 100644 --- a/doc/use_case_media.md +++ b/doc/use_case_media.md @@ -2,7 +2,7 @@ In this plugin, media represents digital assets, for instance, an image, a video, or a simple PDF file. -The BitBag SyliusCmsPlugin enables administrators to add and display various types of media, such as images, videos, and files, in desired locations throughout the website. +The Sylius CMS Plugin enables administrators to add and display various types of media, such as images, videos, and files, in desired locations throughout the website. This functionality allows for the seamless integration of media elements using HTML tags, providing a visually engaging experience for users. @@ -16,7 +16,7 @@ Currently, it supports the following media types: ## The process of creating a Media -By following these steps bellow, administrators can easily add media items and customize their associations with products and sections. This provides control over where the media is displayed, ensuring it appears in the desired locations throughout the website. +By following these steps bellow, administrators can easily add and manage media. 1. Please access the administrator panel of the Sylius e-commerce system. 2. Navigate to the CMS section or the designated area for managing media. @@ -30,8 +30,11 @@ By following these steps bellow, administrators can easily add media items and c In the form, you will find additional fields, which will help you with your e-commerce related content: -- Products - You can select specific products to associate with the media item. This ensures that the media will be displayed on the product pages of the selected products. -- Sections - You can choose the sections where the media should be placed. This allows for precise positioning and organization of the media within the relevant sections of the website. +- Collections - You can choose the collections where the media should be placed. This allows for precise positioning and organization of the media within the relevant collections of the website. +- Translations: + - Alt - The alternative text for the media item. + - Link - The URL in which the media item should redirect to. + - Link content - Description of the media item link. The mentioned form: @@ -39,7 +42,4 @@ The mentioned form: ## Result possible to achieve on the front of the store: -The image below presents you a sample result of [Section](sections.md) rendered on the product page, which contains [Blocks](blocks.md) and Media (image, video and downloadable PDF file): - - - + diff --git a/doc/use_case_pages.md b/doc/use_case_pages.md index c6c8e703e..bb17773c9 100644 --- a/doc/use_case_pages.md +++ b/doc/use_case_pages.md @@ -2,12 +2,9 @@ Pages represent a customizable web page, you can adjust them to your needs in the admin panel. -With the BitBag SyliusCmsPlugin, administrators can associate related products with CMS pages, displaying them in the designated section. +With the Sylius CMS Plugin, administrators can create page content using content elements section. -This feature allows for targeted product recommendations and cross-selling opportunities within the content. - -Additionally, administrators can incorporate media elements, such as images and videos, into the pages, -enriching the visual presentation and engaging users. +Additionally, administrators can set teaser image, title and content to be displayed on the pages collection listing. The flexibility of the plugin empowers administrators to create compelling CMS pages that seamlessly integrate product information and multimedia content, enhancing the overall user experience. @@ -16,22 +13,24 @@ information and multimedia content, enhancing the overall user experience. ## The process of creating a Page -By following the steps below, administrators can add pages and associate them with products, allowing the pages to display relevant product information. This integration enhances the browsing experience by providing seamless access to product details directly from the associated pages. +By following the steps below, administrators can add pages. 1. Please access the administrator panel of the Sylius e-commerce system. 2. Navigate to the CMS section or the designated area for managing pages. 3. Select the option to create a new page. -4. Fill in the required fields in the page creation form, such as the name, content, and slug. -5. Save the page after filling in the necessary details and selecting any desired associations. +4. Fill in the required fields in the page creation form, such as the name, code and slug. +5. Save the page after filling in the necessary details. 6. Repeat the process to add additional pages, as needed. 7. After refreshing the store page, the newly implemented changes should now be visible. -### Optional configuration +### Additional configuration -In the form, you will find fields, which will help you with your e-commerce related content: +In the form, you can also set SEO settings for the page: +- Meta title +- Meta keywords +- Meta description -- Products - You can associate specific products with the page. This means that the page will display and provide information related to the selected products. -- Sections - You can choose the sections where the page should be placed, ensuring proper organization and positioning of the page within the website's structure. +Additionally, you can set the page teaser image, title and content to be displayed on the pages collection listing. The mentioned form: @@ -39,11 +38,11 @@ The mentioned form: ## Result possible to achieve on the front of the store: -The image below displays a [Section](sections.md), to which we have attached two pages: +The image below displays a simple Blog page with listing of posts:  -Additionally, every page has its own slug, so you can access its all contents by visiting it by a full URL: +The image below displays a simple Blog post:  diff --git a/doc/use_case_sections.md b/doc/use_case_sections.md deleted file mode 100644 index 0f5405eba..000000000 --- a/doc/use_case_sections.md +++ /dev/null @@ -1,39 +0,0 @@ -# Sections - -With sections, you can organize your blocks and pages under specific categories. -For instance, you can create a Blog section and display pages and blocks under it. - -Sections in the BitBag SyliusCmsPlugin serve as containers where various elements, such as content blocks, CMS pages, -and media, can be placed. These sections allow administrators to organize and manage the layout and presentation of content on pages. - -The ability to place blocks, pages, and media within sections provides full control over the appearance and structure of CMS pages, -enabling the creation of visually appealing and cohesive content layouts. Sections offer flexibility in designing pages, -allowing for customization and adaptation of displayed content to user preferences and marketing strategies. - -**Note.** If you haven't implemented the section properly in your code yet, please visit the [Sections](sections.md) tech doc. - -## The process of creating a Section: - -By following the steps below, administrators can add sections by providing the code and name for each section. These sections can be then utilized within the CMS pages for organizing and structuring content. - -1. Please access the administrator panel of the Sylius e-commerce system. -2. Navigate to the CMS section or the designated area for managing sections. -3. Select the option to create a new section. -4. Fill in the required fields in the section creation form, such as the code and name of the section. -5. Save the section after providing the necessary details. -6. Repeat the process to add additional sections, as needed. -7. After refreshing the store page, the newly implemented changes should now be visible. - -The mentioned form: - - - -## Result possible to achieve on the front of the store: - -It's possible to attach [Blocks](use_case_blocks.md), [Media](use_case_media.md) and [Pages](use_case_pages.md) to the Sections. This makes you able to [display all](sections.md) the content attached to the single Section. - -The image below presents you a sample result of Section rendered on the product page, to which we attached Pages to get the simple Blog result: - - - - diff --git a/doc/wysiwyg.md b/doc/wysiwyg.md index a8991eb7b..399a76ca1 100644 --- a/doc/wysiwyg.md +++ b/doc/wysiwyg.md @@ -9,9 +9,6 @@ is being created. You can use a custom [WysiwygType](../src/Form/Type/WysiwygType.php) any place you want the CKEditor to appear in. Take [the BlockTranslationType](../src/Form/Type/Translation/BlockTranslationType.php) as an example. -**Note:** -*In the WYSIWYG fields, you can use Twig function nesting. Read more [here](twig-functions-in-admin.md).* - ## Configuration If you want to customize any behavior of the CKEditor, you have to override one of these files: [CKEditor config](../src/Resources/config/fos_ck_editor/fos_ck_editor.yml) or [CKEditor js config](../src/Resources/views/Form/ckeditor_widget.html.twig) diff --git a/src/Resources/public/build/bitbag-cms-shop.js b/etc/build/.gitkeep similarity index 100% rename from src/Resources/public/build/bitbag-cms-shop.js rename to etc/build/.gitkeep diff --git a/features/admin/adding_block.feature b/features/admin/adding_block.feature index 0b15eb814..b7c72bb3f 100644 --- a/features/admin/adding_block.feature +++ b/features/admin/adding_block.feature @@ -12,20 +12,153 @@ Feature: Adding blocks Scenario: Adding block When I go to the create block page And I fill the code with "store_description" - And I fill the content with "We have the best candies on the internet!
" + And I fill the name with "Store Description" And I add it Then I should be notified that the block has been created @ui @javascript - Scenario: Adding block with sections - Given there are existing sections named "Blog" and "Homepage" + Scenario: Adding block with collections + Given there are existing collections named "Blog" and "Homepage" When I go to the create block page And I fill the code with "intro" - And I add "Blog" and "Homepage" sections to it - And I fill the content with "Hello world!" + And I fill the name with "Intro" + And I add "Blog" and "Homepage" collections to it And I add it Then I should be notified that the block has been created + @ui @javascript + Scenario: Adding block with textarea content element + When I go to the create block page + And I fill the code with "intro" + And I fill the name with "Intro" + And I click on Add button in Content elements section + And I select "Textarea" content element + And I add a textarea content element with "Welcome to our store" content + And I add it + Then I should be notified that the block has been created + And I should see newly created "Textarea" content element in Content elements section + + @ui @javascript + Scenario: Adding block with single media content element + Given there is an existing media with "image_1" code and name "Image 1" + When I go to the create block page + And I fill the code with "intro" + And I fill the name with "Intro" + And I click on Add button in Content elements section + And I select "Single media" content element + And I add a single media content element with name "Image 1" + And I add it + Then I should be notified that the block has been created + And I should see newly created "Single media" content element in Content elements section + + @ui @javascript + Scenario: Adding block with multiple media content element + Given there is an existing media with names "Image 1" and "Image 2" + When I go to the create block page + And I fill the code with "intro" + And I fill the name with "Intro" + And I click on Add button in Content elements section + And I select "Multiple media" content element + And I add a multiple media content element with names "Image 1" and "Image 2" + And I add it + Then I should be notified that the block has been created + And I should see newly created "Single media" content element in Content elements section + + @ui @javascript + Scenario: Adding block with heading content element + When I go to the create block page + And I fill the code with "intro" + And I fill the name with "Intro" + And I click on Add button in Content elements section + And I select "Heading" content element + And I add a heading content element with type "H3" and "Welcome to our store" content + And I add it + Then I should be notified that the block has been created + And I should see newly created "Heading" content element in Content elements section + + @ui @javascript + Scenario: Adding block with products carousel content element + Given the store has "iPhone 8" and "iPhone X" products + When I go to the create block page + And I fill the code with "intro" + And I fill the name with "Intro" + And I click on Add button in Content elements section + And I select "Products carousel" content element + And I add a products carousel content element with "iPhone 8" and "iPhone X" products + And I add it + Then I should be notified that the block has been created + And I should see newly created "Products carousel" content element in Content elements section + + @ui @javascript + Scenario: Adding block with products carousel by taxon content element + Given the store has "Smartphones" taxonomy + When I go to the create block page + And I fill the code with "intro" + And I fill the name with "Intro" + And I click on Add button in Content elements section + And I select "Products carousel by Taxon" content element + And I add a products carousel by taxon content element with "Smartphones" taxonomy + And I add it + Then I should be notified that the block has been created + And I should see newly created "Products carousel by Taxon" content element in Content elements section + + @ui @javascript + Scenario: Adding block with products grid content element + Given the store has "iPhone 8" and "iPhone X" products + When I go to the create block page + And I fill the code with "intro" + And I fill the name with "Intro" + And I click on Add button in Content elements section + And I select "Products grid" content element + And I add a products grid content element with "iPhone 8" and "iPhone X" products + And I add it + Then I should be notified that the block has been created + And I should see newly created "Products grid" content element in Content elements section + + @ui @javascript + Scenario: Adding block with products grid by taxon content element + Given the store has "Smartphones" taxonomy + When I go to the create block page + And I fill the code with "intro" + And I fill the name with "Intro" + And I click on Add button in Content elements section + And I select "Products grid by Taxon" content element + And I add a products grid by taxon content element with "Smartphones" taxonomy + And I add it + Then I should be notified that the block has been created + And I should see newly created "Products grid by Taxon" content element in Content elements section + + @ui @javascript + Scenario: Adding block with taxons list content element + Given the store classifies its products as "Smartphones" and "Laptops" + When I go to the create block page + And I fill the code with "intro" + And I fill the name with "Intro" + And I click on Add button in Content elements section + And I select "Taxons list" content element + And I add a taxons list content element with "Smartphones" and "Laptops" taxonomy + And I add it + Then I should be notified that the block has been created + And I should see newly created "Taxons list" content element in Content elements section + + @ui @javascript + Scenario: Adding block with two content elements + Given there is an existing media with names "Image 1" and "Image 2" + And the store classifies its products as "Smartphones" and "Laptops" + When I go to the create block page + And I fill the code with "intro" + And I fill the name with "Intro" + And I click on Add button in Content elements section + And I select "Taxons list" content element + And I add a taxons list content element with "Smartphones" and "Laptops" taxonomy + And I click on Add button in Content elements section + And I select "Multiple media" content element + And I add a multiple media content element with names "Image 1" and "Image 2" + And I add it + Then I should be notified that the block has been created + And I should see newly created "Taxons list" content element in Content elements section + And I should see newly created "Multiple media" content element in Content elements section + @ui Scenario: Trying to add block with existing code Given there is an existing block with "homepage_image" code @@ -43,7 +176,19 @@ Feature: Adding blocks @ui Scenario: Trying to add block with too long data When I go to the create block page - And I fill "Code, Name, Content" fields with 251 characters + And I fill "Code, Name" fields with 251 characters And I try to add it Then I should be notified that "Code, Name" fields are too long + @ui @javascript + Scenario: Adding block with content template + Given there is an existing content template named "Homepage" with "Block" type that contains "Textarea, Single media" content elements + When I go to the create block page + And I fill the code with "intro" + And I fill the name with "Intro" + And I select "Homepage" content template + And I confirm that I want to use this template + And I add it + Then I should be notified that the block has been created + And I should see newly created "Textarea" content element in Content elements section + And I should see newly created "Single media" content element in Content elements section diff --git a/features/admin/adding_section.feature b/features/admin/adding_collection.feature similarity index 53% rename from features/admin/adding_section.feature rename to features/admin/adding_collection.feature index 142cabcf7..6001473c2 100644 --- a/features/admin/adding_section.feature +++ b/features/admin/adding_collection.feature @@ -1,45 +1,45 @@ -@managing_sections -Feature: Adding new section +@managing_collections +Feature: Adding new collection In order to present more sophisticated content As an Administrator - I want to be able to add new CMS sections to the store + I want to be able to add new CMS collections to the store Background: Given the store operates on a single channel in "United States" And I am logged in as an administrator @ui - Scenario: Adding new section - When I go to the create section page + Scenario: Adding new collection + When I go to the create collection page And I fill the code with "blog" And I fill the name with "Blog" And I add it - Then I should be notified that new section has been created + Then I should be notified that new collection has been created @ui - Scenario: Trying to add a section with an existing code - Given there is an existing section with "blog" code - When I go to the create section page + Scenario: Trying to add a collection with an existing code + Given there is an existing collection with "blog" code + When I go to the create collection page And I fill the code with "blog" And I try to add it - Then I should be notified that there is already an existing section with provided code + Then I should be notified that there is already an existing collection with provided code @ui - Scenario: Trying to add section with blank data - When I go to the create section page + Scenario: Trying to add collection with blank data + When I go to the create collection page And I try to add it Then I should be notified that "Code, Name" fields cannot be blank @ui - Scenario: Trying to add section with too short data - When I go to the create section page + Scenario: Trying to add collection with too short data + When I go to the create collection page And I fill "Code, Name" fields with 1 character And I try to add it Then I should be notified that "Code, Name" fields are too short @ui - Scenario: Trying to add section with too long data - When I go to the create section page + Scenario: Trying to add collection with too long data + When I go to the create collection page And I fill "Code, Name" fields with 251 characters And I try to add it Then I should be notified that "Code, Name" fields are too long diff --git a/features/admin/adding_content_template.feature b/features/admin/adding_content_template.feature new file mode 100644 index 000000000..b6fdb411e --- /dev/null +++ b/features/admin/adding_content_template.feature @@ -0,0 +1,67 @@ +@managing_content_templates +Feature: Adding cms templates + In order to create templates + As an Administrator + I want to be able to add new templates + + Background: + Given the store operates on a single channel in "United States" + And I am logged in as an administrator + + @ui + Scenario: Creating template with type page + When I go to the create template page + And I fill the name with "Test template" + And I choose "Page" in Type field + And I add it + Then I should be notified that the template has been created + + @ui + Scenario: Creating template with type block + When I go to the create template page + And I fill the name with "Test template" + And I choose "Block" in Type field + And I add it + Then I should be notified that the template has been created + + @ui @javascript + Scenario: Creating template with content elements + When I go to the create template page + And I fill the name with "Test template" + And I choose "Page" in Type field + And I click on Add button in Content elements section + And I select "Textarea" content element + And I click on Add button in Content elements section + And I select "Single media" content element + And I add it + Then I should be notified that the template has been created + And I should see newly created "Textarea" content element in Content elements section + And I should see newly created "Single media" content element in Content elements section + + @ui + Scenario: Trying to add template with existing name + Given there is a template in the store with "New template" name + When I go to the create template page + And I fill the name with "New template" + And I try to add it + Then I should be notified that there is already existing template with provided name + + @ui + Scenario: Adding new template with blank data + When I go to the create template page + And I add it + And I should be notified that "Name" field cannot be blank + + @ui + Scenario: Trying to add a template with too short data + When I go to the create template page + And I fill the name with "X" + And I try to add it + Then I should be notified that "Name" field is too short + + @ui + Scenario: Trying to add a template with too long data + When I go to the create template page + And I fill "Name" field with 251 characters + And I try to add it + Then I should be notified that "Name" field is too long diff --git a/features/admin/adding_frequently_asked_question.feature b/features/admin/adding_frequently_asked_question.feature deleted file mode 100644 index 8dc1d4adc..000000000 --- a/features/admin/adding_frequently_asked_question.feature +++ /dev/null @@ -1,57 +0,0 @@ -@managing_frequently_asked_questions -Feature: Adding frequently asked question - In order to present frequently asked questions and answers in my store - As an Administrator - I want to be able to add new frequently asked question with answer - - Background: - Given I am logged in as an administrator - And the store operates on a single channel in "United States" - - @ui - Scenario: Adding frequently asked question - When I go to the create frequently asked question page - And I fill the code with "each_order_payment" - And I set the position to 1 - And I fill the question with "Should I pay for each order?" - And I set the answer to "Yes" - And I add it - Then I should be notified that a new frequently asked question has been created - - @ui @unstable - Scenario: Adding new frequently asked question with long data - When I go to the create frequently asked question page - And I fill the code with "whats_the_js_framework_of_the_week" - And I set the position to 1 - And I fill "Question, Answer" fields with 1500 characters - And I add it - Then I should be notified that a new frequently asked question has been created - - @ui - Scenario: Trying to add frequently asked question with existing code - Given there is an existing frequently asked question with "stupid_question" code - When I go to the create frequently asked question page - And I fill the code with "stupid_question" - And I try to add it - Then I should be notified that there is already an existing frequently asked question with provided code - - @ui - Scenario: Trying to add new frequently asked question with blank data - When I go to the create frequently asked question page - And I add it - Then I should be notified that "Code, Position, Question, Answer" fields cannot be blank - - @ui - Scenario: Trying to add new frequently asked question with too short data - When I go to the create frequently asked question page - And I fill "Question, Answer" fields with 1 character - And I add it - Then I should be notified that "Question, Answer" fields are too short - - @ui - Scenario: Trying to add new frequently asked question with existing position - Given there is an existing frequently asked question with 1 position - When I go to the create frequently asked question page - And I set the position to 1 - And I try to add it - Then I should be notified that there is already an existing frequently asked question with selected position diff --git a/features/admin/adding_media.feature b/features/admin/adding_media.feature index 4b518c67f..0ee4fe3c5 100644 --- a/features/admin/adding_media.feature +++ b/features/admin/adding_media.feature @@ -13,7 +13,6 @@ Feature: Adding new media When I go to the create media page And I fill the code with "image" And I fill the name with "Image" - And I fill the content with "Main image" And I upload the "aston_martin_db_11.jpg" image And I add it Then I should be notified that new media has been created diff --git a/features/admin/adding_page.feature b/features/admin/adding_page.feature index 042a1962c..552fe2072 100644 --- a/features/admin/adding_page.feature +++ b/features/admin/adding_page.feature @@ -14,7 +14,6 @@ Feature: Adding new page And I fill the code with "page_with_title" And I fill the slug with "page_with_title" And I fill the name with "page_with_title" - And I fill the content with "This is a page with a title set by us." And I add it Then I should be notified that the page has been created @@ -26,21 +25,6 @@ Feature: Adding new page And I fill the name with "Top 5 outfits for this summer" And I fill the meta keywords with "TOP 5 summer outfit trends, outfits, Ralph Lauren" And I fill the meta description with "This summer is going to be hot like a pizza." - And I fill the content with "The best looks, trends, inspiration, and shopping picks for summer style." - And I add it - Then I should be notified that the page has been created - - @ui @javascript - Scenario: Adding page with page image - And there is an existing "image" media with "aston-martin" code - When I go to the create page page - And I fill the code with "aston_martin_is_amazing_car" - And I fill the slug with "aston_martin_is_amazing_car" - And I fill the name with "Aston Martin is amazing car" - And I fill the meta keywords with "Aston Martin is amazing car" - And I fill the meta description with "Aston Martin is amazing car for this summer." - And I fill the content with "Aston Martin is amazing car for this summer. Buy it." - And I choose "aston-martin" media as image And I add it Then I should be notified that the page has been created @@ -56,14 +40,14 @@ Feature: Adding new page Scenario: Adding new page with blank data When I go to the create page page And I add it - And I should be notified that "Code, Name, Slug, Content" fields cannot be blank + And I should be notified that "Code, Name" fields cannot be blank @ui Scenario: Trying to add a page with too short data When I go to the create page page - And I fill "Code, Name, Slug, Meta keywords, Meta description, Content" fields with 1 character + And I fill "Code, Name, Slug, Meta keywords, Meta description" fields with 1 character And I try to add it - Then I should be notified that "Code, Name, Slug, Meta keywords, Meta description, Content" fields are too short + Then I should be notified that "Code, Name, Slug, Meta keywords, Meta description" fields are too short @ui @unstable Scenario: Trying to add a page with too long data @@ -74,12 +58,182 @@ Feature: Adding new page @ui @javascript Scenario: Adding page with sections - Given there are existing sections named "Blog" and "Homepage" + Given there are existing collections named "Blog" and "Homepage" When I go to the create page page And I fill the code with "best_day_ever" - And I add "Blog" and "Homepage" sections to it + And I add "Blog" and "Homepage" collections to it And I fill the slug with "Slug" And I fill the name with "Best day ever" - And I fill the content with "This was the best day of my life" And I add it Then I should be notified that the page has been created + + @ui @javascript + Scenario: Adding page with textarea content element + When I go to the create page page + And I fill the code with "my_page" + And I fill the slug with "my_page" + And I fill the name with "My page" + And I click on Add button in Content elements section + And I select "Textarea" content element + And I add a textarea content element with "Welcome to our store" content + And I add it + Then I should be notified that the page has been created + And I should see newly created "Textarea" content element in Content elements section + + @ui @javascript + Scenario: Adding page with single media content element + Given there is an existing media with "image_1" code and name "Image 1" + When I go to the create page page + And I fill the code with "my_page" + And I fill the slug with "my_page" + And I fill the name with "My page" + And I click on Add button in Content elements section + And I select "Single media" content element + And I add a single media content element with name "Image 1" + And I add it + Then I should be notified that the page has been created + And I should see newly created "Single media" content element in Content elements section + + @ui @javascript + Scenario: Adding page with multiple media content element + Given there is an existing media with names "Image 1" and "Image 2" + When I go to the create page page + And I fill the code with "my_page" + And I fill the slug with "my_page" + And I fill the name with "My page" + And I click on Add button in Content elements section + And I select "Multiple media" content element + And I add a multiple media content element with names "Image 1" and "Image 2" + And I add it + Then I should be notified that the page has been created + And I should see newly created "Multiple media" content element in Content elements section + + @ui @javascript + Scenario: Adding page with heading content element + When I go to the create page page + And I fill the code with "my_page" + And I fill the slug with "my_page" + And I fill the name with "My page" + And I click on Add button in Content elements section + And I select "Heading" content element + And I add a heading content element with type "H3" and "Welcome to our store" content + And I add it + Then I should be notified that the page has been created + And I should see newly created "Heading" content element in Content elements section + + @ui @javascript + Scenario: Adding page with products carousel content element + Given the store has "iPhone 8" and "iPhone X" products + When I go to the create page page + And I fill the code with "my_page" + And I fill the slug with "my_page" + And I fill the name with "My page" + And I click on Add button in Content elements section + And I select "Products carousel" content element + And I add a products carousel content element with "iPhone 8" and "iPhone X" products + And I add it + Then I should be notified that the page has been created + And I should see newly created "Products carousel" content element in Content elements section + + @ui @javascript + Scenario: Adding page with products carousel by taxon content element + Given the store has "Smartphones" taxonomy + When I go to the create page page + And I fill the code with "my_page" + And I fill the slug with "my_page" + And I fill the name with "My page" + And I click on Add button in Content elements section + And I select "Products carousel by Taxon" content element + And I add a products carousel by taxon content element with "Smartphones" taxonomy + And I add it + Then I should be notified that the page has been created + And I should see newly created "Products carousel by Taxon" content element in Content elements section + + @ui @javascript + Scenario: Adding page with products grid content element + Given the store has "iPhone 8" and "iPhone X" products + When I go to the create page page + And I fill the code with "my_page" + And I fill the slug with "my_page" + And I fill the name with "My page" + And I click on Add button in Content elements section + And I select "Products grid" content element + And I add a products grid content element with "iPhone 8" and "iPhone X" products + And I add it + Then I should be notified that the page has been created + And I should see newly created "Products grid" content element in Content elements section + + @ui @javascript + Scenario: Adding page with products grid by taxon content element + Given the store has "Smartphones" taxonomy + When I go to the create page page + And I fill the code with "my_page" + And I fill the slug with "my_page" + And I fill the name with "My page" + And I click on Add button in Content elements section + And I select "Products grid by Taxon" content element + And I add a products grid by taxon content element with "Smartphones" taxonomy + And I add it + Then I should be notified that the page has been created + And I should see newly created "Products grid by Taxon" content element in Content elements section + + @ui @javascript + Scenario: Adding page with taxons list content element + Given the store classifies its products as "Smartphones" and "Laptops" + When I go to the create page page + And I fill the code with "my_page" + And I fill the slug with "my_page" + And I fill the name with "My page" + And I click on Add button in Content elements section + And I select "Taxons list" content element + And I add a taxons list content element with "Smartphones" and "Laptops" taxonomy + And I add it + Then I should be notified that the page has been created + And I should see newly created "Taxons list" content element in Content elements section + + @ui @javascript + Scenario: Adding page with two content elements + Given there is an existing media with names "Image 1" and "Image 2" + When I go to the create page page + And I fill the code with "my_page" + And I fill the slug with "my_page" + And I fill the name with "My page" + And I click on Add button in Content elements section + And I select "Single media" content element + And I add a single media content element with name "Image 1" + And I click on Add button in Content elements section + And I select "Multiple media" content element + And I add a multiple media content element with names "Image 1" and "Image 2" + And I add it + Then I should be notified that the page has been created + And I should see newly created "Single media" content element in Content elements section + And I should see newly created "Multiple media" content element in Content elements section + + @ui @javascript + Scenario: Adding page with content template + Given there is an existing content template named "Homepage" with "Page" type that contains "Textarea, Single media" content elements + When I go to the create page page + And I fill the code with "my_page" + And I fill the slug with "my_page" + And I fill the name with "My page" + And I select "Homepage" content template + And I confirm that I want to use this template + And I add it + Then I should be notified that the page has been created + And I should see newly created "Textarea" content element in Content elements section + And I should see newly created "Single media" content element in Content elements section + + @ui @javascript + Scenario: Adding page with with a custom template + Given there is an existing template with "@SyliusCmsPlugin/Shop/Page/custom.html.twig" value + When I go to the create page page + And I fill the code with "my_page" + And I fill the slug with "my-page" + And I fill the name with "My page" + And I select "United States" channel + And I select "@SyliusCmsPlugin/Shop/Page/custom.html.twig" template + And I add it + Then I should be notified that the page has been created + And I go to the "my-page" page + And The rendered page should contain custom layout code + diff --git a/features/admin/managing_blocks.feature b/features/admin/managing_blocks.feature index 22c4b0a44..78aaf6d43 100644 --- a/features/admin/managing_blocks.feature +++ b/features/admin/managing_blocks.feature @@ -18,16 +18,37 @@ Feature: Managing cms blocks @ui @javascript Scenario: Updating block - Given there is a block with "store_phone_number" code and "123456789" content + Given there is a block with "store_phone_number" code When I go to the update "store_phone_number" block page - And I fill the content with "987654321" + And I fill the name with "Store phone number" if the name field is empty And I update it Then I should be notified that the block has been successfully updated + @ui + Scenario: Updating block textarea content element + Given there is a block with "store_phone_number" code and "Textarea" content element + When I go to the update "store_phone_number" block page + And I fill the name with "Store phone number" if the name field is empty + And I change textarea content element value to "New content" + And I update it + Then I should be notified that the block has been successfully updated + And I should see "New content" in the textarea content element + + @ui @javascript + Scenario: Deleting content element in block + Given there is a block with "store_phone_number" code and "Textarea" content element + When I go to the update "store_phone_number" block page + And I fill the name with "Store phone number" if the name field is empty + And I delete the content element + And I update it + Then I should be notified that the block has been successfully updated + And I should not see "Textarea" content element in the Content elements section + @ui Scenario: Disabling block - Given there is an existing block with "bitbag_quote" code - When I go to the update "bitbag_quote" block page + Given there is an existing block with "sylius_quote" code + When I go to the update "sylius_quote" block page + And I fill the name with "BitBag quote" if the name field is empty And I disable it And I update it Then I should be notified that the block has been successfully updated diff --git a/features/admin/managing_collections.feature b/features/admin/managing_collections.feature new file mode 100644 index 000000000..45f15b18f --- /dev/null +++ b/features/admin/managing_collections.feature @@ -0,0 +1,23 @@ +@managing_collections +Feature: Managing collections + In order to present the content in specific collections in my store + As an Administrator + I want to be able to edit and remove existing collections + + Background: + Given the store operates on a single channel in "United States" + Given I am logged in as an administrator + + @ui + Scenario: Deleting collection + Given there is a collection in the store + When I go to the collections page + And I delete this collection + Then I should be notified that the collection has been deleted + And I should see empty list of collections + + @ui + Scenario: Seeing disabled code field while editing a collection + Given there is a collection in the store + When I want to edit this collection + Then the code field should be disabled diff --git a/features/admin/managing_content_templates.feature b/features/admin/managing_content_templates.feature new file mode 100644 index 000000000..7da7d5ae6 --- /dev/null +++ b/features/admin/managing_content_templates.feature @@ -0,0 +1,35 @@ +@managing_content_templates +Feature: Managing cms templates + In order to manage existing templates + As an Administrator + I want to be able to edit and remove existing templates + + Background: + Given the store operates on a single channel in "United States" + And I am logged in as an administrator + + @ui + Scenario: Deleting template + Given there is a template in the store with "Test template" name + When I go to the templates page + And I delete this template + Then I should be notified that the template has been deleted + And I should see empty list of templates + + @ui + Scenario: Updating template + Given there is a template in the store with "Test template" name + When I go to the update "Test template" template page + And I fill the name with "New template" + And I update it + Then I should be notified that the template has been successfully updated + + @ui @javascript + Scenario: Updating template with content elements + Given there is a template in the store with "Test template" name + And there are "Textarea" and "Single media" content elements in this template + When I go to the update "Test template" template page + And I delete "Textarea" content element + And I update it + Then I should be notified that the template has been successfully updated + And I should see only "Single media" content element in Content elements section diff --git a/features/admin/managing_frequently_asked_questions.feature b/features/admin/managing_frequently_asked_questions.feature deleted file mode 100644 index 393be7045..000000000 --- a/features/admin/managing_frequently_asked_questions.feature +++ /dev/null @@ -1,23 +0,0 @@ -@managing_frequently_asked_questions -Feature: Managing frequently asked questions - In order to present frequently asked questions and answers in my store - As an Administrator - I want to be able update and remove existing frequently asked questions - - Background: - Given I am logged in as an administrator - And the store operates on a single channel in "United States" - - @ui - Scenario: Removing frequently asked question - Given the store has a frequently asked question - When I go to the frequently asked questions page - And I delete this frequently asked question - Then I should be notified that the frequently asked question has been deleted - And I should see empty list of frequently asked questions - - @ui - Scenario: Seeing disabled code field while editing frequently asked question - Given the store has a frequently asked question - When I want to edit this frequently asked question - Then the code field should be disabled diff --git a/features/admin/managing_pages.feature b/features/admin/managing_pages.feature index f66310f29..6e02852b2 100644 --- a/features/admin/managing_pages.feature +++ b/features/admin/managing_pages.feature @@ -11,7 +11,7 @@ Feature: Managing cms pages @ui Scenario: Deleting page Given there is a page in the store - When I go to the pages page + When I go to the cms pages page And I delete this page Then I should be notified that the page has been deleted And I should see empty list of pages @@ -26,16 +26,25 @@ Feature: Managing cms pages Scenario: Updating page Given there is a page in the store When I want to edit this page - And I fill "Code, Content" fields + And I fill "Code, Name" fields And I update it Then I should be notified that the page was updated @ui - Scenario: Updating page with image - Given there is a page in the store - And there is an existing "image" media with "aston-martin" code + Scenario: Updating page with textarea content element + Given there is a page in the store with "Textarea" content element + When I want to edit this page + And I fill "Code, Name" fields + And I change textarea content element value to "New content" + And I update it + Then I should be notified that the page was updated + And I should see "New content" in the textarea content element + + @ui @javascript + Scenario: Deleting content element in page + Given there is a page in the store with "Textarea" content element When I want to edit this page - And I fill "Code, Content" fields - And I choose "aston-martin" media as image + And I delete the content element And I update it Then I should be notified that the page was updated + And I should not see "Textarea" content element in the Content elements section diff --git a/features/admin/managing_sections.feature b/features/admin/managing_sections.feature deleted file mode 100644 index ae881ce0b..000000000 --- a/features/admin/managing_sections.feature +++ /dev/null @@ -1,23 +0,0 @@ -@managing_sections -Feature: Managing sections - In order to present the content in specific sections in my store - As an Administrator - I want to be able to edit and remove existing sections - - Background: - Given the store operates on a single channel in "United States" - Given I am logged in as an administrator - - @ui - Scenario: Deleting section - Given there is a section in the store - When I go to the sections page - And I delete this section - Then I should be notified that the section has been deleted - And I should see empty list of sections - - @ui - Scenario: Seeing disabled code field while editing a section - Given there is a section in the store - When I want to edit this section - Then the code field should be disabled diff --git a/features/api/viewing_blocks.feature b/features/api/viewing_blocks.feature index de2888844..cb9bc508c 100644 --- a/features/api/viewing_blocks.feature +++ b/features/api/viewing_blocks.feature @@ -7,7 +7,7 @@ Feature: Getting data from cms blocks Background: Given the store operates on a single channel in "United States" And there is a block in the store - And there is a block with "block-1" code and "Hi there!" content + And there is a block with "block-1" code @api Scenario: Browsing blocks @@ -19,5 +19,4 @@ Feature: Getting data from cms blocks Scenario: Displaying block Given I view block with code "block-1" Then I should see block name - And I should see block content diff --git a/features/api/viewing_collections.feature b/features/api/viewing_collections.feature new file mode 100644 index 000000000..f3ab234ea --- /dev/null +++ b/features/api/viewing_collections.feature @@ -0,0 +1,21 @@ +@shop_collections +Feature: Getting data from cms collections + In order to present dynamic content in my store + As an API user + I want to be able to display collections + + Background: + Given the store operates on a single channel in "United States" + And there is a collection in the store + And there is an existing collection with "collection-1" code + + @api + Scenario: Browsing collections + Given I want to browse collections + Then I should see 2 collections in the list + And I should see collection with code "collection-1" + + @api + Scenario: Displaying collection + Given I view collection with code "collection-1" + Then I should see collection name diff --git a/features/api/viewing_frequently_asked_questions.feature b/features/api/viewing_frequently_asked_questions.feature deleted file mode 100644 index 6a7ab7c7c..000000000 --- a/features/api/viewing_frequently_asked_questions.feature +++ /dev/null @@ -1,23 +0,0 @@ -@shop_frequently_asked_questions -Feature: Getting data from cms faq - In order to present dynamic content in my store - As an API user - I want to be able to display FAQ - - Background: - Given the store operates on a single channel in "United States" - And there are 10 FAQs in the store - And there is an existing frequently asked question with "faq-1" code - - @api - Scenario: Browsing FAQs - Given I want to browse FAQs - Then I should see 11 questions in the list - And I should see the "faq-1" question - - @api - Scenario: Displaying question - Given I view faq with code "faq-1" - Then I should see question with random text - And I should see answer with random text - diff --git a/features/api/viewing_pages.feature b/features/api/viewing_pages.feature index 7eb5c23d3..9a1027405 100644 --- a/features/api/viewing_pages.feature +++ b/features/api/viewing_pages.feature @@ -9,13 +9,11 @@ Feature: Getting data from cms pages And there are 10 pages in the store And the store has "iPhone 8" and "iPhone X" products And there is a page in the store - And this page has these products associated with it - And there are existing sections named "Blog" and "General" - And this page has these sections associated with it + And there are existing collections named "Blog" and "General" + And this page has these collections associated with it And this page has "About us" name And this page has "about" code And this page also has "about-us" slug - And this page also has "We are the best!" content @api Scenario: Browsing defined pages @@ -25,6 +23,5 @@ Feature: Getting data from cms pages @api Scenario: Viewing a detailed page - Given I view page with code "about" + When I view page with code "about" Then I should see the page name "About us" - And I should see the page content "We are the best!" diff --git a/features/api/viewing_sections.feature b/features/api/viewing_sections.feature deleted file mode 100644 index 9362fb35b..000000000 --- a/features/api/viewing_sections.feature +++ /dev/null @@ -1,21 +0,0 @@ -@shop_sections -Feature: Getting data from cms sections - In order to present dynamic content in my store - As an API user - I want to be able to display sections - - Background: - Given the store operates on a single channel in "United States" - And there is a section in the store - And there is an existing section with "section-1" code - - @api - Scenario: Browsing sections - Given I want to browse sections - Then I should see 2 sections in the list - And I should see section with code "section-1" - - @api - Scenario: Displaying section - Given I view section with code "section-1" - Then I should see section name diff --git a/features/shop/browsing_frequently_asked_questions.feature b/features/shop/browsing_frequently_asked_questions.feature deleted file mode 100644 index c1fcb4ed0..000000000 --- a/features/shop/browsing_frequently_asked_questions.feature +++ /dev/null @@ -1,14 +0,0 @@ -@shop_frequently_asked_questions -Feature: Browsing FAQs - In order to get answer to the my questions ASAP - As a Customer - I want to browse through all FAQs - - Background: - Given the store operates on a single channel in "United States" - - @ui - Scenario: Browsing FAQs - Given there are 10 FAQs in the store - When I go to the frequently asked questions list page - Then I should see 10 FAQs ordered by position diff --git a/features/shop/browsing_pages_by_section.feature b/features/shop/browsing_pages_by_section.feature deleted file mode 100644 index 8672b3971..000000000 --- a/features/shop/browsing_pages_by_section.feature +++ /dev/null @@ -1,16 +0,0 @@ -@shop_pages -Feature: Browsing pages by section - In order to read content like articles or blog posts - As a Customer - I want to browse pages by specific sections - - Background: - Given the store operates on a single channel in "United States" - - @ui - Scenario: Browsing pages by section - Given there is a "Blog" section in the store - And there are 15 pages in the store - And these pages have this section associated with it - When I go to the section pages list for the "blog" section - Then I should see 10 pages on the page diff --git a/features/shop/displaying_homepage_block.feature b/features/shop/displaying_homepage_block.feature deleted file mode 100644 index b269cd4f5..000000000 --- a/features/shop/displaying_homepage_block.feature +++ /dev/null @@ -1,14 +0,0 @@ -@shop_blocks -Feature: Displaying blocks - In order to buy more items in the store - As a Customer - I want to display content blocks on the homepage - - Background: - Given the store operates on a single channel in "United States" - - @ui - Scenario: Displaying homepage blocks - Given there is a block with "homepage_intro" code and "Hello world!" content - When I go to the homepage - And I want to see a text block with "Hello world!" content diff --git a/features/shop/displaying_media.feature b/features/shop/displaying_media.feature deleted file mode 100644 index 91c16f6e1..000000000 --- a/features/shop/displaying_media.feature +++ /dev/null @@ -1,17 +0,0 @@ -@shop_media -Feature: Displaying media - - Background: - Given the store operates on a single channel in "United States" - - @ui - Scenario: Displaying media - And there is an existing "image" media with "homepage_pdf" code - When I go to the homepage - And I want to see a media with code "homepage_pdf" - - @ui - Scenario: Displaying media no standard template - And there is an existing "image" media with "media_with_parameters" code - When I go to the homepage - And I want to see a media with code "media_with_parameters" diff --git a/features/shop/displaying_page.feature b/features/shop/displaying_page.feature index 2edb83b53..b42dd8b82 100644 --- a/features/shop/displaying_page.feature +++ b/features/shop/displaying_page.feature @@ -11,43 +11,13 @@ Feature: Displaying pages Scenario: Displaying page Given there is a page in the store And the store has "iPhone 8" and "iPhone X" products - And this page has these products associated with it - And there are existing sections named "Blog" and "General" - And this page has these sections associated with it + And there are existing collections named "Blog" and "General" + And this page has these collections associated with it And this page has "About us" name And this page also has "about-us" slug - And this page also has "Lorem ipsum" content When I go to the "about-us" page Then I should see a page with "About us" name - And I should also see "Lorem ipsum" content - And I should also see "iPhone 8" and "iPhone X" products associated with this page - And I should also see "Blog" and "General" sections associated with this page - - @ui - Scenario: Displaying page link - Given there is a page in the store - And this page has "about" code - And this page has "About" name - When I go to this page - Then I should see the "About" page link in the header - - @ui @javascript - Scenario: Displaying page with image - Given there is a page in the store - And the store has "iPhone 8" and "iPhone X" products - And this page has these products associated with it - And there are existing sections named "Blog" and "General" - And this page has these sections associated with it - And this page has "About us" name - And this page also has "about-us" slug - And this page also has "Lorem ipsum" content - And this page also has "homepage_main.jpeg" image - When I go to the "about-us" page - Then I should see a page with "About us" name - And I should also see "Lorem ipsum" content - And I should also see "iPhone 8" and "iPhone X" products associated with this page - And I should also see "Blog" and "General" sections associated with this page - And I should also see page image + And I should also see "Blog" and "General" collections associated with this page @ui @javascript @title Scenario: Displaying page with title @@ -55,7 +25,6 @@ Feature: Displaying pages And this page has "some_page_with_title" code And this page has "some_page_with_title" name And this page also has "some_page_with_title" slug - And this page also has "Lorem ipsum" content And this page also has "title" title When I go to this page Then I should see page title "title" @@ -66,6 +35,5 @@ Feature: Displaying pages And this page has "title" code And this page has "Title" name And this page also has "title" slug - And this page also has "Lorem ipsum" content When I go to this page Then I should see page title "Sylius" diff --git a/phpspec.yml.dist b/phpspec.yml.dist index 510348697..767848352 100755 --- a/phpspec.yml.dist +++ b/phpspec.yml.dist @@ -1,4 +1,4 @@ suites: main: - namespace: BitBag\SyliusCmsPlugin - psr4_prefix: BitBag\SyliusCmsPlugin + namespace: Sylius\CmsPlugin + psr4_prefix: Sylius\CmsPlugin diff --git a/phpunit.xml.dist b/phpunit.xml.dist index aa1bc1a44..29597412f 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -6,13 +6,13 @@ colors="true" bootstrap="tests/Application/config/bootstrap.php">Hello World
')->willReturn('Hello World
'); + + $this->render($page)->shouldReturn('Hello World
'); + } + + public function it_skips_content_element_with_non_matching_locale( + BlockInterface $block, + ContentConfigurationInterface $contentElement, + LocaleContextInterface $localeContext, + ContentParserInterface $contentParser, + ): void { + $block->getContentElements()->willReturn(new ArrayCollection([$contentElement])); + $localeContext->getLocaleCode()->willReturn('en_US'); + $contentElement->getLocale()->willReturn('fr_FR'); + + $contentParser->parse('')->willReturn(''); + + $this->render($block)->shouldReturn(''); + } + + public function it_renders_only_supported_content_elements( + BlockInterface $block, + ContentConfigurationInterface $supportedElement, + ContentConfigurationInterface $unsupportedElement, + LocaleContextInterface $localeContext, + ContentElementRendererInterface $renderer, + ContentParserInterface $contentParser, + ): void { + $block->getContentElements()->willReturn(new ArrayCollection([$supportedElement->getWrappedObject(), $unsupportedElement->getWrappedObject()])); + $localeContext->getLocaleCode()->willReturn('en_US'); + $supportedElement->getLocale()->willReturn('en_US'); + $unsupportedElement->getLocale()->willReturn('en_US'); + + $renderer->supports($supportedElement)->willReturn(true); + $renderer->render($supportedElement)->willReturn('<p>Supported</p>'); + $renderer->supports($unsupportedElement)->willReturn(false); + + $contentParser->parse('Supported
')->willReturn('Supported
'); + + $this->render($block)->shouldReturn('Supported
'); + } +} diff --git a/spec/Renderer/PageLinkRendererSpec.php b/spec/Renderer/PageLinkRendererSpec.php new file mode 100644 index 000000000..f7d3debf6 --- /dev/null +++ b/spec/Renderer/PageLinkRendererSpec.php @@ -0,0 +1,82 @@ +beConstructedWith($urlGenerator, $twig); + } + + public function it_is_initializable(): void + { + $this->shouldHaveType(PageLinkRenderer::class); + } + + public function it_implements_page_link_renderer_interface(): void + { + $this->shouldImplement(PageLinkRendererInterface::class); + } + + public function it_renders_page_link_with_default_template( + UrlGeneratorInterface $urlGenerator, + Environment $twig, + PageInterface $page, + ): void { + $page->getSlug()->willReturn('page-slug'); + $page->getName()->willReturn('Page Name'); + + $urlGenerator->generate( + 'sylius_cms_shop_page_show', + ['slug' => 'page-slug'], + UrlGeneratorInterface::ABSOLUTE_URL, + )->willReturn('http://example.com/page-slug'); + + $twig->render( + '@SyliusCmsPlugin/Shop/Page/link.html.twig', + [ + 'link' => 'http://example.com/page-slug', + 'name' => 'Page Name', + ], + )->willReturn('Page Name'); + + $this->render($page)->shouldReturn('Page Name'); + } + + public function it_renders_page_link_with_custom_template( + UrlGeneratorInterface $urlGenerator, + Environment $twig, + PageInterface $page, + ): void { + $page->getSlug()->willReturn('page-slug'); + $page->getName()->willReturn('Page Name'); + + $urlGenerator->generate( + 'sylius_cms_shop_page_show', + ['slug' => 'page-slug'], + UrlGeneratorInterface::ABSOLUTE_URL, + )->willReturn('http://example.com/page-slug'); + + $twig->render( + 'custom_template.html.twig', + [ + 'link' => 'http://example.com/page-slug', + 'name' => 'Page Name', + ], + )->willReturn('Page Name'); + + $this->render($page, 'custom_template.html.twig')->shouldReturn('Page Name'); + } +} diff --git a/spec/Resolver/BlockResourceResolverSpec.php b/spec/Resolver/BlockResourceResolverSpec.php index 1f9af7155..b87eb2060 100755 --- a/spec/Resolver/BlockResourceResolverSpec.php +++ b/spec/Resolver/BlockResourceResolverSpec.php @@ -1,32 +1,30 @@ beConstructedWith($blockRepository, $logger, $channelContext); + $this->beConstructedWith($blockRepository, $logger, $channelContext, $localeContext, $localeRepository); } public function it_is_initializable(): void @@ -39,32 +37,11 @@ public function it_implements_block_resource_resolver_interface(): void $this->shouldHaveType(BlockResourceResolverInterface::class); } - public function it_logs_warning_if_block_was_not_found( - BlockRepositoryInterface $blockRepository, - LoggerInterface $logger, - ChannelContextInterface $channelContext, - ChannelInterface $channel - ) { - $channel->getCode()->willReturn('WEB'); - $channelContext->getChannel()->willReturn($channel); - $blockRepository->findEnabledByCode('homepage_banner', 'WEB')->willReturn(null); - - $logger - ->warning(sprintf( - 'Block with "%s" code was not found in the database.', - 'homepage_banner' - )) - ->shouldBeCalled() - ; - - $this->findOrLog('homepage_banner'); - } - public function it_returns_block_if_found_in_database( BlockRepositoryInterface $blockRepository, BlockInterface $block, ChannelContextInterface $channelContext, - ChannelInterface $channel + ChannelInterface $channel, ) { $channel->getCode()->willReturn('WEB'); $channelContext->getChannel()->willReturn($channel); diff --git a/spec/Resolver/ImporterChannelsResolverSpec.php b/spec/Resolver/Importer/ImporterChannelsResolverSpec.php similarity index 67% rename from spec/Resolver/ImporterChannelsResolverSpec.php rename to spec/Resolver/Importer/ImporterChannelsResolverSpec.php index c4ac903af..38cd5d130 100644 --- a/spec/Resolver/ImporterChannelsResolverSpec.php +++ b/spec/Resolver/Importer/ImporterChannelsResolverSpec.php @@ -1,19 +1,13 @@ beConstructedWith($collectionsAssigner); + } + + public function it_is_initializable() + { + $this->shouldHaveType(ImporterCollectionsResolver::class); + } + + public function it_resolves_collections_for_collectionable_entity( + CollectionsAssignerInterface $collectionsAssigner, + CollectibleInterface $collectionable, + ) { + $collectionsRow = 'collection1, collection2, collection3'; + $collectionsCodes = ['collection1', 'collection2', 'collection3']; + + $collectionsAssigner->assign($collectionable, $collectionsCodes)->shouldBeCalled(); + + $this->resolve($collectionable, $collectionsRow); + } + + public function it_skips_resolution_when_collections_row_is_null( + CollectionsAssignerInterface $collectionsAssigner, + CollectibleInterface $collectionable, + ) { + $collectionsRow = null; + + $collectionsAssigner->assign($collectionable, Argument::any())->shouldNotBeCalled(); + + $this->resolve($collectionable, $collectionsRow); + } +} diff --git a/spec/Resolver/Importer/ImporterLocalesResolverSpec.php b/spec/Resolver/Importer/ImporterLocalesResolverSpec.php new file mode 100644 index 000000000..83d2ca4c7 --- /dev/null +++ b/spec/Resolver/Importer/ImporterLocalesResolverSpec.php @@ -0,0 +1,42 @@ +beConstructedWith($localesAssigner); + } + + public function it_is_initializable() + { + $this->shouldHaveType(ImporterLocalesResolver::class); + } + + public function it_resolves_locales_for_locale_aware_entity( + LocalesAssignerInterface $localesAssigner, + LocaleAwareInterface $localesAware, + ) { + $localesRow = 'en_US, fr_FR'; + $localesAssigner->assign($localesAware, ['en_US', 'fr_FR'])->shouldBeCalled(); + + $this->resolve($localesAware, $localesRow); + } + + public function it_does_not_assign_locales_when_locales_row_is_empty( + LocalesAssignerInterface $localesAssigner, + LocaleAwareInterface $localesAware, + ) { + $localesAssigner->assign($localesAware, [])->shouldNotBeCalled(); + + $this->resolve($localesAware, ''); + } +} diff --git a/spec/Resolver/Importer/ImporterProductsInTaxonsResolverSpec.php b/spec/Resolver/Importer/ImporterProductsInTaxonsResolverSpec.php new file mode 100644 index 000000000..77fd7b8d5 --- /dev/null +++ b/spec/Resolver/Importer/ImporterProductsInTaxonsResolverSpec.php @@ -0,0 +1,42 @@ +beConstructedWith($productsInTaxonsAssigner); + } + + public function it_is_initializable() + { + $this->shouldHaveType(ImporterProductsInTaxonsResolver::class); + } + + public function it_resolves_taxons_for_products_in_taxons_aware_entity( + ProductsInTaxonsAssignerInterface $productsInTaxonsAssigner, + ProductsInTaxonsAwareInterface $productsInTaxonsAware, + ) { + $taxonsRow = 'taxon_code_1, taxon_code_2'; + $productsInTaxonsAssigner->assign($productsInTaxonsAware, ['taxon_code_1', 'taxon_code_2'])->shouldBeCalled(); + + $this->resolve($productsInTaxonsAware, $taxonsRow); + } + + public function it_does_not_assign_taxons_when_taxons_row_is_null( + ProductsInTaxonsAssignerInterface $productsInTaxonsAssigner, + ProductsInTaxonsAwareInterface $productsInTaxonsAware, + ) { + $productsInTaxonsAssigner->assign($productsInTaxonsAware, [])->shouldNotBeCalled(); + + $this->resolve($productsInTaxonsAware, null); + } +} diff --git a/spec/Resolver/ImporterProductsResolverSpec.php b/spec/Resolver/Importer/ImporterProductsResolverSpec.php similarity index 63% rename from spec/Resolver/ImporterProductsResolverSpec.php rename to spec/Resolver/Importer/ImporterProductsResolverSpec.php index 3b3bd5b96..5649e82f2 100644 --- a/spec/Resolver/ImporterProductsResolverSpec.php +++ b/spec/Resolver/Importer/ImporterProductsResolverSpec.php @@ -1,20 +1,14 @@ beConstructedWith($taxonsAssigner); + } + + public function it_is_initializable() + { + $this->shouldHaveType(ImporterTaxonsResolver::class); + } + + public function it_resolves_taxons_for_taxon_aware_entity( + TaxonsAssignerInterface $taxonsAssigner, + TaxonAwareInterface $taxonsAware, + ) { + $taxonsRow = 'taxon_code_1, taxon_code_2'; + $taxonsAssigner->assign($taxonsAware, ['taxon_code_1', 'taxon_code_2'])->shouldBeCalled(); + + $this->resolve($taxonsAware, $taxonsRow); + } + + public function it_does_not_assign_taxons_when_taxons_row_is_null( + TaxonsAssignerInterface $taxonsAssigner, + TaxonAwareInterface $taxonsAware, + ) { + $taxonsAssigner->assign($taxonsAware, [])->shouldNotBeCalled(); + + $this->resolve($taxonsAware, null); + } +} diff --git a/spec/Resolver/ImporterSectionsResolverSpec.php b/spec/Resolver/ImporterSectionsResolverSpec.php deleted file mode 100644 index 83cc8dd11..000000000 --- a/spec/Resolver/ImporterSectionsResolverSpec.php +++ /dev/null @@ -1,53 +0,0 @@ -beConstructedWith($sectionsAssigner); - } - - public function it_is_initializable() - { - $this->shouldHaveType(ImporterSectionsResolver::class); - } - - public function it_resolves_sections_for_sectionable_entity( - SectionsAssignerInterface $sectionsAssigner, - SectionableInterface $sectionable - ) { - $sectionsRow = 'section1, section2, section3'; - $sectionCodes = ['section1', 'section2', 'section3']; - - $sectionsAssigner->assign($sectionable, $sectionCodes)->shouldBeCalled(); - - $this->resolve($sectionable, $sectionsRow); - } - - public function it_skips_resolution_when_sections_row_is_null( - SectionsAssignerInterface $sectionsAssigner, - SectionableInterface $sectionable - ) { - $sectionsRow = null; - - $sectionsAssigner->assign($sectionable, Argument::any())->shouldNotBeCalled(); - - $this->resolve($sectionable, $sectionsRow); - } -} diff --git a/spec/Resolver/MediaProviderResolverSpec.php b/spec/Resolver/MediaProviderResolverSpec.php index 5010793c9..d57e7b57e 100644 --- a/spec/Resolver/MediaProviderResolverSpec.php +++ b/spec/Resolver/MediaProviderResolverSpec.php @@ -1,20 +1,14 @@ getType()->willReturn($mediaType); @@ -45,7 +39,7 @@ public function it_resolves_provider_for_media( } public function it_throws_exception_when_media_type_is_null( - MediaInterface $media + MediaInterface $media, ) { $media->getType()->willReturn(null); diff --git a/spec/Resolver/MediaResourceResolverSpec.php b/spec/Resolver/MediaResourceResolverSpec.php index a3fb1a139..fc744b63b 100644 --- a/spec/Resolver/MediaResourceResolverSpec.php +++ b/spec/Resolver/MediaResourceResolverSpec.php @@ -1,34 +1,26 @@ beConstructedWith($mediaRepository, $localeContext, $channelContext, $logger); + ) { + $this->beConstructedWith($mediaRepository, $channelContext, $logger); } public function it_is_initializable(): void @@ -43,40 +35,34 @@ public function it_implements_media_resource_resolver_interface(): void public function it_returns_media_when_found( MediaRepositoryInterface $mediaRepository, - LocaleContextInterface $localeContext, ChannelContextInterface $channelContext, MediaInterface $media, ChannelInterface $channel, - ) { + ) { $code = 'media_code'; - $localeCode = 'en_US'; $channelCode = 'ecommerce'; $channelContext->getChannel()->willReturn($channel); $channel->getCode()->willReturn($channelCode); - $localeContext->getLocaleCode()->willReturn($localeCode); - $mediaRepository->findOneEnabledByCode($code, $localeCode, $channelCode)->willReturn($media); + $mediaRepository->findOneEnabledByCode($code, $channelCode)->willReturn($media); $this->findOrLog($code)->shouldReturn($media); } public function it_logs_warning_and_returns_null_when_media_not_found( MediaRepositoryInterface $mediaRepository, - LocaleContextInterface $localeContext, ChannelContextInterface $channelContext, LoggerInterface $logger, ChannelInterface $channel, - ) { + ) { $code = 'non_existing_code'; - $localeCode = 'en_US'; $channelCode = 'ecommerce'; $channelContext->getChannel()->willReturn($channel); $channel->getCode()->willReturn($channelCode); - $localeContext->getLocaleCode()->willReturn($localeCode); - $mediaRepository->findOneEnabledByCode($code, $localeCode, $channelCode)->willReturn(null); + $mediaRepository->findOneEnabledByCode($code, $channelCode)->willReturn(null); $logger->warning(sprintf('Media with "%s" code was not found in the database.', $code))->shouldBeCalled(); diff --git a/spec/Resolver/PageResourceResolverSpec.php b/spec/Resolver/PageResourceResolverSpec.php index 903e409ef..61f7920c0 100755 --- a/spec/Resolver/PageResourceResolverSpec.php +++ b/spec/Resolver/PageResourceResolverSpec.php @@ -1,31 +1,23 @@ beConstructedWith($pageRepository, $localeContext, $logger); + $this->beConstructedWith($pageRepository, $logger); } public function it_is_initializable(): void @@ -40,16 +32,14 @@ public function it_implements_page_resource_resolver_interface(): void public function it_logs_warning_if_page_was_not_found( PageRepositoryInterface $pageRepository, - LocaleContextInterface $localeContext, - LoggerInterface $logger + LoggerInterface $logger, ) { - $localeContext->getLocaleCode()->willReturn('en_US'); - $pageRepository->findOneEnabledByCode('homepage_banner', 'en_US')->willReturn(null); + $pageRepository->findOneEnabledByCode('homepage_banner')->willReturn(null); $logger ->warning(sprintf( 'Page with "%s" code was not found in the database.', - 'homepage_banner' + 'homepage_banner', )) ->shouldBeCalled() ; @@ -59,11 +49,9 @@ public function it_logs_warning_if_page_was_not_found( public function it_returns_page_if_found_in_database( PageRepositoryInterface $pageRepository, - LocaleContextInterface $localeContext, - PageInterface $page + PageInterface $page, ) { - $localeContext->getLocaleCode()->willReturn('en_US'); - $pageRepository->findOneEnabledByCode('homepage_banner', 'en_US')->willReturn($page); + $pageRepository->findOneEnabledByCode('homepage_banner')->willReturn($page); $this->findOrLog('homepage_banner')->shouldReturn($page); } diff --git a/spec/Resolver/ResourceResolverSpec.php b/spec/Resolver/ResourceResolverSpec.php index 74817d9bf..9ce6bea2b 100644 --- a/spec/Resolver/ResourceResolverSpec.php +++ b/spec/Resolver/ResourceResolverSpec.php @@ -1,17 +1,11 @@ beConstructedWith($repository, $factory, 'unique_column'); } @@ -32,7 +26,7 @@ public function it_is_initializable() public function it_returns_existing_resource_from_repository( RepositoryInterface $repository, - ResourceInterface $resource + ResourceInterface $resource, ) { $identifier = 'resource_identifier'; @@ -44,7 +38,7 @@ public function it_returns_existing_resource_from_repository( public function it_creates_new_resource_using_factory( RepositoryInterface $repository, FactoryInterface $factory, - ResourceInterface $newResource + ResourceInterface $newResource, ) { $identifier = 'resource_identifier'; $factoryMethod = 'createNew'; @@ -57,7 +51,7 @@ public function it_creates_new_resource_using_factory( public function it_throws_exception_when_factory_method_not_callable( RepositoryInterface $repository, - FactoryInterface $factory + FactoryInterface $factory, ) { $identifier = 'resource_identifier'; $factoryMethod = 'nonExistingMethod'; diff --git a/spec/Sorter/CollectionsSorterSpec.php b/spec/Sorter/CollectionsSorterSpec.php new file mode 100644 index 000000000..6a296c90a --- /dev/null +++ b/spec/Sorter/CollectionsSorterSpec.php @@ -0,0 +1,88 @@ +shouldHaveType(CollectionsSorter::class); + } + + public function it_implements_collections_sorter_interface(): void + { + $this->shouldHaveType(CollectionsSorterInterface::class); + } + + public function it_sorts_collections_with_one_element( + PageInterface $page, + CollectionInterface $collection, + ): void { + $collection->getCode()->willReturn('COLLECTION_CODE'); + $page->getCollections()->willReturn(new ArrayCollection([$collection->getWrappedObject()])); + + $this->sortByCollections([$page])->shouldReturn( + [ + 'COLLECTION_CODE' => ['collection' => $collection, 0 => $page], + ], + ); + } + + public function it_sorts_collections_with_more_elements( + PageInterface $page1, + PageInterface $page2, + PageInterface $page3, + CollectionInterface $collection1, + CollectionInterface $collection2, + CollectionInterface $collection3, + ): void { + $collection1->getCode()->willReturn('COLLECTION_1_CODE'); + $collection2->getCode()->willReturn('COLLECTION_2_CODE'); + $collection3->getCode()->willReturn('COLLECTION_3_CODE'); + + $page1->getCollections()->willReturn(new ArrayCollection( + [$collection1->getWrappedObject(), $collection3->getWrappedObject()], + )); + $page2->getCollections()->willReturn(new ArrayCollection([$collection3->getWrappedObject()])); + $page3->getCollections()->willReturn(new ArrayCollection( + [$collection2->getWrappedObject(), $collection1->getWrappedObject()], + )); + + $this->sortByCollections([$page1, $page2, $page3])->shouldReturn( + [ + 'COLLECTION_1_CODE' => ['collection' => $collection1, 0 => $page1, 1 => $page3], + 'COLLECTION_3_CODE' => ['collection' => $collection3, 0 => $page1, 1 => $page2], + 'COLLECTION_2_CODE' => ['collection' => $collection2, 0 => $page3], + ], + ); + } + + public function it_sorts_collections_with_less_elements( + PageInterface $page1, + PageInterface $page2, + CollectionInterface $collection1, + CollectionInterface $collection2, + ): void { + $collection1->getCode()->willReturn('COLLECTION_1_CODE'); + $collection2->getCode()->willReturn('COLLECTION_2_CODE'); + + $page1->getCollections()->willReturn(new ArrayCollection([$collection1->getWrappedObject()])); + $page2->getCollections()->willReturn(new ArrayCollection([$collection2->getWrappedObject()])); + + $this->sortByCollections([$page1, $page2])->shouldReturn( + [ + 'COLLECTION_1_CODE' => ['collection' => $collection1, 0 => $page1], + 'COLLECTION_2_CODE' => ['collection' => $collection2, 0 => $page2], + ], + ); + } +} diff --git a/spec/Sorter/SectionsSorterSpec.php b/spec/Sorter/SectionsSorterSpec.php deleted file mode 100644 index 3b20091dd..000000000 --- a/spec/Sorter/SectionsSorterSpec.php +++ /dev/null @@ -1,96 +0,0 @@ -shouldHaveType(SectionsSorter::class); - } - - public function it_implements_sections_sorter_interface(): void - { - $this->shouldHaveType(SectionsSorterInterface::class); - } - - public function it_sorts_sections_with_one_element( - PageInterface $page, - SectionInterface $section - ): void { - $section->getCode()->willReturn('SECTION_CODE'); - $page->getSections()->willReturn(new ArrayCollection([$section->getWrappedObject()])); - - $this->sortBySections([$page])->shouldReturn( - [ - 'SECTION_CODE' => ['section' => $section, 0 => $page], - ] - ); - } - - public function it_sorts_sections_with_more_elements( - PageInterface $page1, - PageInterface $page2, - PageInterface $page3, - SectionInterface $section1, - SectionInterface $section2, - SectionInterface $section3 - ): void { - $section1->getCode()->willReturn('SECTION_1_CODE'); - $section2->getCode()->willReturn('SECTION_2_CODE'); - $section3->getCode()->willReturn('SECTION_3_CODE'); - - $page1->getSections()->willReturn(new ArrayCollection( - [$section1->getWrappedObject(), $section3->getWrappedObject()] - )); - $page2->getSections()->willReturn(new ArrayCollection([$section3->getWrappedObject()])); - $page3->getSections()->willReturn(new ArrayCollection( - [$section2->getWrappedObject(), $section1->getWrappedObject()] - )); - - $this->sortBySections([$page1, $page2, $page3])->shouldReturn( - [ - 'SECTION_1_CODE' => ['section' => $section1, 0 => $page1, 1 => $page3], - 'SECTION_3_CODE' => ['section' => $section3, 0 => $page1, 1 => $page2], - 'SECTION_2_CODE' => ['section' => $section2, 0 => $page3], - ] - ); - } - - public function it_sorts_sections_with_less_elements( - PageInterface $page1, - PageInterface $page2, - SectionInterface $section1, - SectionInterface $section2 - ): void { - $section1->getCode()->willReturn('SECTION_1_CODE'); - $section2->getCode()->willReturn('SECTION_2_CODE'); - - $page1->getSections()->willReturn(new ArrayCollection([$section1->getWrappedObject()])); - $page2->getSections()->willReturn(new ArrayCollection([$section2->getWrappedObject()])); - - $this->sortBySections([$page1, $page2])->shouldReturn( - [ - 'SECTION_1_CODE' => ['section' => $section1, 0 => $page1], - 'SECTION_2_CODE' => ['section' => $section2, 0 => $page2], - ] - ); - } -} diff --git a/spec/Twig/Extension/RenderBlockExtensionSpec.php b/spec/Twig/Extension/RenderBlockExtensionSpec.php deleted file mode 100755 index a2d6c2985..000000000 --- a/spec/Twig/Extension/RenderBlockExtensionSpec.php +++ /dev/null @@ -1,47 +0,0 @@ -beConstructedWith($blockRuntime); - } - - public function it_is_initializable(): void - { - $this->shouldHaveType(RenderBlockExtension::class); - } - - public function it_extends_abstract_extension(): void - { - $this->shouldHaveType(AbstractExtension::class); - } - - public function it_returns_functions(): void - { - $functions = $this->getFunctions(); - - $functions->shouldHaveCount(1); - - foreach ($functions as $function) { - $function->shouldHaveType(TwigFunction::class); - } - } -} diff --git a/spec/Twig/Extension/RenderContentExtensionSpec.php b/spec/Twig/Extension/RenderContentExtensionSpec.php deleted file mode 100644 index 52e8c7f2c..000000000 --- a/spec/Twig/Extension/RenderContentExtensionSpec.php +++ /dev/null @@ -1,40 +0,0 @@ -shouldHaveType(RenderContentExtension::class); - } - - public function it_extends_abstract_extension(): void - { - $this->shouldHaveType(AbstractExtension::class); - } - - public function it_returns_functions(): void - { - $functions = $this->getFunctions(); - - $functions->shouldHaveCount(1); - - foreach ($functions as $function) { - $function->shouldHaveType(TwigFunction::class); - } - } -} diff --git a/spec/Twig/Extension/RenderLinkExtensionSpec.php b/spec/Twig/Extension/RenderLinkExtensionSpec.php deleted file mode 100644 index cf29332b4..000000000 --- a/spec/Twig/Extension/RenderLinkExtensionSpec.php +++ /dev/null @@ -1,42 +0,0 @@ -shouldHaveType(RenderLinkExtension::class); - } - - public function it_extends_abstract_extension(): void - { - $this->shouldHaveType(AbstractExtension::class); - } - - public function it_returns_functions(): void - { - $functions = $this->getFunctions(); - - $functions->shouldHaveCount(2); - - foreach ($functions as $function) { - $function->shouldHaveType(TwigFunction::class); - } - } -} diff --git a/spec/Twig/Extension/RenderMediaExtensionSpec.php b/spec/Twig/Extension/RenderMediaExtensionSpec.php deleted file mode 100755 index 7fd5959cd..000000000 --- a/spec/Twig/Extension/RenderMediaExtensionSpec.php +++ /dev/null @@ -1,47 +0,0 @@ -beConstructedWith($mediaRuntime); - } - - public function it_is_initializable(): void - { - $this->shouldHaveType(RenderMediaExtension::class); - } - - public function it_extends_abstract_extension(): void - { - $this->shouldHaveType(AbstractExtension::class); - } - - public function it_returns_functions(): void - { - $functions = $this->getFunctions(); - - $functions->shouldHaveCount(1); - - foreach ($functions as $function) { - $function->shouldHaveType(TwigFunction::class); - } - } -} diff --git a/spec/Twig/Extension/RenderProductPagesExtensionSpec.php b/spec/Twig/Extension/RenderProductPagesExtensionSpec.php deleted file mode 100755 index 04c66790b..000000000 --- a/spec/Twig/Extension/RenderProductPagesExtensionSpec.php +++ /dev/null @@ -1,46 +0,0 @@ -beConstructedWith($productPagesRuntime); - } - - public function it_is_initializable(): void - { - $this->shouldHaveType(RenderProductPagesExtension::class); - } - - public function it_extends_abstract_extension(): void - { - $this->shouldHaveType(AbstractExtension::class); - } - - public function it_returns_functions(): void - { - $functions = $this->getFunctions(); - - $functions->shouldHaveCount(1); - - foreach ($functions as $function) { - $function->shouldHaveType(\Twig_SimpleFunction::class); - } - } -} diff --git a/spec/Twig/Parser/ContentParserSpec.php b/spec/Twig/Parser/ContentParserSpec.php index 96e4fcdd9..665680212 100644 --- a/spec/Twig/Parser/ContentParserSpec.php +++ b/spec/Twig/Parser/ContentParserSpec.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace spec\BitBag\SyliusCmsPlugin\Twig\Parser; +namespace spec\Sylius\CmsPlugin\Twig\Parser; -use BitBag\SyliusCmsPlugin\Twig\Parser\ContentParser; -use BitBag\SyliusCmsPlugin\Twig\Parser\ContentParserInterface; -use BitBag\SyliusCmsPlugin\Twig\Runtime\RenderBlockRuntimeInterface; use PhpSpec\ObjectBehavior; +use Sylius\CmsPlugin\Twig\Parser\ContentParser; +use Sylius\CmsPlugin\Twig\Parser\ContentParserInterface; +use Sylius\CmsPlugin\Twig\Runtime\RenderBlockRuntimeInterface; use Twig\Environment; use Twig\TwigFunction; @@ -15,7 +15,7 @@ final class ContentParserSpec extends ObjectBehavior { public function let(Environment $twigEnvironment): void { - $this->beConstructedWith($twigEnvironment, ['bitbag_cms_render_block']); + $this->beConstructedWith($twigEnvironment, ['sylius_cms_render_block']); } public function it_is_initializable(): void @@ -30,35 +30,34 @@ public function it_implements_content_parser_interface(): void public function it_parses_string_function( Environment $twigEnvironment, - RenderBlockRuntimeInterface $renderBlockRuntime + RenderBlockRuntimeInterface $renderBlockRuntime, ): void { - $twigFunctionName = 'bitbag_cms_render_block'; + $twigFunctionName = 'sylius_cms_render_block'; $twigEnvironment->getFunctions()->willReturn([ - $twigFunctionName => new TwigFunction($twigFunctionName, [$renderBlockRuntime->getWrappedObject(), 'renderBlock']) + $twigFunctionName => new TwigFunction($twigFunctionName, [$renderBlockRuntime->getWrappedObject(), 'renderBlock']), ]); - $input = "Let's render! {{ bitbag_cms_render_block('intro', '@BitBagSyliusCmsPlugin/Shop/Block/show.html.twig') }}"; + $input = "Let's render! {{ sylius_cms_render_block('intro', '@SyliusCmsPlugin/Shop/Block/show.html.twig') }}"; - $renderBlockRuntime->renderBlock('intro', '@BitBagSyliusCmsPlugin/Shop/Block/show.html.twig')->shouldBeCalled(); + $renderBlockRuntime->renderBlock('intro', '@SyliusCmsPlugin/Shop/Block/show.html.twig')->shouldBeCalled(); $this->parse($input); } public function it_parses_string_functions( Environment $twigEnvironment, - RenderBlockRuntimeInterface $renderBlockRuntime + RenderBlockRuntimeInterface $renderBlockRuntime, ): void { - - $twigFunctionName = 'bitbag_cms_render_block'; + $twigFunctionName = 'sylius_cms_render_block'; $twigEnvironment->getFunctions()->willReturn([ - $twigFunctionName => new TwigFunction($twigFunctionName, [$renderBlockRuntime->getWrappedObject(), 'renderBlock']) + $twigFunctionName => new TwigFunction($twigFunctionName, [$renderBlockRuntime->getWrappedObject(), 'renderBlock']), ]); - $input = "Let's render! {{ bitbag_cms_render_block('intro', '@BitBagSyliusCmsPlugin/Shop/Block/show.html.twig') }} - Let's render twice! {{ bitbag_cms_render_block('intro1', '@BitBagSyliusCmsPlugin/Shop/Block/show.html.twig') }}"; + $input = "Let's render! {{ sylius_cms_render_block('intro', '@SyliusCmsPlugin/Shop/Block/show.html.twig') }} + Let's render twice! {{ sylius_cms_render_block('intro1', '@SyliusCmsPlugin/Shop/Block/show.html.twig') }}"; - $renderBlockRuntime->renderBlock('intro', '@BitBagSyliusCmsPlugin/Shop/Block/show.html.twig')->shouldBeCalled(); - $renderBlockRuntime->renderBlock('intro1', '@BitBagSyliusCmsPlugin/Shop/Block/show.html.twig')->shouldBeCalled(); + $renderBlockRuntime->renderBlock('intro', '@SyliusCmsPlugin/Shop/Block/show.html.twig')->shouldBeCalled(); + $renderBlockRuntime->renderBlock('intro1', '@SyliusCmsPlugin/Shop/Block/show.html.twig')->shouldBeCalled(); $this->parse($input); } diff --git a/spec/Twig/Runtime/RenderBlockRuntimeSpec.php b/spec/Twig/Runtime/RenderBlockRuntimeSpec.php index fca4ad8a5..f59b06686 100644 --- a/spec/Twig/Runtime/RenderBlockRuntimeSpec.php +++ b/spec/Twig/Runtime/RenderBlockRuntimeSpec.php @@ -1,31 +1,27 @@ beConstructedWith($blockResourceResolver, $templatingEngine); + $this->beConstructedWith($blockResourceResolver, $templatingEngine, $contentElementRendererStrategy); } public function it_is_initializable(): void @@ -35,28 +31,70 @@ public function it_is_initializable(): void public function it_implements_render_block_runtime_interface(): void { - $this->shouldHaveType(RenderBlockRuntimeInterface::class); + $this->shouldImplement(RenderBlockRuntimeInterface::class); + } + + public function it_returns_empty_string_when_block_not_found(BlockResourceResolverInterface $blockResourceResolver): void + { + $blockResourceResolver->findOrLog('code')->willReturn(null); + + $this->renderBlock('code')->shouldReturn(''); } - public function it_renders_block( + public function it_returns_empty_string_when_block_not_displayable_for_taxon( BlockResourceResolverInterface $blockResourceResolver, BlockInterface $block, - Environment $templatingEngine + TaxonInterface $taxon, ): void { - $blockResourceResolver->findOrLog('bitbag')->willReturn($block); - $templatingEngine->render('@BitBagSyliusCmsPlugin/Shop/Block/show.html.twig', ['block' => $block])->willReturn('+ Welcome to SyliusCmsPlugin, where style meets comfort! Explore our latest collection of trendy t-shirts, stylish dresses, and versatile caps, designed for both men and women. Whether you're dressing up or keeping it casual, our curated selection offers something for everyone. Elevate your wardrobe with pieces that reflect your unique personality and fit perfectly into your everyday life. Shop now and discover your new favorite look! +
++ Discover our latest collection: +
+ Our T-Shirts collection offers a blend of comfort and style, featuring a variety of designs that cater to every taste. Whether you're looking for classic basics or bold statement pieces, you'll find the perfect fit to express your unique personality. +
+ products_carousel: + type: "products_carousel" + data: + products_carousel: + products: + - "Everyday_white_basic_T_Shirt" + - "Loose_white_designer_T_Shirt" + - "Ribbed_copper_slim_fit_Tee" + - "Sport_basic_white_T_Shirt" + - "Raglan_grey_black_Tee" + - "Oversize_white_cotton_T_Shirt" + homepage_banner_1: + name: "Homepage banner 1" + channels: + - "FASHION_WEB" + collections: + - "homepage" + - "black_friday" + content_elements: + en_US: + spacer1: + type: "spacer" + data: + spacer: 20 + single_media: + type: "single_media" + data: + single_media: "homepage_banner_1" + spacer2: + type: "spacer" + data: + spacer: 20 + homepage_banner_2: + name: "Homepage banner 2" + channels: + - "FASHION_WEB" + collections: + - "homepage" + content_elements: + en_US: + single_media: + type: "single_media" + data: + single_media: "homepage_banner_2" + homepage_banner_3: + name: "Homepage banner 3" + channels: + - "FASHION_WEB" + collections: + - "homepage" + content_elements: + en_US: + single_media: + type: "single_media" + data: + single_media: "homepage_banner_3" + spacer1: + type: "spacer" + data: + spacer: 10 + homepage_products_carousel_by_taxon: + name: "How about jeans?" + channels: + - "FASHION_WEB" + collections: + - "homepage" + content_elements: + en_US: + spacer1: + type: "spacer" + data: + spacer: 10 + heading: + type: "heading" + data: + heading_type: "h2" + heading: "How about jeans? 👖" + textarea: + type: "textarea" + data: + textarea: | ++ Discover our Jeans collection, where comfort meets timeless style. Whether you're looking for the perfect pair to wear every day or something more fashion-forward, our jeans are designed to fit seamlessly into your wardrobe. +
++ Key features of our Dresses collection: + +
+ Elevate your denim game with our collection and find your new favorite pair today! +
+ products_carousel_by_taxon: + type: "products_carousel_by_taxon" + data: + products_carousel_by_taxon: "jeans" + homepage_products_grid: + name: "Meet our caps brand" + channels: + - "FASHION_WEB" + collections: + - "homepage" + content_elements: + en_US: + heading: + type: "heading" + data: + heading_type: "h2" + heading: "Meet our caps brand 🧢" + textarea: + type: "textarea" + data: + textarea: | ++ Our Caps collection combines functionality with fashion, offering a range of designs that suit any style. Whether you need a sporty edge or a casual accessory, our caps are the perfect finishing touch for any outfit. +
+ products_grid: + type: "products_grid" + data: + products_grid: + products: + - "Knitted_burgundy_winter_cap" + - "Knitted_wool_blend_green_cap" + - "Knitted_white_pompom_cap" + - "Cashmere_blend_violet_beanie" + homepage_products_grid_by_taxon: + name: "See also our dress collection!" + channels: + - "FASHION_WEB" + collections: + - "homepage" + content_elements: + en_US: + heading: + type: "heading" + data: + heading_type: "h2" + heading: "See also our dress collection! 👗" + textarea: + type: "textarea" + data: + textarea: | ++ Explore our Dresses collection, where style and sophistication come together in perfect harmony. Whether you're dressing for a special occasion or simply want to elevate your everyday look, our dresses offer something for every moment. +
++ Key features of our Dresses collection: + +
+ Find the perfect dress to match your style and make every day a little more special! +
+ products_grid_by_taxon: + type: "products_grid_by_taxon" + data: + products_grid_by_taxon: "dresses" + homepage_taxons_list: + name: "Not interested in caps? See all our brands" + channels: + - "FASHION_WEB" + collections: + - "homepage" + content_elements: + en_US: + heading: + type: "heading" + data: + heading_type: "h2" + heading: "Not interested in caps? See all our brands:" + textarea: + type: "textarea" + data: + textarea: | ++ Check out our other collections to complete your look! Explore our diverse range of T-Shirts, where comfort meets contemporary style, perfect for any occasion. Don't miss our Caps collection, offering the ideal blend of fashion and functionality to top off your outfit. And for those special moments, our Dresses collection features stylish options that will make you feel confident and elegant. Discover your new favorites today! +
+ taxons_list: + type: "taxons_list" + data: + taxons_list: + taxons: + - "t_shirts" + - "caps" + - "dresses" + - "jeans" + black_friday_banner_taxon: + name: "Black friday banner (taxons)" + channels: + - "FASHION_WEB" + collections: + - "black_friday" + taxons: + - "t_shirts" + - "mens_t_shirts" + - "womens_t_shirts" + content_elements: + en_US: + single_media: + type: "single_media" + data: + single_media: "black_friday_banner" + black_friday_banner_product: + name: "Black friday banner (products)" + channels: + - "FASHION_WEB" + collections: + - "black_friday" + products_in_taxons: + - "mens_t_shirts" + - "womens_t_shirts" + content_elements: + en_US: + single_media: + type: "single_media" + data: + single_media: "black_friday_banner" + spacer1: + type: "spacer" + data: + spacer: 20 + specified_products_in_taxons: + name: "You may also like" + channels: + - "FASHION_WEB" + collections: + - "products_details" + products_in_taxons: + - "mens_t_shirts" + - "womens_t_shirts" + content_elements: + en_US: + spacer1: + type: "spacer" + data: + spacer: 20 + heading1: + type: "heading" + data: + heading_type: "h2" + heading: "You may also like:" + products_carousel_by_taxon: + type: "products_carousel_by_taxon" + data: + products_carousel_by_taxon: "t_shirts" + heading2: + type: "heading" + data: + heading_type: "h2" + heading: "Our best sales:" + products_grid_by_taxon: + type: "products_grid_by_taxon" + data: + products_grid_by_taxon: "caps" diff --git a/src/Resources/config/fixtures/2_page.yaml b/src/Resources/config/fixtures/2_page.yaml new file mode 100644 index 000000000..c7fc88cba --- /dev/null +++ b/src/Resources/config/fixtures/2_page.yaml @@ -0,0 +1,556 @@ +sylius_fixtures: + suites: + default: + listeners: + orm_purger: ~ + logger: ~ + fixtures: + page: + options: + custom: + faq: + name: "Frequently Asked Questions" + channels: + - "FASHION_WEB" + translations: + en_US: + slug: "faq" + meta_title: "FAQ" + meta_keywords: "faq" + content_elements: + en_US: + question1: + type: "heading" + data: + heading_type: "h3" + heading: "What sizes are available for your clothing items?" + answer1: + type: "textarea" + data: + textarea: "We are committed to sustainability and offer a selection of t-shirts and jeans made from eco-friendly materials. Look for our sustainability badge on the product pages for more information.>We offer a wide range of sizes for our t-shirts, caps, dresses, and jeans, from XS to XXL. Specific sizing information can be found on each product page.
" + question2: + type: "heading" + data: + heading_type: "h3" + heading: "Are your products unisex?" + answer2: + type: "textarea" + data: + textarea: "Yes, many of our t-shirts and caps are designed to be unisex, providing stylish options for both men and women. Our dresses are designed specifically for women, while our jeans come in both men’s and women’s fits.
" + question3: + type: "heading" + data: + heading_type: "h3" + heading: "What materials are your t-shirts and jeans made from?" + answer3: + type: "textarea" + data: + textarea: "Our t-shirts are crafted from soft, high-quality cotton blends, while our jeans are made from durable denim with just the right amount of stretch for comfort.
" + question4: + type: "heading" + data: + heading_type: "h3" + heading: "How should I care for my t-shirts and jeans to ensure they last?" + answer4: + type: "textarea" + data: + textarea: "We recommend washing your t-shirts and jeans in cold water and tumble drying on low heat to preserve their fit and color. Always check the care label for specific instructions.
" + question5: + type: "heading" + data: + heading_type: "h3" + heading: "Do you offer international shipping?" + answer5: + type: "textarea" + data: + textarea: "Yes, we offer international shipping to many countries. Shipping fees and delivery times will vary depending on your location.
" + question6: + type: "heading" + data: + heading_type: "h3" + heading: "Can I return or exchange an item if it doesn’t fit?" + answer6: + type: "textarea" + data: + textarea: "Absolutely! We have a hassle-free return and exchange policy. If your item doesn’t fit, you can return it within 30 days for a full refund or exchange.
" + question7: + type: "heading" + data: + heading_type: "h3" + heading: "Do you offer any discounts for bulk purchases?" + answer7: + type: "textarea" + data: + textarea: "Yes, we offer discounts on bulk orders. Please contact our customer service team for more information on bulk pricing and special offers.
" + question8: + type: "heading" + data: + heading_type: "h3" + heading: "How do I find the right size for your caps?" + answer8: + type: "textarea" + data: + textarea: "Most of our caps are adjustable to fit a variety of head sizes. Each product page includes specific sizing information and instructions on how to adjust the fit.
" + question9: + type: "heading" + data: + heading_type: "h3" + heading: "Are your dresses suitable for formal occasions?" + answer9: + type: "textarea" + data: + textarea: "Yes, our Dresses collection includes a variety of styles, from casual daywear to elegant dresses perfect for formal events.
" + question10: + type: "heading" + data: + heading_type: "h3" + heading: "Do you have any eco-friendly or sustainable options?" + answer10: + type: "textarea" + data: + textarea: "We are committed to sustainability and offer a selection of t-shirts and jeans made from eco-friendly materials. Look for our sustainability badge on the product pages for more information.
" + blog: + name: "Blog" + channels: + - "FASHION_WEB" + translations: + en_US: + slug: "blog" + meta_title: "Blog" + content_elements: + en_US: + single_media: + type: "single_media" + data: + single_media: "blog_banner" + textarea: + type: "textarea" + data: + textarea: "Whether you need a sporty edge or a casual accessory, our stuff is the perfect finishing touch for any outfit.
" + pages_collection: + type: "pages_collection" + data: + pages_collection: "blog" + blog_post_1: + name: "#1: Your Ultimate Guide to Beach and Holiday Fashion: Hats, Shirts, Sunglasses, and Shoes" + channels: + - "FASHION_WEB" + collections: + - "blog" + translations: + en_US: + slug: "blog-post-1" + meta_title: "Your Ultimate Guide to Beach and Holiday Fashion: Hats, Shirts, Sunglasses, and Shoes" + teaser_title: "Your Ultimate Guide to Beach and Holiday Fashion" + teaser_content: "When planning your beach holiday wardrobe, fashion and function go hand in hand. Whether you're lounging by the pool, strolling along sandy shores, or heading out for a casual seaside dinner, nailing the perfect look is key to a stylish yet comfortable vacation. In this blog post, we’ll dive into the must-have modern fashion pieces that will elevate your beach holiday style. From chic hats to breezy shirts, trendy sunglasses to versatile shoes—let's break down how to build the perfect holiday wardrobe.
+ subheading1: + type: "heading" + data: + heading_type: "h3" + heading: "Stylish Hats: More Than Just Sun Protection" + text1: + type: "textarea" + data: + textarea: | +No beach wardrobe is complete without a fashionable hat. While sun protection is a must, the right hat can instantly elevate your outfit. Whether you prefer a classic wide-brimmed hat or something a bit more trendy like a bucket hat, here are some top options for your holiday look:
+These styles aren’t just practical — they’re fashion statements.
+ spacer1: + type: "spacer" + data: + spacer: 20 + image_1: + type: "single_media" + data: + single_media: "blog_post_1_content_image_1" + spacer2: + type: "spacer" + data: + spacer: 10 + subheading2: + type: "heading" + data: + heading_type: "h3" + heading: "Breezy Shirts: Keeping It Cool and Comfortable" + text2: + type: "textarea" + data: + textarea: | +Shirts are the unsung heroes of beach and holiday wardrobes. You want something light, breathable, and versatile enough to take you from day to night. Here are some modern shirt styles to consider:
+The beauty of these shirts is their versatility, easily styled for daytime beach wear or a casual evening out.
+ spacer3: + type: "spacer" + data: + spacer: 10 + products_grid: + type: "products_grid" + data: + products_grid: + products: + - "Raglan_grey_&_black_Tee" + - "Loose_white_designer_T_Shirt" + - "Sport_basic_white_T_Shirt" + - "Ribbed_copper_slim_fit_Tee" + subheading3: + type: "heading" + data: + heading_type: "h3" + heading: "Trendy Sunglasses: Protect Your Eyes in Style" + text3: + type: "textarea" + data: + textarea: | +Sunglasses are not only essential for protecting your eyes from the sun but are also a critical accessory in pulling together your holiday look. This season’s sunglasses trends are all about bold shapes and eye-catching designs:
+The right pair of sunglasses doesn’t just protect — it adds personality and polish to your overall look.
+ spacer4: + type: "spacer" + data: + spacer: 20 + image_2: + type: "single_media" + data: + single_media: "blog_post_1_content_image_2" + spacer5: + type: "spacer" + data: + spacer: 10 + subheading4: + type: "heading" + data: + heading_type: "h3" + heading: "Footwear: From Sand to Streets" + text4: + type: "textarea" + data: + textarea: | +When it comes to holiday shoes, versatility is key. You need shoes that are comfortable for walking but also stylish enough to transition from the beach to the bar. Here are the best shoe styles for your beach holiday:
+With these footwear options, you can easily switch between sandy beaches and urban explorations without compromising on style.
+ outro_heading: + type: "heading" + data: + heading_type: "h3" + heading: "Conclusion" + outro_text: + type: "textarea" + data: + textarea: | +Building the perfect beach and holiday wardrobe doesn’t have to be complicated. Focus on key pieces — hats, shirts, sunglasses, and shoes — that combine fashion and functionality. Whether you’re going for a laid-back beach look or something a little more polished for evening outings, these modern fashion essentials will have you looking and feeling your best on your holiday. So pack smart, and enjoy your time in the sun with confidence and style!
+ blog_post_2: + name: "#2: Beach Suits for Everyone: Stylish and Functional Options for Women, Men, and Children" + channels: + - "FASHION_WEB" + collections: + - "blog" + translations: + en_US: + slug: "blog-post-2" + meta_title: "Beach Suits for Everyone: Stylish and Functional Options for Women, Men, and Children" + teaser_title: "Beach Suits for Everyone" + teaser_content: "Finding the perfect beach suit isn’t just about looking good — it’s also about comfort and versatility. Whether you’re swimming, playing beach volleyball, or simply relaxing by the water, the right beachwear can make a world of difference. In this guide, we’ll explore the top beach suit trends for women, men, and children, ensuring that the whole family is stylishly prepared for any seaside adventure. From flattering swimsuits to practical designs for kids, we've got you covered.
+ subheading1: + type: "heading" + data: + heading_type: "h3" + heading: "Women’s Beach Suits: Chic and Comfortable" + text1: + type: "textarea" + data: + textarea: | +Women’s beachwear has come a long way from basic bikinis. Modern trends offer a wide array of styles that suit different body types, preferences, and activities. Here are some top picks for stylish and functional women’s beach suits:
+These options ensure that you’ll not only feel confident in your swimwear but also be ready for anything, from swimming to sunbathing.
+ spacer1: + type: "spacer" + data: + spacer: 20 + image_1: + type: "single_media" + data: + single_media: "blog_post_2_content_image_1" + spacer2: + type: "spacer" + data: + spacer: 10 + subheading2: + type: "heading" + data: + heading_type: "h3" + heading: "Men’s Beach Suits: From Casual to Sporty" + text2: + type: "textarea" + data: + textarea: | +Men’s beachwear has evolved from basic board shorts to more diverse and stylish options. Whether you’re looking for something functional for water sports or something casual for lounging, here are the best beach suit options for men:
+These suits provide the perfect combination of practicality and style, ensuring men can enjoy their beach day in comfort.
+ spacer3: + type: "spacer" + data: + spacer: 10 + products_grid: + type: "products_grid_by_taxon" + data: + products_grid_by_taxon: "dresses" + subheading3: + type: "heading" + data: + heading_type: "h3" + heading: "Beach Suits for Kids: Fun and Functional" + text3: + type: "textarea" + data: + textarea: | +When it comes to children’s beachwear, the focus is on sun protection and comfort. However, that doesn’t mean kids can’t be stylish while they play in the sand! Here are some great options for children’s beach suits:
+These suits ensure that kids can enjoy the beach safely, comfortably, and with a sense of style.
+ spacer4: + type: "spacer" + data: + spacer: 20 + image_2: + type: "single_media" + data: + single_media: "blog_post_2_content_image_2" + spacer5: + type: "spacer" + data: + spacer: 10 + subheading4: + type: "heading" + data: + heading_type: "h3" + heading: "Choosing the Right Fabrics and Features for All Ages" + text4: + type: "textarea" + data: + textarea: | +No matter who you're shopping for — women, men, or children — choosing the right materials and features is key to getting the most out of your beachwear. Here are some essential things to look out for when buying beach suits:
+With the right fabrics and functional features, your beach suits will last longer and provide maximum comfort throughout your holiday.
+ outro_heading: + type: "heading" + data: + heading_type: "h3" + heading: "Conclusion" + outro_text: + type: "textarea" + data: + textarea: | +Finding the perfect beach suit for the entire family doesn't have to be a challenge. With stylish and practical options available for women, men, and children, everyone can feel comfortable and confident at the beach. Whether you're looking for sun protection, the perfect fit, or the latest trends, these beach suits offer everything you need for a fun-filled holiday by the sea. So pack up your beach bag and get ready to make a splash with your new, fashionable beachwear!
+ + blog_post_3: + name: "#3: Beach-Ready Fashion for Men and Boys: T-Shirts, Shorts, and Shoes" + channels: + - "FASHION_WEB" + collections: + - "blog" + translations: + en_US: + slug: "blog-post-3" + meta_title: "Beach-Ready Fashion for Men and Boys: T-Shirts, Shorts, and Shoes" + teaser_title: "Beach-Ready Fashion for Men and Boys" + teaser_content: "When hitting the beach, comfort is key, but that doesn't mean style has to take a backseat. Whether you’re a man looking for the perfect holiday wardrobe or shopping for your boys, you’ll want to find pieces that combine practicality with a touch of flair. In this guide, we’ll explore the top T-shirts, shorts, and shoes for men and boys, helping you put together the ideal beach outfit. From breezy shirts to functional footwear, this is your go-to guide for looking stylish while enjoying the sun, sand, and surf.
+ subheading1: + type: "heading" + data: + heading_type: "h3" + heading: "T-Shirts for Men: Style Meets Comfort" + text1: + type: "textarea" + data: + textarea: | +A well-chosen T-shirt is an essential part of any beach look for men. The right fabric and fit can keep you cool while still looking sharp, even in the hottest weather. Here are some modern T-shirt styles that are perfect for the beach:
+These styles ensure you look good while staying comfortable, whether you’re lounging on the beach or heading to a seaside café.
+ spacer1: + type: "spacer" + data: + spacer: 20 + image_1: + type: "single_media" + data: + single_media: "blog_post_3_content_image_1" + spacer2: + type: "spacer" + data: + spacer: 10 + subheading2: + type: "heading" + data: + heading_type: "h3" + heading: "T-Shirts for Boys: Fun and Functional" + text2: + type: "textarea" + data: + textarea: | +When it comes to boys’ T-shirts, you need pieces that are both practical and playful. Boys are always on the move, so their beach wardrobe should reflect that. Here are some great T-shirt options for boys:
+These T-shirts combine comfort with style, ensuring boys can play and swim while staying protected and cool.
+ spacer3: + type: "spacer" + data: + spacer: 10 + products_carousel_by_taxon: + type: "products_carousel_by_taxon" + data: + products_carousel_by_taxon: "t_shirts" + subheading3: + type: "heading" + data: + heading_type: "h3" + heading: "Shorts for Men: Practicality with a Stylish Twist" + text3: + type: "textarea" + data: + textarea: | +Choosing the right pair of shorts for the beach is crucial. Men need something that’s easy to move in but also stylish enough for post-beach activities. Here are some top picks for beach shorts:
+With these options, you’ll always look good while staying comfortable and ready for any beachside activity.
+ spacer4: + type: "spacer" + data: + spacer: 20 + image_2: + type: "single_media" + data: + single_media: "blog_post_3_content_image_2" + spacer5: + type: "spacer" + data: + spacer: 10 + subheading4: + type: "heading" + data: + heading_type: "h3" + heading: "Shorts for Boys: Durable and Play-Friendly" + text4: + type: "textarea" + data: + textarea: | +Boys need shorts that can withstand a day full of activities, from swimming to sandcastle building. Comfort, durability, and style should all come together. Here are some great beach short options for boys:
+These options ensure boys can enjoy their time at the beach with full freedom of movement while looking cute and cool.
+ outro_heading: + type: "heading" + data: + heading_type: "h3" + heading: "Conclusion" + outro_text: + type: "textarea" + data: + textarea: | +With the right T-shirts, shorts, and shoes, men and boys can enjoy their time at the beach in both style and comfort. From cool, breathable shirts to functional and fashionable shorts, and durable footwear, there are plenty of options to ensure everyone looks great while feeling good. Whether it’s a casual beach day or an adventure-filled holiday, these fashion staples will have you covered from sand to shore. So pack smart and get ready to enjoy the sun, sea, and sand in style!
diff --git a/src/Resources/config/fixtures/images/black_friday_banner.png b/src/Resources/config/fixtures/images/black_friday_banner.png new file mode 100644 index 000000000..f9bbf7066 Binary files /dev/null and b/src/Resources/config/fixtures/images/black_friday_banner.png differ diff --git a/src/Resources/config/fixtures/images/blog_banner.png b/src/Resources/config/fixtures/images/blog_banner.png new file mode 100644 index 000000000..f9bbf7066 Binary files /dev/null and b/src/Resources/config/fixtures/images/blog_banner.png differ diff --git a/src/Resources/config/fixtures/images/blog_post_1_content_image_1.png b/src/Resources/config/fixtures/images/blog_post_1_content_image_1.png new file mode 100644 index 000000000..223a5aeb8 Binary files /dev/null and b/src/Resources/config/fixtures/images/blog_post_1_content_image_1.png differ diff --git a/src/Resources/config/fixtures/images/blog_post_1_content_image_2.png b/src/Resources/config/fixtures/images/blog_post_1_content_image_2.png new file mode 100644 index 000000000..5a093a404 Binary files /dev/null and b/src/Resources/config/fixtures/images/blog_post_1_content_image_2.png differ diff --git a/src/Resources/config/fixtures/images/blog_post_1_header_banner.png b/src/Resources/config/fixtures/images/blog_post_1_header_banner.png new file mode 100644 index 000000000..0f7d390a9 Binary files /dev/null and b/src/Resources/config/fixtures/images/blog_post_1_header_banner.png differ diff --git a/src/Resources/config/fixtures/images/blog_post_1_teaser_image.png b/src/Resources/config/fixtures/images/blog_post_1_teaser_image.png new file mode 100644 index 000000000..313067635 Binary files /dev/null and b/src/Resources/config/fixtures/images/blog_post_1_teaser_image.png differ diff --git a/src/Resources/config/fixtures/images/blog_post_2_content_image_1.png b/src/Resources/config/fixtures/images/blog_post_2_content_image_1.png new file mode 100644 index 000000000..427ca7eea Binary files /dev/null and b/src/Resources/config/fixtures/images/blog_post_2_content_image_1.png differ diff --git a/src/Resources/config/fixtures/images/blog_post_2_content_image_2.png b/src/Resources/config/fixtures/images/blog_post_2_content_image_2.png new file mode 100644 index 000000000..223a5aeb8 Binary files /dev/null and b/src/Resources/config/fixtures/images/blog_post_2_content_image_2.png differ diff --git a/src/Resources/config/fixtures/images/blog_post_2_header_banner.png b/src/Resources/config/fixtures/images/blog_post_2_header_banner.png new file mode 100644 index 000000000..751f3fcfa Binary files /dev/null and b/src/Resources/config/fixtures/images/blog_post_2_header_banner.png differ diff --git a/src/Resources/config/fixtures/images/blog_post_2_teaser_image.png b/src/Resources/config/fixtures/images/blog_post_2_teaser_image.png new file mode 100644 index 000000000..9e89cb73f Binary files /dev/null and b/src/Resources/config/fixtures/images/blog_post_2_teaser_image.png differ diff --git a/src/Resources/config/fixtures/images/blog_post_3_content_image_1.png b/src/Resources/config/fixtures/images/blog_post_3_content_image_1.png new file mode 100644 index 000000000..f9bbf7066 Binary files /dev/null and b/src/Resources/config/fixtures/images/blog_post_3_content_image_1.png differ diff --git a/src/Resources/config/fixtures/images/blog_post_3_content_image_2.png b/src/Resources/config/fixtures/images/blog_post_3_content_image_2.png new file mode 100644 index 000000000..560534ce8 Binary files /dev/null and b/src/Resources/config/fixtures/images/blog_post_3_content_image_2.png differ diff --git a/src/Resources/config/fixtures/images/blog_post_3_header_banner.png b/src/Resources/config/fixtures/images/blog_post_3_header_banner.png new file mode 100644 index 000000000..112ad47c4 Binary files /dev/null and b/src/Resources/config/fixtures/images/blog_post_3_header_banner.png differ diff --git a/src/Resources/config/fixtures/images/blog_post_3_teaser_image.png b/src/Resources/config/fixtures/images/blog_post_3_teaser_image.png new file mode 100644 index 000000000..4df05876b Binary files /dev/null and b/src/Resources/config/fixtures/images/blog_post_3_teaser_image.png differ diff --git a/src/Resources/config/fixtures/images/homepage_banner_1.png b/src/Resources/config/fixtures/images/homepage_banner_1.png new file mode 100644 index 000000000..f9bbf7066 Binary files /dev/null and b/src/Resources/config/fixtures/images/homepage_banner_1.png differ diff --git a/src/Resources/config/fixtures/images/homepage_banner_2.png b/src/Resources/config/fixtures/images/homepage_banner_2.png new file mode 100644 index 000000000..751f3fcfa Binary files /dev/null and b/src/Resources/config/fixtures/images/homepage_banner_2.png differ diff --git a/src/Resources/config/fixtures/images/homepage_banner_3.png b/src/Resources/config/fixtures/images/homepage_banner_3.png new file mode 100644 index 000000000..112ad47c4 Binary files /dev/null and b/src/Resources/config/fixtures/images/homepage_banner_3.png differ diff --git a/src/Resources/config/fixtures/images/specified_products_banner.png b/src/Resources/config/fixtures/images/specified_products_banner.png new file mode 100644 index 000000000..f9bbf7066 Binary files /dev/null and b/src/Resources/config/fixtures/images/specified_products_banner.png differ diff --git a/src/Resources/config/fos_ck_editor/fos_ck_editor.yml b/src/Resources/config/fos_ck_editor/fos_ck_editor.yml index 2ef9a9dbb..989d8c4e5 100644 --- a/src/Resources/config/fos_ck_editor/fos_ck_editor.yml +++ b/src/Resources/config/fos_ck_editor/fos_ck_editor.yml @@ -1,8 +1,8 @@ fos_ck_editor: - default_config: bitbag_sylius_cms_plugin + default_config: sylius_cms configs: - bitbag_sylius_cms_plugin: - toolbar: bitbag_sylius_cms_plugin + sylius_cms: + toolbar: sylius_cms enterMode: 3 forcePasteAsPlainText: 'allow-word' allowedContent: true @@ -13,14 +13,14 @@ fos_ck_editor: - "exportpdf" plugins: mediaVideo: - path: '/bundles/bitbagsyliuscmsplugin/js/ckeditor-plugins/video/' + path: '/bundles/syliuscmsplugin/js/ckeditor-plugins/video/' filename: 'plugin.js' mediaImage: - path: '/bundles/bitbagsyliuscmsplugin/js/ckeditor-plugins/image/' + path: '/bundles/syliuscmsplugin/js/ckeditor-plugins/image/' filename: 'plugin.js' toolbars: configs: - bitbag_sylius_cms_plugin: + sylius_cms: - '@standard.clipboard' - '@standard.editing' - '@standard.links' diff --git a/src/Resources/config/grids.yml b/src/Resources/config/grids.yml index 3e22d5a0e..3bdbb63fa 100755 --- a/src/Resources/config/grids.yml +++ b/src/Resources/config/grids.yml @@ -1,8 +1,8 @@ imports: - - { resource: "@BitBagSyliusCmsPlugin/Resources/config/grids/admin.yml" } - - { resource: "@BitBagSyliusCmsPlugin/Resources/config/grids/shop.yml" } + - { resource: "@SyliusCmsPlugin/Resources/config/grids/admin.yml" } + - { resource: "@SyliusCmsPlugin/Resources/config/grids/shop.yml" } sylius_grid: templates: action: - import: "@BitBagSyliusCmsPlugin/Grid/Action/import.html.twig" + import: "@SyliusCmsPlugin/Grid/Action/import.html.twig" diff --git a/src/Resources/config/grids/admin.yml b/src/Resources/config/grids/admin.yml index 4e25dc246..cbbed98f5 100755 --- a/src/Resources/config/grids/admin.yml +++ b/src/Resources/config/grids/admin.yml @@ -1,6 +1,6 @@ imports: - - { resource: "@BitBagSyliusCmsPlugin/Resources/config/grids/admin/block.yml" } - - { resource: "@BitBagSyliusCmsPlugin/Resources/config/grids/admin/page.yml" } - - { resource: "@BitBagSyliusCmsPlugin/Resources/config/grids/admin/frequently_asked_question.yml" } - - { resource: "@BitBagSyliusCmsPlugin/Resources/config/grids/admin/section.yml" } - - { resource: "@BitBagSyliusCmsPlugin/Resources/config/grids/admin/media.yml" } + - { resource: "@SyliusCmsPlugin/Resources/config/grids/admin/block.yml" } + - { resource: "@SyliusCmsPlugin/Resources/config/grids/admin/page.yml" } + - { resource: "@SyliusCmsPlugin/Resources/config/grids/admin/collection.yml" } + - { resource: "@SyliusCmsPlugin/Resources/config/grids/admin/media.yml" } + - { resource: "@SyliusCmsPlugin/Resources/config/grids/admin/template.yml" } diff --git a/src/Resources/config/grids/admin/block.yml b/src/Resources/config/grids/admin/block.yml index 3b98296cd..d6c7902fa 100755 --- a/src/Resources/config/grids/admin/block.yml +++ b/src/Resources/config/grids/admin/block.yml @@ -1,17 +1,21 @@ sylius_grid: grids: - bitbag_sylius_cms_plugin_admin_block: + sylius_cms_admin_block: driver: name: doctrine/orm options: - class: "%bitbag_sylius_cms_plugin.model.block.class%" - repository: - method: createListQueryBuilder - arguments: ["%locale%"] + class: "%sylius_cms.model.block.class%" sorting: code: asc limits: [10, 25, 50] fields: + name: + type: twig + label: sylius_cms.ui.name + sortable: name + path: . + options: + template: "@SyliusCmsPlugin/Grid/Field/name.html.twig" code: type: string label: sylius.ui.code @@ -23,12 +27,18 @@ sylius_grid: sortable: ~ options: template: "@SyliusUi/Grid/Field/enabled.html.twig" - sections: + collections: + type: twig + label: sylius_cms.ui.collections + path: . + options: + template: "@SyliusCmsPlugin/Grid/Field/collections.html.twig" + channels: type: twig - label: bitbag_sylius_cms_plugin.ui.sections + label: sylius_cms.ui.channels path: . options: - template: "@BitBagSyliusCmsPlugin/Grid/Field/sections.html.twig" + template: "@SyliusCmsPlugin/Grid/Field/channels.html.twig" filters: search: type: string diff --git a/src/Resources/config/grids/admin/section.yml b/src/Resources/config/grids/admin/collection.yml similarity index 64% rename from src/Resources/config/grids/admin/section.yml rename to src/Resources/config/grids/admin/collection.yml index 293b6f460..0f8492a48 100755 --- a/src/Resources/config/grids/admin/section.yml +++ b/src/Resources/config/grids/admin/collection.yml @@ -1,25 +1,29 @@ sylius_grid: grids: - bitbag_sylius_cms_plugin_admin_section: + sylius_cms_admin_collection: driver: name: doctrine/orm options: - class: "%bitbag_sylius_cms_plugin.model.section.class%" - repository: - method: createListQueryBuilder - arguments: ["%locale%"] + class: "%sylius_cms.model.collection.class%" sorting: code: asc limits: [10, 25, 50] fields: + name: + type: twig + label: sylius_cms.ui.name + sortable: name + path: . + options: + template: "@SyliusCmsPlugin/Grid/Field/name.html.twig" code: type: string - label: bitbag_sylius_cms_plugin.ui.code + label: sylius_cms.ui.code sortable: ~ - name: + type: type: string - label: bitbag_sylius_cms_plugin.ui.name - sortable: translation.name + label: sylius_cms.ui.type + sortable: ~ filters: search: type: string diff --git a/src/Resources/config/grids/admin/frequently_asked_question.yml b/src/Resources/config/grids/admin/frequently_asked_question.yml deleted file mode 100755 index b024a4f69..000000000 --- a/src/Resources/config/grids/admin/frequently_asked_question.yml +++ /dev/null @@ -1,48 +0,0 @@ -sylius_grid: - grids: - bitbag_sylius_cms_plugin_admin_frequently_asked_question: - driver: - name: doctrine/orm - options: - class: "%bitbag_sylius_cms_plugin.model.frequently_asked_question.class%" - repository: - method: createListQueryBuilder - arguments: ["%locale%"] - sorting: - position: asc - limits: [10, 25, 50] - fields: - position: - type: string - label: sylius.ui.position - sortable: ~ - code: - type: string - label: sylius.ui.code - sortable: ~ - question: - type: string - label: bitbag_sylius_cms_plugin.ui.question - sortable: translation.question - answer: - type: string - label: bitbag_sylius_cms_plugin.ui.answer - sortable: translation.answer - filters: - search: - type: string - label: sylius.ui.search - options: - fields: [code] - actions: - main: - create: - type: create - item: - update: - type: update - delete: - type: delete - bulk: - delete: - type: delete diff --git a/src/Resources/config/grids/admin/media.yml b/src/Resources/config/grids/admin/media.yml index e5608163f..24de6d2fb 100644 --- a/src/Resources/config/grids/admin/media.yml +++ b/src/Resources/config/grids/admin/media.yml @@ -1,10 +1,10 @@ sylius_grid: grids: - bitbag_sylius_cms_plugin_admin_media: + sylius_cms_admin_media: driver: name: doctrine/orm options: - class: "%bitbag_sylius_cms_plugin.model.media.class%" + class: "%sylius_cms.model.media.class%" repository: method: createListQueryBuilder arguments: ["%locale%"] @@ -14,23 +14,38 @@ sylius_grid: fields: media_file: type: twig - label: bitbag_sylius_cms_plugin.ui.preview + label: sylius_cms.ui.preview path: . options: - template: "@BitBagSyliusCmsPlugin/Grid/Field/image_preview.html.twig" + template: "@SyliusCmsPlugin/Grid/Field/image_preview.html.twig" name: - type: string - label: bitbag_sylius_cms_plugin.ui.name + type: twig + label: sylius_cms.ui.name + sortable: name + path: . + options: + template: "@SyliusCmsPlugin/Grid/Field/name.html.twig" code: type: string - label: bitbag_sylius_cms_plugin.ui.code + label: sylius_cms.ui.code sortable: ~ - path: - type: string - label: bitbag_sylius_cms_plugin.ui.path - type: - type: string - label: bitbag_sylius_cms_plugin.ui.type + enabled: + type: twig + label: sylius.ui.enabled + options: + template: "@SyliusUi/Grid/Field/enabled.html.twig" + collections: + type: twig + label: sylius_cms.ui.collections + path: . + options: + template: "@SyliusCmsPlugin/Grid/Field/collections.html.twig" + channels: + type: twig + label: sylius_cms.ui.channels + path: . + options: + template: "@SyliusCmsPlugin/Grid/Field/channels.html.twig" filters: search: type: string @@ -42,9 +57,9 @@ sylius_grid: label: sylius.ui.type form_options: choices: - sylius.ui.image: !php/const BitBag\SyliusCmsPlugin\Entity\MediaInterface::IMAGE_TYPE - bitbag_sylius_cms_plugin.ui.file: !php/const BitBag\SyliusCmsPlugin\Entity\MediaInterface::FILE_TYPE - bitbag_sylius_cms_plugin.ui.video: !php/const BitBag\SyliusCmsPlugin\Entity\MediaInterface::VIDEO_TYPE + sylius.ui.image: !php/const Sylius\CmsPlugin\Entity\MediaInterface::IMAGE_TYPE + sylius_cms.ui.file: !php/const Sylius\CmsPlugin\Entity\MediaInterface::FILE_TYPE + sylius_cms.ui.video: !php/const Sylius\CmsPlugin\Entity\MediaInterface::VIDEO_TYPE actions: main: import: diff --git a/src/Resources/config/grids/admin/page.yml b/src/Resources/config/grids/admin/page.yml index 16c700ab5..fd37aa1ef 100755 --- a/src/Resources/config/grids/admin/page.yml +++ b/src/Resources/config/grids/admin/page.yml @@ -1,56 +1,57 @@ sylius_grid: grids: - bitbag_sylius_cms_plugin_admin_page: + sylius_cms_admin_page: driver: name: doctrine/orm options: - class: "%bitbag_sylius_cms_plugin.model.page.class%" - repository: - method: createListQueryBuilder - arguments: ["%locale%"] + class: "%sylius_cms.model.page.class%" sorting: code: asc limits: [10, 25, 50] fields: - page_image: + name: type: twig - label: bitbag_sylius_cms_plugin.ui.image + label: sylius_cms.ui.name + sortable: name path: . options: - template: "@BitBagSyliusCmsPlugin/Grid/Field/page_image.html.twig" + template: "@SyliusCmsPlugin/Grid/Field/name.html.twig" code: type: string - label: bitbag_sylius_cms_plugin.ui.code + label: sylius_cms.ui.code sortable: ~ - name: - type: string - label: bitbag_sylius_cms_plugin.ui.name - sortable: translation.name - slug: - type: string - label: bitbag_sylius_cms_plugin.ui.slug - sortable: translation.slug - sections: + enabled: + type: twig + label: sylius.ui.enabled + options: + template: "@SyliusUi/Grid/Field/enabled.html.twig" + collections: + type: twig + label: sylius_cms.ui.collections + path: . + options: + template: "@SyliusCmsPlugin/Grid/Field/collections.html.twig" + channels: type: twig - label: bitbag_sylius_cms_plugin.ui.sections + label: sylius_cms.ui.channels path: . options: - template: "@BitBagSyliusCmsPlugin/Grid/Field/sections.html.twig" + template: "@SyliusCmsPlugin/Grid/Field/channels.html.twig" filters: search: type: string label: sylius.ui.search options: fields: [code] - sections: + collections: type: entity - label: bitbag_sylius_cms_plugin.ui.sections + label: sylius_cms.ui.collections form_options: - class: "%bitbag_sylius_cms_plugin.model.section.class%" + class: "%sylius_cms.model.collection.class%" choice_label: name choice_value: code options: - fields: [sections.code] + fields: [collections.code] actions: main: import: diff --git a/src/Resources/config/grids/admin/template.yml b/src/Resources/config/grids/admin/template.yml new file mode 100755 index 000000000..1f82cae0f --- /dev/null +++ b/src/Resources/config/grids/admin/template.yml @@ -0,0 +1,42 @@ +sylius_grid: + grids: + sylius_cms_admin_template: + driver: + name: doctrine/orm + options: + class: "%sylius_cms.model.template.class%" + sorting: + name: asc + limits: [10, 25, 50] + fields: + name: + type: twig + label: sylius_cms.ui.name + sortable: name + path: . + options: + template: "@SyliusCmsPlugin/Grid/Field/name.html.twig" + type: + type: string + label: sylius.ui.type + sortable: ~ + filters: + search: + type: string + label: sylius.ui.search + options: + fields: [name] + enabled: + type: boolean + actions: + main: + create: + type: create + item: + update: + type: update + delete: + type: delete + bulk: + delete: + type: delete diff --git a/src/Resources/config/grids/shop.yml b/src/Resources/config/grids/shop.yml index 0c4485e93..e01ab3a15 100755 --- a/src/Resources/config/grids/shop.yml +++ b/src/Resources/config/grids/shop.yml @@ -1,2 +1,2 @@ imports: - - { resource: "@BitBagSyliusCmsPlugin/Resources/config/grids/shop/page.yml" } + - { resource: "@SyliusCmsPlugin/Resources/config/grids/shop/page.yml" } diff --git a/src/Resources/config/grids/shop/page.yml b/src/Resources/config/grids/shop/page.yml index 55c64fd27..5bfd0d705 100755 --- a/src/Resources/config/grids/shop/page.yml +++ b/src/Resources/config/grids/shop/page.yml @@ -1,14 +1,14 @@ sylius_grid: grids: - bitbag_sylius_cms_plugin_shop_page: + sylius_cms_shop_page: driver: name: doctrine/orm options: - class: "%bitbag_sylius_cms_plugin.model.page.class%" + class: "%sylius_cms.model.page.class%" repository: method: createShopListQueryBuilder arguments: - sectionCode: $sectionCode + collectionCode: $collectionCode channelCode: expr:service('sylius.context.channel').getChannel().getCode() sorting: createdAt: desc diff --git a/src/Resources/config/resources.yml b/src/Resources/config/resources.yml deleted file mode 100755 index 6812caa9d..000000000 --- a/src/Resources/config/resources.yml +++ /dev/null @@ -1,6 +0,0 @@ -imports: - - { resource: resources/block.yml } - - { resource: resources/page.yml } - - { resource: resources/frequently_asked_question.yml } - - { resource: resources/section.yml } - - { resource: resources/media.yml } diff --git a/src/Resources/config/resources/block.yml b/src/Resources/config/resources/block.yml deleted file mode 100755 index 119d65ea8..000000000 --- a/src/Resources/config/resources/block.yml +++ /dev/null @@ -1,15 +0,0 @@ -sylius_resource: - resources: - bitbag_sylius_cms_plugin.block: - driver: doctrine/orm - classes: - model: BitBag\SyliusCmsPlugin\Entity\Block - interface: BitBag\SyliusCmsPlugin\Entity\BlockInterface - form: BitBag\SyliusCmsPlugin\Form\Type\BlockType - repository: BitBag\SyliusCmsPlugin\Repository\BlockRepository - controller: BitBag\SyliusCmsPlugin\Controller\BlockController - factory: Sylius\Component\Resource\Factory\TranslatableFactory - translation: - classes: - model: BitBag\SyliusCmsPlugin\Entity\BlockTranslation - interface: BitBag\SyliusCmsPlugin\Entity\BlockTranslationInterface diff --git a/src/Resources/config/resources/frequently_asked_question.yml b/src/Resources/config/resources/frequently_asked_question.yml deleted file mode 100755 index 55f5b8dcc..000000000 --- a/src/Resources/config/resources/frequently_asked_question.yml +++ /dev/null @@ -1,14 +0,0 @@ -sylius_resource: - resources: - bitbag_sylius_cms_plugin.frequently_asked_question: - driver: doctrine/orm - classes: - model: BitBag\SyliusCmsPlugin\Entity\FrequentlyAskedQuestion - interface: BitBag\SyliusCmsPlugin\Entity\FrequentlyAskedQuestionInterface - form: BitBag\SyliusCmsPlugin\Form\Type\FrequentlyAskedQuestionType - repository: BitBag\SyliusCmsPlugin\Repository\FrequentlyAskedQuestionRepository - factory: Sylius\Component\Resource\Factory\TranslatableFactory - translation: - classes: - model: BitBag\SyliusCmsPlugin\Entity\FrequentlyAskedQuestionTranslation - interface: BitBag\SyliusCmsPlugin\Entity\FrequentlyAskedQuestionTranslationInterface diff --git a/src/Resources/config/resources/media.yml b/src/Resources/config/resources/media.yml deleted file mode 100644 index 2b183a478..000000000 --- a/src/Resources/config/resources/media.yml +++ /dev/null @@ -1,15 +0,0 @@ -sylius_resource: - resources: - bitbag_sylius_cms_plugin.media: - driver: doctrine/orm - classes: - model: BitBag\SyliusCmsPlugin\Entity\Media - interface: BitBag\SyliusCmsPlugin\Entity\MediaInterface - form: BitBag\SyliusCmsPlugin\Form\Type\MediaType - repository: BitBag\SyliusCmsPlugin\Repository\MediaRepository - controller: BitBag\SyliusCmsPlugin\Controller\MediaController - factory: Sylius\Component\Resource\Factory\TranslatableFactory - translation: - classes: - model: BitBag\SyliusCmsPlugin\Entity\MediaTranslation - interface: BitBag\SyliusCmsPlugin\Entity\MediaTranslationInterface diff --git a/src/Resources/config/resources/page.yml b/src/Resources/config/resources/page.yml deleted file mode 100755 index 3f4dbc20f..000000000 --- a/src/Resources/config/resources/page.yml +++ /dev/null @@ -1,15 +0,0 @@ -sylius_resource: - resources: - bitbag_sylius_cms_plugin.page: - driver: doctrine/orm - classes: - model: BitBag\SyliusCmsPlugin\Entity\Page - interface: BitBag\SyliusCmsPlugin\Entity\PageInterface - form: BitBag\SyliusCmsPlugin\Form\Type\PageType - repository: BitBag\SyliusCmsPlugin\Repository\PageRepository - controller: BitBag\SyliusCmsPlugin\Controller\PageController - factory: Sylius\Component\Resource\Factory\TranslatableFactory - translation: - classes: - model: BitBag\SyliusCmsPlugin\Entity\PageTranslation - interface: BitBag\SyliusCmsPlugin\Entity\PageTranslationInterface diff --git a/src/Resources/config/resources/section.yml b/src/Resources/config/resources/section.yml deleted file mode 100755 index 2a79787c0..000000000 --- a/src/Resources/config/resources/section.yml +++ /dev/null @@ -1,14 +0,0 @@ -sylius_resource: - resources: - bitbag_sylius_cms_plugin.section: - driver: doctrine/orm - classes: - model: BitBag\SyliusCmsPlugin\Entity\Section - interface: BitBag\SyliusCmsPlugin\Entity\SectionInterface - form: BitBag\SyliusCmsPlugin\Form\Type\SectionType - repository: BitBag\SyliusCmsPlugin\Repository\SectionRepository - factory: Sylius\Component\Resource\Factory\TranslatableFactory - translation: - classes: - model: BitBag\SyliusCmsPlugin\Entity\SectionTranslation - interface: BitBag\SyliusCmsPlugin\Entity\SectionTranslationInterface diff --git a/src/Resources/config/routing.yml b/src/Resources/config/routing.yml index d27bd1a9b..9c784f82e 100755 --- a/src/Resources/config/routing.yml +++ b/src/Resources/config/routing.yml @@ -1,7 +1,7 @@ -bitbag_sylius_cms_plugin_admin: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/admin.yml" +sylius_cms_admin: + resource: "@SyliusCmsPlugin/Resources/config/routing/admin.yml" prefix: '/%sylius_admin.path_name%' -bitbag_sylius_cms_plugin_shop: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/shop.yml" +sylius_cms_shop: + resource: "@SyliusCmsPlugin/Resources/config/routing/shop.yml" prefix: /{_locale} diff --git a/src/Resources/config/routing/admin.yml b/src/Resources/config/routing/admin.yml index 1bb6633ba..693e1199e 100755 --- a/src/Resources/config/routing/admin.yml +++ b/src/Resources/config/routing/admin.yml @@ -1,46 +1,46 @@ -bitbag_sylius_cms_plugin_admin_block: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/admin/block.yml" +sylius_cms_admin_block: + resource: "@SyliusCmsPlugin/Resources/config/routing/admin/block.yml" -bitbag_sylius_cms_plugin_admin_page: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/admin/page.yml" +sylius_cms_admin_page: + resource: "@SyliusCmsPlugin/Resources/config/routing/admin/page.yml" -bitbag_sylius_cms_plugin_admin_frequently_asked_question: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/admin/frequently_asked_question.yml" +sylius_cms_admin_collection: + resource: "@SyliusCmsPlugin/Resources/config/routing/admin/collection.yml" -bitbag_sylius_cms_plugin_admin_section: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/admin/section.yml" +sylius_cms_admin_media: + resource: "@SyliusCmsPlugin/Resources/config/routing/admin/media.yml" -bitbag_sylius_cms_plugin_admin_media: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/admin/media.yml" +sylius_cms_admin_product: + resource: "@SyliusCmsPlugin/Resources/config/routing/admin/product.yml" -bitbag_sylius_cms_plugin_admin_product: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/admin/product.yml" +sylius_cms_admin_taxon: + resource: "@SyliusCmsPlugin/Resources/config/routing/admin/taxon.yml" -bitbag_sylius_cms_plugin_admin_taxon: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/admin/taxon.yml" +sylius_cms_admin_locale: + resource: "@SyliusCmsPlugin/Resources/config/routing/admin/locale.yml" -bitbag_sylius_cms_plugin_admin_locale: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/admin/locale.yml" +sylius_cms_admin_template: + resource: "@SyliusCmsPlugin/Resources/config/routing/admin/template.yml" -bitbag_sylius_cms_plugin_admin_ajax_generate_page_slug: +sylius_cms_admin_ajax_generate_page_slug: path: /page/generate-slug methods: [GET] defaults: - _controller: bitbag_sylius_cms_plugin.controller.page_slug::generateAction + _controller: sylius_cms.controller.page_slug::generateAction -bitbag_sylius_cms_plugin_admin_import_data: +sylius_cms_admin_import_data: path: /import/{resourceName} methods: [GET, POST] defaults: - _controller: bitbag_sylius_cms_plugin.controller.action.admin.import_data + _controller: sylius_cms.controller.action.admin.import_data -bitbag_sylius_cms_plugin_admin_upload_editor_image: +sylius_cms_admin_upload_editor_image: path: /editor/upload-image defaults: - _controller: bitbag_sylius_cms_plugin.controller.action.admin.upload_editor_image + _controller: sylius_cms.controller.action.admin.upload_editor_image -bitbag_sylius_cms_plugin_admin_retrieve_package_info: +sylius_cms_admin_retrieve_package_info: path: /cms/retrieve-package-info methods: [GET] defaults: - _controller: bitbag_sylius_cms_plugin.controller.action.admin.retrieve_package_info + _controller: sylius_cms.controller.action.admin.retrieve_package_info diff --git a/src/Resources/config/routing/admin/block.yml b/src/Resources/config/routing/admin/block.yml index a9ea22c3e..d5b27c175 100755 --- a/src/Resources/config/routing/admin/block.yml +++ b/src/Resources/config/routing/admin/block.yml @@ -1,18 +1,18 @@ -bitbag_sylius_cms_plugin_admin_block: +sylius_cms_admin_block: resource: | - alias: bitbag_sylius_cms_plugin.block + alias: sylius_cms.block section: admin - templates: '@BitBagSyliusCmsPlugin/CrudUi' + templates: '@SyliusCmsPlugin/CrudUi' except: ['show'] redirect: update - grid: bitbag_sylius_cms_plugin_admin_block + grid: sylius_cms_admin_block permission: true vars: all: - header: bitbag_sylius_cms_plugin.ui.blocks_header - subheader: bitbag_sylius_cms_plugin.ui.blocks_subheader + header: sylius_cms.ui.blocks_header + subheader: sylius_cms.ui.blocks_subheader templates: - form: "@BitBagSyliusCmsPlugin/Block/Crud/_form.html.twig" + form: "@SyliusCmsPlugin/Block/Crud/_form.html.twig" index: icon: block layout route: @@ -20,10 +20,37 @@ bitbag_sylius_cms_plugin_admin_block: code: $type type: sylius.resource -bitbag_sylius_cms_plugin_admin_block_preview: +sylius_cms_admin_block_preview: path: /block/preview methods: [GET, POST, PUT] defaults: - _controller: bitbag_sylius_cms_plugin.controller.block::previewAction + _controller: sylius_cms.controller.block::previewAction _sylius: - template: "@BitBagSyliusCmsPlugin/Block/preview.html.twig" + template: "@SyliusCmsPlugin/Block/preview.html.twig" + +sylius_cms_admin_ajax_block_by_name_phrase: + path: /ajax/blocks/search + methods: [GET] + defaults: + _format: json + _controller: sylius_cms.controller.block::indexAction + _sylius: + serialization_groups: [Autocomplete] + permission: true + repository: + method: findByNamePart + arguments: + phrase: $phrase + +sylius_cms_admin_ajax_block_by_code: + path: /ajax/blocks/code + methods: [GET] + defaults: + _format: json + _controller: sylius_cms.controller.block::indexAction + _sylius: + serialization_groups: [Autocomplete] + permission: true + repository: + method: findBy + arguments: [code: $code] diff --git a/src/Resources/config/routing/admin/collection.yml b/src/Resources/config/routing/admin/collection.yml new file mode 100755 index 000000000..cca2c9984 --- /dev/null +++ b/src/Resources/config/routing/admin/collection.yml @@ -0,0 +1,60 @@ +sylius_cms_admin_collection: + resource: | + alias: sylius_cms.collection + section: admin + templates: '@SyliusCmsPlugin/CrudUi' + redirect: update + grid: sylius_cms_admin_collection + except: ['show'] + permission: true + vars: + all: + header: sylius_cms.ui.collections_header + subheader: sylius_cms.ui.collections_subheader + templates: + form: "@SyliusCmsPlugin/Collection/Crud/_form.html.twig" + index: + icon: grid layout + type: sylius.resource + +sylius_cms_admin_ajax_collection_by_name_phrase: + path: /ajax/collections/search + methods: [GET] + defaults: + _format: json + _controller: sylius_cms.controller.collection::indexAction + _sylius: + serialization_groups: [Autocomplete] + permission: true + repository: + method: findByNamePart + arguments: + phrase: $phrase + +sylius_cms_admin_ajax_page_collection_by_name_phrase: + path: /ajax/collections/page/search + methods: [GET] + defaults: + _format: json + _controller: sylius_cms.controller.collection::indexAction + _sylius: + serialization_groups: [Autocomplete] + permission: true + repository: + method: findByNamePartAndType + arguments: + phrase: $phrase + type: page + +sylius_cms_admin_ajax_collection_by_code: + path: /ajax/collections/code + methods: [GET] + defaults: + _format: json + _controller: sylius_cms.controller.collection::indexAction + _sylius: + serialization_groups: [Autocomplete] + permission: true + repository: + method: findBy + arguments: [code: $code] diff --git a/src/Resources/config/routing/admin/frequently_asked_question.yml b/src/Resources/config/routing/admin/frequently_asked_question.yml deleted file mode 100755 index 4d8112282..000000000 --- a/src/Resources/config/routing/admin/frequently_asked_question.yml +++ /dev/null @@ -1,18 +0,0 @@ -bitbag_sylius_cms_plugin_admin_frequently_asked_question: - resource: | - alias: bitbag_sylius_cms_plugin.frequently_asked_question - section: admin - templates: '@BitBagSyliusCmsPlugin/CrudUi' - redirect: update - grid: bitbag_sylius_cms_plugin_admin_frequently_asked_question - except: ['show'] - permission: true - vars: - all: - header: bitbag_sylius_cms_plugin.ui.faq_header - subheader: bitbag_sylius_cms_plugin.ui.faq_subheader - templates: - form: "@BitBagSyliusCmsPlugin/FrequentlyAskedQuestion/Crud/_form.html.twig" - index: - icon: help - type: sylius.resource diff --git a/src/Resources/config/routing/admin/locale.yml b/src/Resources/config/routing/admin/locale.yml index 9b398a5de..3a4e3fa6c 100644 --- a/src/Resources/config/routing/admin/locale.yml +++ b/src/Resources/config/routing/admin/locale.yml @@ -1,4 +1,4 @@ -bitbag_sylius_cms_plugin_admin_partial_locale_index: +sylius_cms_admin_partial_locale_index: path: /_partial/locales methods: [GET] defaults: diff --git a/src/Resources/config/routing/admin/media.yml b/src/Resources/config/routing/admin/media.yml index 33360ee08..2a799aec3 100644 --- a/src/Resources/config/routing/admin/media.yml +++ b/src/Resources/config/routing/admin/media.yml @@ -1,48 +1,43 @@ -bitbag_sylius_cms_plugin_admin_media: +sylius_cms_admin_media: resource: | - alias: bitbag_sylius_cms_plugin.media + alias: sylius_cms.media section: admin - templates: '@BitBagSyliusCmsPlugin/CrudUi' + templates: '@SyliusCmsPlugin/CrudUi' redirect: update - grid: bitbag_sylius_cms_plugin_admin_media + grid: sylius_cms_admin_media except: ['show'] permission: true vars: all: - header: bitbag_sylius_cms_plugin.ui.media_header - subheader: bitbag_sylius_cms_plugin.ui.media_subheader + header: sylius_cms.ui.media_header + subheader: sylius_cms.ui.media_subheader templates: - form: "@BitBagSyliusCmsPlugin/Media/Crud/_form.html.twig" + form: "@SyliusCmsPlugin/Media/Crud/_form.html.twig" index: icon: file type: sylius.resource -bitbag_sylius_cms_plugin_admin_media_preview: - path: /media/preview/{id} - methods: [GET, POST, PUT] - defaults: - _controller: bitbag_sylius_cms_plugin.controller.media.overriden::previewAction - _sylius: - template: "@BitBagSyliusCmsPlugin/Media/preview.html.twig" - id: null - -bitbag_sylius_cms_plugin_admin_ajax_media_by_name_phrase: +sylius_cms_admin_ajax_media_by_name_phrase: path: /ajax/media/search methods: [GET] defaults: _format: json - _controller: bitbag_sylius_cms_plugin.controller.media.overriden::indexAction + _controller: sylius_cms.controller.media.overriden::indexAction _sylius: - serialization_groups: [Default, Autocomplete] + serialization_groups: [Autocomplete] permission: true - grid: bitbag_sylius_cms_plugin_admin_media + repository: + method: findByNamePart + arguments: + phrase: $phrase + mediaType: $mediaType -bitbag_sylius_cms_plugin_admin_ajax_media_by_code: +sylius_cms_admin_ajax_media_by_code: path: /ajax/media/code methods: [GET] defaults: _format: json - _controller: bitbag_sylius_cms_plugin.controller.media.overriden::indexAction + _controller: sylius_cms.controller.media.overriden::indexAction _sylius: serialization_groups: [Autocomplete] permission: true diff --git a/src/Resources/config/routing/admin/page.yml b/src/Resources/config/routing/admin/page.yml index d1ed40f68..8f9200f98 100755 --- a/src/Resources/config/routing/admin/page.yml +++ b/src/Resources/config/routing/admin/page.yml @@ -1,27 +1,54 @@ -bitbag_sylius_cms_plugin_admin_page: +sylius_cms_admin_page: resource: | - alias: bitbag_sylius_cms_plugin.page + alias: sylius_cms.page section: admin - templates: '@BitBagSyliusCmsPlugin/CrudUi' + templates: '@SyliusCmsPlugin/CrudUi' redirect: update - grid: bitbag_sylius_cms_plugin_admin_page + grid: sylius_cms_admin_page except: ['show'] permission: true vars: all: - header: bitbag_sylius_cms_plugin.ui.pages_header - subheader: bitbag_sylius_cms_plugin.ui.pages_subheader + header: sylius_cms.ui.pages_header + subheader: sylius_cms.ui.pages_subheader templates: - form: "@BitBagSyliusCmsPlugin/Page/Crud/_form.html.twig" + form: "@SyliusCmsPlugin/Page/Crud/_form.html.twig" index: icon: sticky note type: sylius.resource -bitbag_sylius_cms_plugin_admin_page_preview: +sylius_cms_admin_page_preview: path: /page/preview/{id} methods: [GET, POST, PUT] defaults: - _controller: bitbag_sylius_cms_plugin.controller.page.overriden::previewAction + _controller: sylius_cms.controller.page.overriden::previewAction _sylius: - template: "@BitBagSyliusCmsPlugin/Page/preview.html.twig" + template: "@SyliusCmsPlugin/Page/preview.html.twig" id: null + +sylius_cms_admin_ajax_page_by_name_phrase: + path: /ajax/pages/search + methods: [GET] + defaults: + _format: json + _controller: sylius_cms.controller.page::indexAction + _sylius: + serialization_groups: [Autocomplete] + permission: true + repository: + method: findByNamePart + arguments: + phrase: $phrase + +sylius_cms_admin_ajax_page_by_code: + path: /ajax/pages/code + methods: [GET] + defaults: + _format: json + _controller: sylius_cms.controller.page::indexAction + _sylius: + serialization_groups: [Autocomplete] + permission: true + repository: + method: findBy + arguments: [code: $code] diff --git a/src/Resources/config/routing/admin/product.yml b/src/Resources/config/routing/admin/product.yml index ef296f342..0e0168796 100644 --- a/src/Resources/config/routing/admin/product.yml +++ b/src/Resources/config/routing/admin/product.yml @@ -1,6 +1,6 @@ -bitbag_sylius_cms_plugin_admin_ajax_product_by_name_phrase: +sylius_cms_admin_ajax_product_by_name_phrase: path: /ajax/products/search-by-name methods: [GET] defaults: _format: json - _controller: bitbag_sylius_cms_plugin.controller.action.admin.product_search + _controller: sylius_cms.controller.action.admin.product_search diff --git a/src/Resources/config/routing/admin/section.yml b/src/Resources/config/routing/admin/section.yml deleted file mode 100755 index 18af15ec5..000000000 --- a/src/Resources/config/routing/admin/section.yml +++ /dev/null @@ -1,46 +0,0 @@ -bitbag_sylius_cms_plugin_admin_section: - resource: | - alias: bitbag_sylius_cms_plugin.section - section: admin - templates: '@BitBagSyliusCmsPlugin/CrudUi' - redirect: update - grid: bitbag_sylius_cms_plugin_admin_section - except: ['show'] - permission: true - vars: - all: - header: bitbag_sylius_cms_plugin.ui.sections_header - subheader: bitbag_sylius_cms_plugin.ui.sections_subheader - templates: - form: "@BitBagSyliusCmsPlugin/Section/Crud/_form.html.twig" - index: - icon: grid layout - type: sylius.resource - -bitbag_sylius_cms_plugin_admin_ajax_section_by_name_phrase: - path: /ajax/sections/search - methods: [GET] - defaults: - _format: json - _controller: bitbag_sylius_cms_plugin.controller.section::indexAction - _sylius: - serialization_groups: [Autocomplete] - permission: true - repository: - method: findByNamePart - arguments: - phrase: $phrase - locale: null - -bitbag_sylius_cms_plugin_admin_ajax_section_by_code: - path: /ajax/sections/code - methods: [GET] - defaults: - _format: json - _controller: bitbag_sylius_cms_plugin.controller.section::indexAction - _sylius: - serialization_groups: [Autocomplete] - permission: true - repository: - method: findBy - arguments: [code: $code] diff --git a/src/Resources/config/routing/admin/taxon.yml b/src/Resources/config/routing/admin/taxon.yml index 9a26281ee..fa191797b 100644 --- a/src/Resources/config/routing/admin/taxon.yml +++ b/src/Resources/config/routing/admin/taxon.yml @@ -1,6 +1,6 @@ -bitbag_sylius_cms_plugin_admin_ajax_taxon_by_name_phrase: +sylius_cms_admin_ajax_taxon_by_name_phrase: path: /ajax/taxon/search-by-name methods: [GET] defaults: _format: json - _controller: bitbag_sylius_cms_plugin.controller.action.admin.taxon_search + _controller: sylius_cms.controller.action.admin.taxon_search diff --git a/src/Resources/config/routing/admin/template.yml b/src/Resources/config/routing/admin/template.yml new file mode 100755 index 000000000..9ce48ee6b --- /dev/null +++ b/src/Resources/config/routing/admin/template.yml @@ -0,0 +1,68 @@ +sylius_cms_admin_template: + resource: | + alias: sylius_cms.template + section: admin + templates: '@SyliusCmsPlugin/CrudUi' + except: ['show'] + redirect: update + grid: sylius_cms_admin_template + permission: true + vars: + all: + templates: + form: "@SyliusCmsPlugin/ContentTemplate/Crud/_form.html.twig" + index: + icon: block layout + type: sylius.resource + +sylius_cms_admin_ajax_template_page_by_name_phrase: + path: /ajax/templates/page/search + methods: [GET] + defaults: + _format: json + _controller: sylius_cms.controller.template::indexAction + _sylius: + serialization_groups: [Autocomplete] + permission: true + repository: + method: findTemplatesByNamePart + arguments: + phrase: $phrase + type: page + +sylius_cms_admin_ajax_template_block_by_name_phrase: + path: /ajax/templates/block/search + methods: [GET] + defaults: + _format: json + _controller: sylius_cms.controller.template::indexAction + _sylius: + serialization_groups: [Autocomplete] + permission: true + repository: + method: findTemplatesByNamePart + arguments: + phrase: $phrase + type: block + +sylius_cms_admin_ajax_template_by_id: + path: /ajax/templates/id + methods: [GET] + defaults: + _format: json + _controller: sylius_cms.controller.template::indexAction + _sylius: + serialization_groups: [Autocomplete] + permission: true + repository: + method: find + arguments: [id: $id] + +sylius_cms_admin_ajax_template_content_by_id: + path: /ajax/templates/content/{id} + methods: [GET] + defaults: + _format: json + _controller: sylius_cms.controller.action.admin.template_content_elements::getContentElementsAction + _sylius: + permission: true diff --git a/src/Resources/config/routing/shop.yml b/src/Resources/config/routing/shop.yml index 596f3276e..bd3c5283f 100755 --- a/src/Resources/config/routing/shop.yml +++ b/src/Resources/config/routing/shop.yml @@ -1,14 +1,11 @@ -bitbag_sylius_cms_plugin_shop_block: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/shop/block.yml" +sylius_cms_shop_block: + resource: "@SyliusCmsPlugin/Resources/config/routing/shop/block.yml" -bitbag_sylius_cms_plugin_shop_page: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/shop/page.yml" +sylius_cms_shop_page: + resource: "@SyliusCmsPlugin/Resources/config/routing/shop/page.yml" -bitbag_sylius_cms_plugin_shop_frequently_asked_question: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/shop/frequently_asked_question.yml" +sylius_cms_shop_collection: + resource: "@SyliusCmsPlugin/Resources/config/routing/shop/collection.yml" -bitbag_sylius_cms_plugin_shop_section: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/shop/section.yml" - -bitbag_sylius_cms_plugin_shop_media: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/shop/media.yml" +sylius_cms_shop_media: + resource: "@SyliusCmsPlugin/Resources/config/routing/shop/media.yml" diff --git a/src/Resources/config/routing/shop/block.yml b/src/Resources/config/routing/shop/block.yml index d597c0cbb..e639af5fe 100755 --- a/src/Resources/config/routing/shop/block.yml +++ b/src/Resources/config/routing/shop/block.yml @@ -1,38 +1,23 @@ -bitbag_sylius_cms_plugin_shop_block_render: +sylius_cms_shop_block_render: path: /block/{code} methods: [GET] defaults: - _controller: bitbag_sylius_cms_plugin.controller.block::renderBlockAction + _controller: sylius_cms.controller.block::renderBlockAction _sylius: repository: method: findOneByCode arguments: - $code -bitbag_sylius_cms_plugin_shop_block_index_by_section_code: - path: /blocks/section/{sectionCode} +sylius_cms_shop_block_index_by_collection_code: + path: /blocks/collection/{collectionCode} methods: [GET] defaults: - _controller: bitbag_sylius_cms_plugin.controller.block::indexAction + _controller: sylius_cms.controller.block::indexAction _sylius: template: $template repository: - method: findBySectionCode + method: findByCollectionCode arguments: - - $sectionCode - - "expr:service('sylius.context.locale').getLocaleCode()" - - "expr:service('sylius.context.channel').getChannel().getCode()" - -bitbag_sylius_cms_plugin_shop_block_index_by_product_code: - path: /blocks/product/{productCode} - methods: [GET] - defaults: - _controller: bitbag_sylius_cms_plugin.controller.block::indexAction - _sylius: - template: $template - repository: - method: findByProductCode - arguments: - - $productCode - - "expr:service('sylius.context.locale').getLocaleCode()" + - $collectionCode - "expr:service('sylius.context.channel').getChannel().getCode()" diff --git a/src/Resources/config/routing/shop/collection.yml b/src/Resources/config/routing/shop/collection.yml new file mode 100755 index 000000000..0c045b479 --- /dev/null +++ b/src/Resources/config/routing/shop/collection.yml @@ -0,0 +1,23 @@ +sylius_cms_shop_collection_show: + path: /collection/{code} + methods: [GET] + defaults: + _controller: sylius_cms.controller.collection::showAction + _sylius: + template: $template + repository: + method: findOneByCode + arguments: + - $code + +sylius_cms_shop_collection_show_codes: + path: /collections/{codes} + methods: [GET] + defaults: + _controller: sylius_cms.controller.collection::indexAction + _sylius: + template: $template + repository: + method: findByCodes + arguments: + - $codes diff --git a/src/Resources/config/routing/shop/frequently_asked_question.yml b/src/Resources/config/routing/shop/frequently_asked_question.yml deleted file mode 100755 index a9927601a..000000000 --- a/src/Resources/config/routing/shop/frequently_asked_question.yml +++ /dev/null @@ -1,11 +0,0 @@ -bitbag_sylius_cms_plugin_shop_frequently_asked_question_index: - path: /faq - defaults: - _controller: bitbag_sylius_cms_plugin.controller.frequently_asked_question::indexAction - _sylius: - template: "@BitBagSyliusCmsPlugin/Shop/FrequentlyAskedQuestion/index.html.twig" - repository: - method: findEnabledOrderedByPosition - arguments: - - "expr:service('sylius.context.locale').getLocaleCode()" - - "expr:service('sylius.context.channel').getChannel().getCode()" diff --git a/src/Resources/config/routing/shop/media.yml b/src/Resources/config/routing/shop/media.yml index b40e4d5c6..6f1791f32 100755 --- a/src/Resources/config/routing/shop/media.yml +++ b/src/Resources/config/routing/shop/media.yml @@ -1,61 +1,19 @@ -bitbag_sylius_cms_plugin_shop_media_render: +sylius_cms_shop_media_render: path: /media/{code} methods: [GET] defaults: - _controller: bitbag_sylius_cms_plugin.controller.media.overriden::renderMediaAction + _controller: sylius_cms_plugin.controller.media.overriden::renderMediaAction -bitbag_sylius_cms_plugin_shop_media_render_template: - path: /media-template/{code} - methods: [GET] - defaults: - _controller: bitbag_sylius_cms_plugin.controller.media.overriden::showAction - _sylius: - template: $template - repository: - method: findOneEnabledByCode - arguments: - - $code - - "expr:service('sylius.context.locale').getLocaleCode()" - - "expr:service('sylius.context.channel').getChannel().getCode()" - -bitbag_sylius_cms_plugin_shop_media_download: +sylius_cms_shop_media_download: path: /media/download/{code} methods: [GET] defaults: - _controller: bitbag_sylius_cms_plugin.controller.media.overriden::downloadMediaAction + _controller: sylius_cms_plugin.controller.media.overriden::downloadMediaAction disposition: !php/const Symfony\Component\HttpFoundation\ResponseHeaderBag::DISPOSITION_ATTACHMENT -bitbag_sylius_cms_plugin_shop_media_inline: +sylius_cms_shop_media_inline: path: /media/inline/{code} methods: [GET] defaults: - _controller: bitbag_sylius_cms_plugin.controller.media.overriden::downloadMediaAction + _controller: sylius_cms_plugin.controller.media.overriden::downloadMediaAction disposition: !php/const Symfony\Component\HttpFoundation\ResponseHeaderBag::DISPOSITION_INLINE - -bitbag_sylius_cms_plugin_shop_media_index_by_section_code: - path: /media/section/{sectionCode} - methods: [GET] - defaults: - _controller: bitbag_sylius_cms_plugin.controller.media.overriden::indexAction - _sylius: - template: $template - repository: - method: findBySectionCode - arguments: - - $sectionCode - - "expr:service('sylius.context.locale').getLocaleCode()" - - "expr:service('sylius.context.channel').getChannel().getCode()" - -bitbag_sylius_cms_plugin_shop_media_index_by_product_code: - path: /media/product/{productCode} - methods: [GET] - defaults: - _controller: bitbag_sylius_cms_plugin.controller.media.overriden::indexAction - _sylius: - template: $template - repository: - method: findByProductCode - arguments: - - $productCode - - "expr:service('sylius.context.locale').getLocaleCode()" - - "expr:service('sylius.context.channel').getChannel().getCode()" diff --git a/src/Resources/config/routing/shop/page.yml b/src/Resources/config/routing/shop/page.yml index be23e1dfe..d015cf27c 100755 --- a/src/Resources/config/routing/shop/page.yml +++ b/src/Resources/config/routing/shop/page.yml @@ -1,67 +1,55 @@ -bitbag_sylius_cms_plugin_shop_page_show: +sylius_cms_shop_page_show: path: /page/{slug} methods: [GET] defaults: - _controller: bitbag_sylius_cms_plugin.controller.page.overriden::showAction - _sylius: - template: "@BitBagSyliusCmsPlugin/Shop/Page/show.html.twig" - repository: - method: findOneEnabledBySlugAndChannelCode - arguments: - - $slug - - "expr:service('sylius.context.locale').getLocaleCode()" - - "expr:service('sylius.context.channel').getChannel().getCode()" + _controller: sylius_cms.controller.page.overriden::showAction -bitbag_sylius_cms_plugin_shop_page_show_link_by_code: +sylius_cms_shop_page_show_link_by_code: path: /page/link/{code} methods: [GET] defaults: - _controller: bitbag_sylius_cms_plugin.controller.page.overriden::renderLinkAction + _controller: sylius_cms.controller.page.overriden::renderLinkAction _sylius: template: $template repository: method: findOneEnabledByCode arguments: - $code - - "expr:service('sylius.context.locale').getLocaleCode()" -bitbag_sylius_cms_plugin_shop_page_index_by_section_code: - path: /pages/{sectionCode} +sylius_cms_shop_page_index_by_collection_code: + path: /page/{collectionCode} methods: [GET] defaults: - _controller: bitbag_sylius_cms_plugin.controller.page.overriden::indexAction + _controller: sylius_cms.controller.page.overriden::indexAction _sylius: - template: "@BitBagSyliusCmsPlugin/Shop/Page/index.html.twig" - grid: bitbag_sylius_cms_plugin_shop_page + template: "@SyliusCmsPlugin/Shop/Page/index.html.twig" + grid: sylius_cms_shop_page repository: - method: findBySectionCode + method: findByCollectionCode arguments: - - $sectionCode - - "expr:service('sylius.context.locale').getLocaleCode()" + - $collectionCode -bitbag_sylius_cms_plugin_shop_page_index_by_section_code_no_grid: - path: /pages/{sectionCode}/no-grid +sylius_cms_shop_page_index_by_collection_code_no_grid: + path: /pages/{collectionCode}/no-grid methods: [GET] defaults: - _controller: bitbag_sylius_cms_plugin.controller.page.overriden::indexAction + _controller: sylius_cms.controller.page.overriden::indexAction _sylius: - template: "@BitBagSyliusCmsPlugin/Shop/Page/index.html.twig" + template: "@SyliusCmsPlugin/Shop/Page/index.html.twig" repository: - method: findBySectionCode + method: findByCollectionCode arguments: - - $sectionCode - - "expr:service('sylius.context.locale').getLocaleCode()" + - $collectionCode -bitbag_sylius_cms_plugin_shop_page_index_by_section_code_template: - path: /pages-template/{sectionCode} +sylius_cms_shop_page_index_by_collection_code_template: + path: /pages-template/{collectionCode} methods: [GET] defaults: - _controller: bitbag_sylius_cms_plugin.controller.page.overriden::indexAction + _controller: sylius_cms.controller.page.overriden::indexAction _sylius: template: $template - grid: bitbag_sylius_cms_plugin_shop_page + grid: sylius_cms_shop_page repository: - method: findBySectionCode + method: findByCollectionCode arguments: - - $sectionCode - - "expr:service('sylius.context.locale').getLocaleCode()" + - $collectionCode diff --git a/src/Resources/config/routing/shop/section.yml b/src/Resources/config/routing/shop/section.yml deleted file mode 100755 index 9c40f6185..000000000 --- a/src/Resources/config/routing/shop/section.yml +++ /dev/null @@ -1,26 +0,0 @@ -bitbag_sylius_cms_plugin_shop_section_show: - path: /section/{code} - methods: [GET] - defaults: - _controller: bitbag_sylius_cms_plugin.controller.section::showAction - _sylius: - template: $template - repository: - method: findOneByCode - arguments: - - $code - - "expr:service('sylius.context.locale').getLocaleCode()" - -bitbag_sylius_cms_plugin_shop_section_show_codes: - path: /sections/{codes} - methods: [GET] - defaults: - _controller: bitbag_sylius_cms_plugin.controller.section::indexAction - _sylius: - template: $template - repository: - method: findByCodesAndLocale - arguments: - - $codes - - "expr:service('sylius.context.locale').getLocaleCode()" - diff --git a/src/Resources/config/serialization/Block.xml b/src/Resources/config/serialization/Block.xml index 0faacbba8..c0648ecd9 100644 --- a/src/Resources/config/serialization/Block.xml +++ b/src/Resources/config/serialization/Block.xml @@ -3,30 +3,40 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/serializer-mapping https://symfony.com/schema/dic/serializer-mapping/serializer-mapping-1.0.xsd" > -