Skip to content

Commit

Permalink
Merge pull request #1 from bitbag-commerce/master
Browse files Browse the repository at this point in the history
Sync from master
  • Loading branch information
shinoks authored Sep 13, 2017
2 parents de4d63c + 1c53a74 commit 670564f
Show file tree
Hide file tree
Showing 161 changed files with 13,903 additions and 1,867 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
/vendor/

/node_modules/
tests/Application/node_modules/

/etc/build/*
!/etc/build/.gitkeep

tests/Application/var/
!tests/Application/var/.gitkeep

!tests/Application/web/app_test.php
tests/Application/web/media/*
tests/Application/web/bundles
6 changes: 1 addition & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,21 @@ language: php

php:
- 7.1
- 7.0
- 5.6

cache:
directories:
- ~/.composer/cache/files
#yarn: true

before_install:
- phpenv config-rm xdebug.ini || true
- echo "memory_limit=4096M" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini

install:
- composer update --prefer-dist
#- (cd tests/Application && yarn install)

before_script:
- (cd tests/Application && bin/console doctrine:schema:create --env=test)
- (cd tests/Application && bin/console assets:install web --env=test)
#- (cd tests/Application && yarn run gulp)

- /sbin/start-stop-daemon --start --quiet --pidfile /tmp/xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1680x1050x16
- export DISPLAY=:99
Expand All @@ -35,5 +30,6 @@ before_script:
script:
- composer validate --strict

- vendor/bin/phpspec run
- vendor/bin/behat --strict -vvv --no-interaction --tags ~@javascript

49 changes: 45 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
![BitBag](https://bitbag.pl/static/bitbag-logo.png)

# BitBag CmsPlugin [![Build Status](https://travis-ci.org/bitbag-commerce/CmsPlugin.svg?branch=master)](https://travis-ci.org/bitbag-commerce/CmsPlugin)

## Overview

Because the original Lakion CMS plugin does not work as expected, it uses deprecated bundles and in general is not finished and EZ Platform is often too much for basic CMS usage, we decided to start the development of CMS plugin from scratch. So far it supports dynamic images and text blocks but things like pages, product images, etc. still need to be developed. Contributors are warmly welcomed!
Many of Sylius community folks asked about the right CMS plugin for their Sylius instances. Because the original Lakion CMS plugin does not work as expected, it uses deprecated bundles and in general is not finished and EZ Platform is often too much for basic CMS usage, we decided to start the development of CMS plugin from scratch.
So far it supports dynamic images and text blocks as well as pages with custom content.
This plugin was developed with BDD rules in mind, so it's probably the most stable CMS for Sylius available for now.
It is still a little bit basic, but we are planning to make it more advanced in incoming future. Contributors, ideas as well as any feedback warmly welcomed!

## Installation
```bash
$ composer require bitbag/cms-plugin
$ bin/console doctrine:schema:update --force
$ bin/console assets:install
```

Add plugin dependencies to your AppKernel.php file:
Expand All @@ -29,7 +36,7 @@ Import required config in your `app/config/config.yml` file:
imports:
...

- { resource: "@BitBagCmsPlugin/Resources/config/config.yml" }
- { resource: '@BitBagCmsPlugin/Resources/config/config.yml' }
```
Import routing in your `app/config/routing.yml` file:
Expand All @@ -45,7 +52,41 @@ bitbag_cms_plugin:

## Usage

In the admin panel you can now create image and text blocks. Both can be rendered in your twig templates using `bitbag_render_block([block_code])` helper extension.
### Blocks

In the admin panel, you can now create image and text blocks. Both can be rendered in your twig templates using `bitbag_render_block([block_code])` helper extension.
For instance, let's assume you have created a block with `homepage_text_block` code and want it to be rendered on store homepage.
In your `app/Resources/views/SyliusShopBundle/Homepage/index.html.twig` file add the twig filter like this:

```twig
{% extends '@SyliusShop/layout.html.twig' %}
{% block content %}
<h2 class="ui horizontal section divider header">
{{ 'sylius.ui.latest_products'|trans }}
</h2>
{{ bitbag_render_block('homepage_text_block') }}
{{ render(url('sylius_shop_partial_product_index_latest', {'count': 4, 'template': '@SyliusShop/Product/_horizontalList.html.twig'})) }}
{% endblock %}
```

### Pages

For rendering pages you can use `bitbag_cms_shop_page_show` route which takes the `slug` as a parameter. You can also override the page template.
For more information about how to do it, read [Sylius template customization guide](http://docs.sylius.org/en/latest/customization/template.html). If you are lazy guy, take a look at
`vendor/bitbag/cms-plugin/src/Resources/views/Page/show.html.twig` template, create `show.html.twig` file in `app/Resources/BitBagCmsPlugin/views` directory and paste
the vendor's `show.html.twig` file content to it.
Now you can do whatever you want with it :slightly_smiling_face:

There's also a twig method which allows rendering the link template for the page by its code named `bitbag_render_page_link_by_code` which obviously takes the code as a parameter.

### WYSIWYG Editor (CKEditor or any other which supports Symfony)

For now you can install CKEditor, create proper form extension and replace `Textarea[Text]Type::class` with `CKEditorType::class`.
For more - take a look at [Symfony CKEditor installation manual](http://symfony.com/doc/master/bundles/IvoryCKEditorBundle/installation.html) and [Symfony form extension "how to" guide](https://symfony.com/doc/current/form/create_form_type_extension.html).
To see which forms you may want to extend, run `$ bin/console debug:container | grep bitbag.cms_plugin.form` command.

## Testing
```bash
Expand All @@ -62,4 +103,4 @@ $ bin/phpspec run

## Contribution

Learn more about our contribution workflow on http://docs.sylius.org/en/latest/contributing/.
Learn more about our contribution workflow on http://docs.sylius.org/en/latest/contributing/.
6 changes: 4 additions & 2 deletions behat.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ default:
FriendsOfBehat\ContextServiceExtension:
imports:
- vendor/sylius/sylius/src/Sylius/Behat/Resources/config/services.xml
- tests/Behat/Resources/services.xml
- tests/Behat/Resources/pages.yml
- tests/Behat/Resources/contexts.yml
- tests/Behat/Resources/services.yml

FriendsOfBehat\SymfonyExtension:
kernel:
class: AppKernel
path: tests/Application/app/AppKernel.php
bootstrap: tests/Application/app/autoload.php
bootstrap: tests/Application/app/autoload.php
6 changes: 2 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@
"description": "CMS plugin for Sylius applications.",
"license": "MIT",
"require": {
"php": "^5.6|^7.0",

"sylius/sylius": "^1.0.0@beta"
"php": "^7.1",
"sylius/sylius": "^1.0.0-rc.1"
},
"require-dev": {
"phpspec/phpspec": "^3.2",
"phpunit/phpunit": "^5.6",
"behat/behat": "^3.3",
"behat/mink": "^1.7",
"behat/mink-browserkit-driver": "^1.3",
Expand Down
Loading

0 comments on commit 670564f

Please sign in to comment.