mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-10 16:55:00 +00:00
Compare commits
58 Commits
bootstrap-
...
fix-person
Author | SHA1 | Date | |
---|---|---|---|
7d130277d6 | |||
1b6aa7f1a1 | |||
4c82e65c1f | |||
cf4d7df7ad | |||
19fdf2a503 | |||
|
5448238697 | ||
|
c5250a1059 | ||
49c6915c0a | |||
6e81ef0065 | |||
e3cc76c689 | |||
b43f43fa0b | |||
f02d6df262 | |||
e4e2138765 | |||
395735e6f7 | |||
2c96c02261 | |||
53813f8f29 | |||
|
b8ef0d28f5 | ||
|
e973c4013f | ||
|
0f9a395dfc | ||
|
38ac3badef | ||
|
cda32fb925 | ||
|
58cb34f39b | ||
66426f5102 | |||
3445335b2d | |||
e52a9a4330 | |||
8adb05c24f | |||
b1207cbd3e | |||
|
09ed671734 | ||
93260ea36f | |||
|
8756982a78 | ||
a8f55e064d | |||
7df753f1cb | |||
b0fc4e190f | |||
928e0e1eed | |||
28e4b2abaf | |||
c5b21f360c | |||
2de8338651 | |||
fbec64664f | |||
6c81fe4ef2 | |||
520c0e0f96 | |||
2647d4c6a7 | |||
e7df62b373 | |||
c6a87f1286 | |||
d57cfe09c8 | |||
38cba4948b | |||
b2ff470720 | |||
69ea88a4d5 | |||
9566ea89b1 | |||
425d51649f | |||
c32f730713 | |||
a48d6d2a0a | |||
16b155d449 | |||
083f56bff0 | |||
f526453ba3 | |||
89d95a0eae | |||
6bcdbaf668 | |||
0a0895584c | |||
d7d8f2a60a |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,6 +1,8 @@
|
|||||||
.composer/*
|
.composer/*
|
||||||
composer.phar
|
composer.phar
|
||||||
|
composer.lock
|
||||||
|
|
||||||
|
docs/build/
|
||||||
|
|
||||||
###> symfony/framework-bundle ###
|
###> symfony/framework-bundle ###
|
||||||
/.env.local
|
/.env.local
|
||||||
|
@@ -1,46 +1,37 @@
|
|||||||
# This file is a template, and might need editing before it works on your project.
|
---
|
||||||
# Select image from https://hub.docker.com/_/php/
|
image: registry.gitlab.com/chill-projet/chill-app/php-base-image:7.4
|
||||||
image: php:7.4
|
|
||||||
|
|
||||||
# Select what we should cache between builds
|
# Select what we should cache between builds
|
||||||
cache:
|
cache:
|
||||||
paths:
|
paths:
|
||||||
- vendor/
|
- tests/app/vendor/
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- apt-get update -yqq
|
# add extensions to postgres
|
||||||
- apt-get install -yqq git libicu-dev g++ postgresql-server-dev-10 libzip-dev libzip4 unzip libfreetype6-dev libonig-dev `# install oniguruma, required for mbstring` libpng-dev libjpeg62-turbo-dev
|
- PGPASSWORD=$POSTGRES_PASSWORD psql -U $POSTGRES_USER -h db -c "CREATE EXTENSION IF NOT EXISTS unaccent; CREATE EXTENSION IF NOT EXISTS pg_trgm;"
|
||||||
# Install PHP extensions
|
|
||||||
- docker-php-ext-configure gd --with-freetype --with-jpeg
|
|
||||||
- docker-php-ext-install intl pdo_pgsql mbstring zip bcmath sockets exif
|
|
||||||
- mkdir /tmp/redis \
|
|
||||||
&& curl -L -o /tmp/redis/redis.tar.gz https://github.com/phpredis/phpredis/archive/$PHPREDIS_VERSION.tar.gz \
|
|
||||||
&& cd /tmp/redis \
|
|
||||||
&& tar xfz /tmp/redis/redis.tar.gz \
|
|
||||||
&& rm -r /tmp/redis/redis.tar.gz \
|
|
||||||
&& mkdir -p /usr/src/php/ext/redis \
|
|
||||||
&& mv /tmp/redis/phpredis-$PHPREDIS_VERSION/* /usr/src/php/ext/redis/. \
|
|
||||||
&& docker-php-ext-install redis
|
|
||||||
# Install & enable Xdebug for code coverage reports
|
|
||||||
# - pecl install xdebug
|
|
||||||
#- docker-php-ext-enable xdebug
|
|
||||||
# Install and run Composer
|
# Install and run Composer
|
||||||
- curl -sS https://getcomposer.org/installer | php
|
- curl -sS https://getcomposer.org/installer | php
|
||||||
- php composer.phar install
|
- php composer.phar install
|
||||||
|
- php tests/app/bin/console doctrine:migrations:migrate -n
|
||||||
|
- php tests/app/bin/console doctrine:fixtures:load -n
|
||||||
|
|
||||||
# Bring in any services we need http://docs.gitlab.com/ee/ci/docker/using_docker_images.html#what-is-a-service
|
# Bring in any services we need http://docs.gitlab.com/ee/ci/docker/using_docker_images.html#what-is-a-service
|
||||||
# See http://docs.gitlab.com/ee/ci/services/README.html for examples.
|
# See http://docs.gitlab.com/ee/ci/services/README.html for examples.
|
||||||
services:
|
services:
|
||||||
- postgresql:12
|
- name: postgres:12
|
||||||
|
alias: db
|
||||||
|
- name: redis
|
||||||
|
alias: redis
|
||||||
|
|
||||||
# Set any variables we need
|
# Set any variables we need
|
||||||
variables:
|
variables:
|
||||||
# Configure postgres environment variables (https://hub.docker.com/r/_/postgres/)
|
# Configure postgres environment variables (https://hub.docker.com/r/_/postgres/)
|
||||||
POSTGRES_USER=postgres
|
POSTGRES_USER: postgres
|
||||||
POSTGRES_PASSWORD=postgres
|
POSTGRES_PASSWORD: postgres
|
||||||
|
# fetch the chill-app using git submodules
|
||||||
|
GIT_SUBMODULE_STRATEGY: recursive
|
||||||
|
|
||||||
# Run our tests
|
# Run our tests
|
||||||
# If Xdebug was installed you can generate a coverage report and see code coverage metrics.
|
|
||||||
test:
|
test:
|
||||||
script:
|
script:
|
||||||
- bin/phpunit --colors=never
|
- bin/phpunit --colors=never
|
||||||
|
@@ -42,6 +42,7 @@
|
|||||||
"symfony/validator": "4.*",
|
"symfony/validator": "4.*",
|
||||||
"sensio/framework-extra-bundle": "^5.5",
|
"sensio/framework-extra-bundle": "^5.5",
|
||||||
"symfony/yaml": "4.*",
|
"symfony/yaml": "4.*",
|
||||||
|
"symfony/webpack-encore-bundle": "^1.11",
|
||||||
"knplabs/knp-menu": "^3.1",
|
"knplabs/knp-menu": "^3.1",
|
||||||
"knplabs/knp-menu-bundle": "^3.0",
|
"knplabs/knp-menu-bundle": "^3.0",
|
||||||
"symfony/templating": "4.*",
|
"symfony/templating": "4.*",
|
||||||
@@ -56,7 +57,8 @@
|
|||||||
"symfony/browser-kit": "^5.2",
|
"symfony/browser-kit": "^5.2",
|
||||||
"symfony/css-selector": "^5.2",
|
"symfony/css-selector": "^5.2",
|
||||||
"twig/markdown-extra": "^3.3",
|
"twig/markdown-extra": "^3.3",
|
||||||
"erusev/parsedown": "^1.7"
|
"erusev/parsedown": "^1.7",
|
||||||
|
"symfony/serializer": "^5.2"
|
||||||
},
|
},
|
||||||
"conflict": {
|
"conflict": {
|
||||||
"symfony/symfony": "*"
|
"symfony/symfony": "*"
|
||||||
|
@@ -10,10 +10,19 @@ Compilation into HTML
|
|||||||
|
|
||||||
To compile this documentation :
|
To compile this documentation :
|
||||||
|
|
||||||
1. Install [sphinx-doc](http://sphinx-doc.org) (eg. pip install sphinx & pip install sphinx_rtd_theme)
|
1. Install [sphinx-doc](http://sphinx-doc.org)
|
||||||
|
``` bash
|
||||||
|
$ virtualenv .venv # creation of the virtual env (only the first time)
|
||||||
|
$ source .venv/bin/activate # activate the virtual env
|
||||||
|
(.venv) $ pip install -r requirements.txt
|
||||||
|
```
|
||||||
2. Install submodules : $ git submodule update --init;
|
2. Install submodules : $ git submodule update --init;
|
||||||
3. run `make html` from the root directory
|
3. run `make html` from the root directory
|
||||||
4. The base file is located on build/html/index.html
|
4. The base file is located on build/html/index.html
|
||||||
|
``` bash
|
||||||
|
$ cd build/html
|
||||||
|
$ python -m http.server 8888 # will serve the site on the port 8888
|
||||||
|
```
|
||||||
|
|
||||||
Contribute
|
Contribute
|
||||||
===========
|
===========
|
||||||
|
@@ -29,7 +29,7 @@ As Chill rely on the `symfony <http://symfony.com>`_ framework, reading the fram
|
|||||||
Timelines <timelines.rst>
|
Timelines <timelines.rst>
|
||||||
Exports <exports.rst>
|
Exports <exports.rst>
|
||||||
Embeddable comments <embeddable-comments.rst>
|
Embeddable comments <embeddable-comments.rst>
|
||||||
Testing <make-test-working.rst>
|
Run tests <run-tests.rst>
|
||||||
Useful snippets <useful-snippets.rst>
|
Useful snippets <useful-snippets.rst>
|
||||||
manual/index.rst
|
manual/index.rst
|
||||||
Assets <assets.rst>
|
Assets <assets.rst>
|
||||||
|
@@ -1,231 +0,0 @@
|
|||||||
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
|
||||||
Permission is granted to copy, distribute and/or modify this document
|
|
||||||
under the terms of the GNU Free Documentation License, Version 1.3
|
|
||||||
or any later version published by the Free Software Foundation;
|
|
||||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
|
||||||
A copy of the license is included in the section entitled "GNU
|
|
||||||
Free Documentation License".
|
|
||||||
|
|
||||||
Make tests working
|
|
||||||
******************
|
|
||||||
|
|
||||||
Unit and functional tests are important to ensure that bundle may be deployed securely.
|
|
||||||
|
|
||||||
In reason of the Chill architecture, test should be runnable from the bundle's directory and works correctly: this will allow continuous integration tools to run tests automatically.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
Integration tools (i.e. `travis-ci <https://travis-ci.org>`_) works like this :
|
|
||||||
|
|
||||||
* they clone the bundle repository in a virtual machine, using git
|
|
||||||
* they optionnaly run `composer` to download and install depedencies
|
|
||||||
* they optionnaly run other command to prepare a database, insert fixtures, ...
|
|
||||||
* they run test
|
|
||||||
|
|
||||||
On the developer's machine test should be runnable with two or three commands **runned from the bundle directory** :
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
$ composer install --dev
|
|
||||||
$ // command to insert fixtures, ...
|
|
||||||
$ phpunit
|
|
||||||
|
|
||||||
This chapter has been inspired by `this useful blog post <http://blog.kevingomez.fr/2013/01/09/functional-testing-standalone-symfony2-bundles/>`_.
|
|
||||||
|
|
||||||
Bootstrap phpunit for a standalone bundle
|
|
||||||
==========================================
|
|
||||||
|
|
||||||
Unit tests should run after achieving this step.
|
|
||||||
|
|
||||||
|
|
||||||
phpunit.xml
|
|
||||||
-----------
|
|
||||||
|
|
||||||
A `phpunit.xml.dist` file should be present at the bundle root.
|
|
||||||
|
|
||||||
.. code-block:: xml
|
|
||||||
|
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<phpunit bootstrap="./Tests/bootstrap.php" colors="true">
|
|
||||||
<!-- the file "./Tests/boostrap.php" will be created on the next step -->
|
|
||||||
<testsuites>
|
|
||||||
<testsuite name="ChillMain test suite">
|
|
||||||
<directory suffix="Test.php">./Tests</directory>
|
|
||||||
</testsuite>
|
|
||||||
</testsuites>
|
|
||||||
<filter>
|
|
||||||
<whitelist>
|
|
||||||
<directory>./</directory>
|
|
||||||
<exclude>
|
|
||||||
<directory>./Resources</directory>
|
|
||||||
<directory>./Tests</directory>
|
|
||||||
<directory>./vendor</directory>
|
|
||||||
</exclude>
|
|
||||||
</whitelist>
|
|
||||||
</filter>
|
|
||||||
</phpunit>
|
|
||||||
|
|
||||||
|
|
||||||
bootstrap.php
|
|
||||||
--------------
|
|
||||||
|
|
||||||
A file `boostrap.php`, located in the `Tests` directory, will allow phpunit to resolve class autoloading :
|
|
||||||
|
|
||||||
.. code-block:: php
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
if (!is_file($autoloadFile = __DIR__.'/../vendor/autoload.php')) {
|
|
||||||
throw new \LogicException('Could not find autoload.php in vendor/. Did you run "composer install --dev"?');
|
|
||||||
}
|
|
||||||
|
|
||||||
require $autoloadFile;
|
|
||||||
|
|
||||||
|
|
||||||
composer.json
|
|
||||||
-------------
|
|
||||||
|
|
||||||
The `composer.json` file **located at the bundle's root** should contains all depencies needed to run test (and to execute bundle functions).
|
|
||||||
|
|
||||||
Ensure that all dependencies are included in the `require` and `require-dev` sections.
|
|
||||||
|
|
||||||
|
|
||||||
Functional tests
|
|
||||||
================
|
|
||||||
|
|
||||||
If you want to access services, database, and run functional tests, you will have to bootstrap a symfony app, with the minimal configuration. Three files are required :
|
|
||||||
|
|
||||||
* a `config_test.yml` file (eventually with a `config.yml`);
|
|
||||||
* a `routing.yml` file
|
|
||||||
* an `AppKernel.php` file
|
|
||||||
|
|
||||||
Adapt phpunit.xml
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
You should add reference to the new application within `phpunit.xml.dist`. The directive `<php>` should be added like this, if your `AppKernel.php` file is located in `Tests/Fixtures/App` directory:
|
|
||||||
|
|
||||||
.. code-block:: xml
|
|
||||||
|
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<phpunit bootstrap="./Tests/bootstrap.php" colors="true">
|
|
||||||
<testsuites>
|
|
||||||
<testsuite name="ChillMain test suite">
|
|
||||||
<directory suffix="Test.php">./Tests</directory>
|
|
||||||
</testsuite>
|
|
||||||
</testsuites>
|
|
||||||
<filter>
|
|
||||||
<whitelist>
|
|
||||||
<directory>./</directory>
|
|
||||||
<exclude>
|
|
||||||
<directory>./Resources</directory>
|
|
||||||
<directory>./Tests</directory>
|
|
||||||
<directory>./vendor</directory>
|
|
||||||
</exclude>
|
|
||||||
</whitelist>
|
|
||||||
</filter>
|
|
||||||
<!-- the lines we added -->
|
|
||||||
<php>
|
|
||||||
<server name="KERNEL_DIR" value="./Tests/Fixtures/App/" />
|
|
||||||
</php>
|
|
||||||
</phpunit>
|
|
||||||
|
|
||||||
AppKernel.php
|
|
||||||
-------------
|
|
||||||
|
|
||||||
This file boostrap the app. It contains three functions. This is the file used in the ChillMain bundle :
|
|
||||||
|
|
||||||
.. code-block:: php
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
use Symfony\Component\HttpKernel\Kernel;
|
|
||||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
|
||||||
|
|
||||||
class AppKernel extends Kernel
|
|
||||||
{
|
|
||||||
public function registerBundles()
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
|
|
||||||
new Chill\MainBundle\ChillMainBundle(),
|
|
||||||
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
|
|
||||||
new Symfony\Bundle\TwigBundle\TwigBundle(),
|
|
||||||
new \Symfony\Bundle\AsseticBundle\AsseticBundle(),
|
|
||||||
#add here all the required bundle (some bundle are not required)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function registerContainerConfiguration(LoaderInterface $loader)
|
|
||||||
{
|
|
||||||
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getCacheDir()
|
|
||||||
{
|
|
||||||
return sys_get_temp_dir().'/ChillMainBundle/cache';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getLogDir()
|
|
||||||
{
|
|
||||||
return sys_get_temp_dir().'/ChillMainBundle/logs';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
config_test.yml
|
|
||||||
---------------
|
|
||||||
|
|
||||||
There are only few parameters required for the config file. This is a basic version for ChillMain :
|
|
||||||
|
|
||||||
.. code-block:: yaml
|
|
||||||
|
|
||||||
# config/config_test.yml
|
|
||||||
imports:
|
|
||||||
- { resource: config.yml } #here we import a config.yml file, this is not required
|
|
||||||
|
|
||||||
framework:
|
|
||||||
test: ~
|
|
||||||
session:
|
|
||||||
storage_id: session.storage.filesystem
|
|
||||||
|
|
||||||
.. code-block:: yaml
|
|
||||||
|
|
||||||
# config/config.yml
|
|
||||||
framework:
|
|
||||||
secret: Not very secret
|
|
||||||
router: { resource: "%kernel.root_dir%/config/routing.yml" }
|
|
||||||
form: true
|
|
||||||
csrf_protection: true
|
|
||||||
session: ~
|
|
||||||
default_locale: fr
|
|
||||||
translator: { fallback: fr }
|
|
||||||
profiler: { only_exceptions: false }
|
|
||||||
templating: #required for assetic. Remove if not needed
|
|
||||||
engines: ['twig']
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
You must adapt config.yml file according to your required bundle. Some options will be missing, other may be removed...
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
If you would like to tests different environments, with differents configuration, you could create differents config_XXX.yml files.
|
|
||||||
|
|
||||||
routing.yml
|
|
||||||
------------
|
|
||||||
|
|
||||||
You should add there all routing information needed for your bundle.
|
|
||||||
|
|
||||||
.. code-block: yaml
|
|
||||||
|
|
||||||
chill_main_bundle:
|
|
||||||
resource: "@CLChillMainBundle/Resources/config/routing.yml"
|
|
||||||
|
|
||||||
That's it. Tests should pass.
|
|
68
docs/source/development/run-tests.rst
Normal file
68
docs/source/development/run-tests.rst
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
||||||
|
Permission is granted to copy, distribute and/or modify this document
|
||||||
|
under the terms of the GNU Free Documentation License, Version 1.3
|
||||||
|
or any later version published by the Free Software Foundation;
|
||||||
|
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||||
|
A copy of the license is included in the section entitled "GNU
|
||||||
|
Free Documentation License".
|
||||||
|
|
||||||
|
Run tests
|
||||||
|
*********
|
||||||
|
|
||||||
|
In reason of the Chill architecture, test should be runnable from the bundle's directory and works correctly: this will allow continuous integration tools to run tests automatically.
|
||||||
|
|
||||||
|
From chill app
|
||||||
|
==============
|
||||||
|
|
||||||
|
This is the most convenient method for developer: run test for chill bundle from the main app.
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
# run into a container
|
||||||
|
docker-compose exec --user $(id -u) php bash
|
||||||
|
# execute all tests suites
|
||||||
|
bin/phpunit
|
||||||
|
# .. or execute a single test
|
||||||
|
bin/phpunit vendor/chill-project/chill-bundles/src/Bundle/ChillMainBundle/Tests/path/to/FileTest.php
|
||||||
|
|
||||||
|
You can also run tests in a single command:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
docker-compose exec --user $(id -u) php bin/phpunit
|
||||||
|
|
||||||
|
|
||||||
|
Tests from a bundle (chill-bundles)
|
||||||
|
-----------------------------------
|
||||||
|
|
||||||
|
Those tests needs the whole symfony app to execute Application Tests (which test html page).
|
||||||
|
|
||||||
|
For ease, the app is cloned using a :code:`git submodule`, which clone the main app into :code:`tests/app`, and tests are bootstrapped to this app. The dependencies are also installed into `tests/app/vendor` to ensure compliance with relative path from this symfony application.
|
||||||
|
|
||||||
|
You may boostrap the tests fro the chill bundle this way:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
# ensure to be located into the environement (provided by docker suits well)
|
||||||
|
docker-compose exec --user $(id -u) php bash
|
||||||
|
# go to chill subdirectory
|
||||||
|
cd vendor/chill-project/chill-bundles
|
||||||
|
# install submodule
|
||||||
|
git submodule init
|
||||||
|
git submodule update
|
||||||
|
# install composer and dependencies
|
||||||
|
curl -sS https://getcomposer.org/installer | php
|
||||||
|
# run tests
|
||||||
|
bin/phpunit
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
If you are on a fresh install, you will need to migrate database schema.
|
||||||
|
|
||||||
|
The path to console tool must be adapted to the app. To load migration and add fixtures, one can execute the following commands:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
tests/app/bin/console doctrine:migrations:migrate
|
||||||
|
tests/app/bin/console doctrine:fixtures:load
|
||||||
|
|
@@ -47,11 +47,11 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface,
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* widget factory
|
* widget factory
|
||||||
*
|
*
|
||||||
* @var WidgetFactoryInterface[]
|
* @var WidgetFactoryInterface[]
|
||||||
*/
|
*/
|
||||||
protected $widgetFactories = array();
|
protected $widgetFactories = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param WidgetFactoryInterface $factory
|
* @param WidgetFactoryInterface $factory
|
||||||
*/
|
*/
|
||||||
@@ -59,7 +59,7 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface,
|
|||||||
{
|
{
|
||||||
$this->widgetFactories[] = $factory;
|
$this->widgetFactories[] = $factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return WidgetFactoryInterface[]
|
* @return WidgetFactoryInterface[]
|
||||||
*/
|
*/
|
||||||
@@ -67,7 +67,7 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface,
|
|||||||
{
|
{
|
||||||
return $this->widgetFactories;
|
return $this->widgetFactories;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
* @param array $configs
|
* @param array $configs
|
||||||
@@ -79,31 +79,31 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface,
|
|||||||
// configuration for main bundle
|
// configuration for main bundle
|
||||||
$configuration = $this->getConfiguration($configs, $container);
|
$configuration = $this->getConfiguration($configs, $container);
|
||||||
$config = $this->processConfiguration($configuration, $configs);
|
$config = $this->processConfiguration($configuration, $configs);
|
||||||
|
|
||||||
$container->setParameter('chill_main.installation_name',
|
$container->setParameter('chill_main.installation_name',
|
||||||
$config['installation_name']);
|
$config['installation_name']);
|
||||||
|
|
||||||
$container->setParameter('chill_main.available_languages',
|
$container->setParameter('chill_main.available_languages',
|
||||||
$config['available_languages']);
|
$config['available_languages']);
|
||||||
|
|
||||||
$container->setParameter('chill_main.routing.resources',
|
$container->setParameter('chill_main.routing.resources',
|
||||||
$config['routing']['resources']);
|
$config['routing']['resources']);
|
||||||
|
|
||||||
$container->setParameter('chill_main.pagination.item_per_page',
|
$container->setParameter('chill_main.pagination.item_per_page',
|
||||||
$config['pagination']['item_per_page']);
|
$config['pagination']['item_per_page']);
|
||||||
|
|
||||||
$container->setParameter('chill_main.notifications',
|
$container->setParameter('chill_main.notifications',
|
||||||
$config['notifications']);
|
$config['notifications']);
|
||||||
|
|
||||||
$container->setParameter('chill_main.redis',
|
$container->setParameter('chill_main.redis',
|
||||||
$config['redis']);
|
$config['redis']);
|
||||||
|
|
||||||
$container->setParameter('chill_main.phone_helper',
|
$container->setParameter('chill_main.phone_helper',
|
||||||
$config['phone_helper'] ?? []);
|
$config['phone_helper'] ?? []);
|
||||||
|
|
||||||
// add the key 'widget' without the key 'enable'
|
// add the key 'widget' without the key 'enable'
|
||||||
$container->setParameter('chill_main.widgets',
|
$container->setParameter('chill_main.widgets',
|
||||||
isset($config['widgets']['homepage']) ?
|
isset($config['widgets']['homepage']) ?
|
||||||
array('homepage' => $config['widgets']['homepage']):
|
array('homepage' => $config['widgets']['homepage']):
|
||||||
array()
|
array()
|
||||||
);
|
);
|
||||||
@@ -131,10 +131,11 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface,
|
|||||||
$loader->load('services/templating.yaml');
|
$loader->load('services/templating.yaml');
|
||||||
$loader->load('services/timeline.yaml');
|
$loader->load('services/timeline.yaml');
|
||||||
$loader->load('services/search.yaml');
|
$loader->load('services/search.yaml');
|
||||||
|
$loader->load('services/serializer.yaml');
|
||||||
|
|
||||||
$this->configureCruds($container, $config['cruds'], $loader);
|
$this->configureCruds($container, $config['cruds'], $loader);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $config
|
* @param array $config
|
||||||
* @param ContainerBuilder $container
|
* @param ContainerBuilder $container
|
||||||
@@ -144,11 +145,11 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface,
|
|||||||
{
|
{
|
||||||
return new Configuration($this->widgetFactories, $container);
|
return new Configuration($this->widgetFactories, $container);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ContainerBuilder $container
|
* @param ContainerBuilder $container
|
||||||
*/
|
*/
|
||||||
public function prepend(ContainerBuilder $container)
|
public function prepend(ContainerBuilder $container)
|
||||||
{
|
{
|
||||||
//add installation_name and date_format to globals
|
//add installation_name and date_format to globals
|
||||||
$chillMainConfig = $container->getExtensionConfig($this->getAlias());
|
$chillMainConfig = $container->getExtensionConfig($this->getAlias());
|
||||||
@@ -163,7 +164,7 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface,
|
|||||||
'form_themes' => array('@ChillMain/Form/fields.html.twig')
|
'form_themes' => array('@ChillMain/Form/fields.html.twig')
|
||||||
);
|
);
|
||||||
$container->prependExtensionConfig('twig', $twigConfig);
|
$container->prependExtensionConfig('twig', $twigConfig);
|
||||||
|
|
||||||
//add DQL function to ORM (default entity_manager)
|
//add DQL function to ORM (default entity_manager)
|
||||||
$container->prependExtensionConfig('doctrine', array(
|
$container->prependExtensionConfig('doctrine', array(
|
||||||
'orm' => array(
|
'orm' => array(
|
||||||
@@ -182,7 +183,7 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface,
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
//add dbal types (default entity_manager)
|
//add dbal types (default entity_manager)
|
||||||
$container->prependExtensionConfig('doctrine', array(
|
$container->prependExtensionConfig('doctrine', array(
|
||||||
'dbal' => [
|
'dbal' => [
|
||||||
@@ -191,23 +192,23 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface,
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
));
|
));
|
||||||
|
|
||||||
//add current route to chill main
|
//add current route to chill main
|
||||||
$container->prependExtensionConfig('chill_main', array(
|
$container->prependExtensionConfig('chill_main', array(
|
||||||
'routing' => array(
|
'routing' => array(
|
||||||
'resources' => array(
|
'resources' => array(
|
||||||
'@ChillMainBundle/config/routes.yaml'
|
'@ChillMainBundle/config/routes.yaml'
|
||||||
)
|
)
|
||||||
|
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
//add a channel to log app events
|
//add a channel to log app events
|
||||||
$container->prependExtensionConfig('monolog', array(
|
$container->prependExtensionConfig('monolog', array(
|
||||||
'channels' => array('chill')
|
'channels' => array('chill')
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ContainerBuilder $container
|
* @param ContainerBuilder $container
|
||||||
* @param array $config the config under 'cruds' key
|
* @param array $config the config under 'cruds' key
|
||||||
@@ -218,31 +219,31 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface,
|
|||||||
if (count($config) === 0) {
|
if (count($config) === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$loader->load('services/crud.yaml');
|
$loader->load('services/crud.yaml');
|
||||||
|
|
||||||
$container->setParameter('chill_main_crud_route_loader_config', $config);
|
$container->setParameter('chill_main_crud_route_loader_config', $config);
|
||||||
|
|
||||||
$definition = new Definition();
|
$definition = new Definition();
|
||||||
$definition
|
$definition
|
||||||
->setClass(\Chill\MainBundle\CRUD\Routing\CRUDRoutesLoader::class)
|
->setClass(\Chill\MainBundle\CRUD\Routing\CRUDRoutesLoader::class)
|
||||||
->addArgument('%chill_main_crud_route_loader_config%')
|
->addArgument('%chill_main_crud_route_loader_config%')
|
||||||
;
|
;
|
||||||
|
|
||||||
$container->setDefinition('chill_main_crud_route_loader', $definition);
|
$container->setDefinition('chill_main_crud_route_loader', $definition);
|
||||||
|
|
||||||
$alreadyExistingNames = [];
|
$alreadyExistingNames = [];
|
||||||
|
|
||||||
foreach ($config as $crudEntry) {
|
foreach ($config as $crudEntry) {
|
||||||
$controller = $crudEntry['controller'];
|
$controller = $crudEntry['controller'];
|
||||||
$controllerServiceName = 'cscrud_'.$crudEntry['name'].'_controller';
|
$controllerServiceName = 'cscrud_'.$crudEntry['name'].'_controller';
|
||||||
$name = $crudEntry['name'];
|
$name = $crudEntry['name'];
|
||||||
|
|
||||||
// check for existing crud names
|
// check for existing crud names
|
||||||
if (\in_array($name, $alreadyExistingNames)) {
|
if (\in_array($name, $alreadyExistingNames)) {
|
||||||
throw new LogicException(sprintf("the name %s is defined twice in CRUD", $name));
|
throw new LogicException(sprintf("the name %s is defined twice in CRUD", $name));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$container->has($controllerServiceName)) {
|
if (!$container->has($controllerServiceName)) {
|
||||||
$controllerDefinition = new Definition($controller);
|
$controllerDefinition = new Definition($controller);
|
||||||
$controllerDefinition->addTag('controller.service_arguments');
|
$controllerDefinition->addTag('controller.service_arguments');
|
||||||
@@ -250,7 +251,7 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface,
|
|||||||
$controllerDefinition->setClass($crudEntry['controller']);
|
$controllerDefinition->setClass($crudEntry['controller']);
|
||||||
$container->setDefinition($controllerServiceName, $controllerDefinition);
|
$container->setDefinition($controllerServiceName, $controllerDefinition);
|
||||||
}
|
}
|
||||||
|
|
||||||
$container->setParameter('chill_main_crud_config_'.$name, $crudEntry);
|
$container->setParameter('chill_main_crud_config_'.$name, $crudEntry);
|
||||||
$container->getDefinition($controllerServiceName)
|
$container->getDefinition($controllerServiceName)
|
||||||
->addMethodCall('setCrudConfig', ['%chill_main_crud_config_'.$name.'%']);
|
->addMethodCall('setCrudConfig', ['%chill_main_crud_config_'.$name.'%']);
|
||||||
|
@@ -104,7 +104,7 @@ class Mailer
|
|||||||
* @param \User $to
|
* @param \User $to
|
||||||
* @param array $subject Subject of the message [ 0 => $message (required), 1 => $parameters (optional), 3 => $domain (optional) ]
|
* @param array $subject Subject of the message [ 0 => $message (required), 1 => $parameters (optional), 3 => $domain (optional) ]
|
||||||
* @param array $bodies The bodies. An array where keys are the contentType and values the bodies
|
* @param array $bodies The bodies. An array where keys are the contentType and values the bodies
|
||||||
* @param \callable $callback a callback to customize the message (add attachment, etc.)
|
* @param callable $callback a callback to customize the message (add attachment, etc.)
|
||||||
*/
|
*/
|
||||||
public function sendNotification(
|
public function sendNotification(
|
||||||
$recipient,
|
$recipient,
|
||||||
|
@@ -21,9 +21,7 @@ global.chill = chill;
|
|||||||
/*
|
/*
|
||||||
* load requirements in chill entrypoint
|
* load requirements in chill entrypoint
|
||||||
*/
|
*/
|
||||||
|
require('./scss/chillmain.scss');
|
||||||
require('./sass/scratch.scss');
|
|
||||||
|
|
||||||
require('./css/chillmain.css');
|
require('./css/chillmain.css');
|
||||||
require('./css/pikaday.css');
|
require('./css/pikaday.css');
|
||||||
|
|
||||||
@@ -37,10 +35,11 @@ require('./modules/download-report/index.js');
|
|||||||
require('./modules/select_interactive_loading/index.js');
|
require('./modules/select_interactive_loading/index.js');
|
||||||
require('./modules/export-list/export-list.scss');
|
require('./modules/export-list/export-list.scss');
|
||||||
require('./modules/entity/index.js');
|
require('./modules/entity/index.js');
|
||||||
|
//require('./modules/tabs/index.js');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* load img
|
* load img
|
||||||
*/
|
*/
|
||||||
require('./img/favicon.ico');
|
require('./img/favicon.ico');
|
||||||
require('./img/logo-chill-sans-slogan_white.png');
|
require('./img/logo-chill-sans-slogan_white.png');
|
||||||
require('./img/logo-chill-outil-accompagnement_white.png');
|
require('./img/logo-chill-outil-accompagnement_white.png');
|
||||||
|
@@ -0,0 +1,4 @@
|
|||||||
|
/*
|
||||||
|
* These custom styles will override bootstrap enabled stylesheets
|
||||||
|
*/
|
||||||
|
|
47
src/Bundle/ChillMainBundle/Resources/public/modules/bootstrap/bootstrap.scss
vendored
Normal file
47
src/Bundle/ChillMainBundle/Resources/public/modules/bootstrap/bootstrap.scss
vendored
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Enable / disable bootstrap assets
|
||||||
|
*/
|
||||||
|
|
||||||
|
@import "bootstrap/scss/functions";
|
||||||
|
|
||||||
|
/* replace variables */
|
||||||
|
// @import "bootstrap/scss/variables";
|
||||||
|
@import "custom/_variables";
|
||||||
|
|
||||||
|
@import "bootstrap/scss/mixins";
|
||||||
|
// @import "bootstrap/scss/root";
|
||||||
|
// @import "bootstrap/scss/reboot";
|
||||||
|
// @import "bootstrap/scss/type";
|
||||||
|
// @import "bootstrap/scss/images";
|
||||||
|
// @import "bootstrap/scss/code";
|
||||||
|
// @import "bootstrap/scss/grid";
|
||||||
|
// @import "bootstrap/scss/tables";
|
||||||
|
// @import "bootstrap/scss/forms";
|
||||||
|
// @import "bootstrap/scss/buttons";
|
||||||
|
// @import "bootstrap/scss/transitions";
|
||||||
|
// @import "bootstrap/scss/dropdown";
|
||||||
|
// @import "bootstrap/scss/button-group";
|
||||||
|
// @import "bootstrap/scss/input-group";
|
||||||
|
// @import "bootstrap/scss/custom-forms";
|
||||||
|
// @import "bootstrap/scss/nav";
|
||||||
|
// @import "bootstrap/scss/navbar";
|
||||||
|
// @import "bootstrap/scss/card";
|
||||||
|
// @import "bootstrap/scss/breadcrumb";
|
||||||
|
// @import "bootstrap/scss/pagination";
|
||||||
|
// @import "bootstrap/scss/badge";
|
||||||
|
// @import "bootstrap/scss/jumbotron";
|
||||||
|
// @import "bootstrap/scss/alert";
|
||||||
|
// @import "bootstrap/scss/progress";
|
||||||
|
// @import "bootstrap/scss/media";
|
||||||
|
// @import "bootstrap/scss/list-group";
|
||||||
|
// @import "bootstrap/scss/close";
|
||||||
|
// @import "bootstrap/scss/toasts";
|
||||||
|
@import "bootstrap/scss/modal";
|
||||||
|
// @import "bootstrap/scss/tooltip";
|
||||||
|
// @import "bootstrap/scss/popover";
|
||||||
|
// @import "bootstrap/scss/carousel";
|
||||||
|
// @import "bootstrap/scss/spinners";
|
||||||
|
// @import "bootstrap/scss/utilities";
|
||||||
|
// @import "bootstrap/scss/print";
|
||||||
|
|
||||||
|
@import "custom";
|
@@ -1,42 +0,0 @@
|
|||||||
/*
|
|
||||||
* when bootstrap.css comes after chill.css
|
|
||||||
* we have to disable conflict classes
|
|
||||||
*/
|
|
||||||
|
|
||||||
@import "bootstrap/scss/functions";
|
|
||||||
@import "bootstrap/scss/variables";
|
|
||||||
@import "bootstrap/scss/mixins";
|
|
||||||
@import "bootstrap/scss/root";
|
|
||||||
//@import "bootstrap/scss/reboot"; // h1, h2, h3, ...
|
|
||||||
//@import "bootstrap/scss/type"; // h1, h2, h3, ...
|
|
||||||
@import "bootstrap/scss/images";
|
|
||||||
@import "bootstrap/scss/code";
|
|
||||||
//@import "bootstrap/scss/grid"; // container
|
|
||||||
@import "bootstrap/scss/tables";
|
|
||||||
@import "bootstrap/scss/forms";
|
|
||||||
@import "bootstrap/scss/buttons";
|
|
||||||
@import "bootstrap/scss/transitions";
|
|
||||||
@import "bootstrap/scss/dropdown";
|
|
||||||
@import "bootstrap/scss/button-group";
|
|
||||||
@import "bootstrap/scss/input-group";
|
|
||||||
@import "bootstrap/scss/custom-forms";
|
|
||||||
@import "bootstrap/scss/nav";
|
|
||||||
@import "bootstrap/scss/navbar";
|
|
||||||
@import "bootstrap/scss/card";
|
|
||||||
@import "bootstrap/scss/breadcrumb";
|
|
||||||
@import "bootstrap/scss/pagination";
|
|
||||||
@import "bootstrap/scss/badge";
|
|
||||||
@import "bootstrap/scss/jumbotron";
|
|
||||||
@import "bootstrap/scss/alert";
|
|
||||||
@import "bootstrap/scss/progress";
|
|
||||||
@import "bootstrap/scss/media";
|
|
||||||
@import "bootstrap/scss/list-group";
|
|
||||||
@import "bootstrap/scss/close";
|
|
||||||
@import "bootstrap/scss/toasts";
|
|
||||||
@import "bootstrap/scss/modal";
|
|
||||||
@import "bootstrap/scss/tooltip";
|
|
||||||
@import "bootstrap/scss/popover";
|
|
||||||
@import "bootstrap/scss/carousel";
|
|
||||||
@import "bootstrap/scss/spinners";
|
|
||||||
@import "bootstrap/scss/utilities";
|
|
||||||
@import "bootstrap/scss/print";
|
|
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,9 @@
|
|||||||
// Compile all bootstrap assets from nodes-modules
|
// Compile all bootstrap assets from nodes-modules
|
||||||
//require('bootstrap/scss/bootstrap.scss')
|
//require('bootstrap/scss/bootstrap.scss')
|
||||||
|
|
||||||
// Compile custom styles to adapt bootstrap in chill context
|
// Or compile bootstrap only enabled assets
|
||||||
require('./custom.scss')
|
require('./bootstrap.scss');
|
||||||
|
|
||||||
// You can specify which plugins you need
|
// You can specify which plugins you need
|
||||||
//import { Tooltip, Toast, Popover } from 'bootstrap';
|
//import { Tooltip, Toast, Popover } from 'bootstrap';
|
||||||
//import Alert from 'bootstrap/js/dist/alert';
|
import Modal from 'bootstrap/js/dist/modal';
|
||||||
|
@@ -1,3 +1,9 @@
|
|||||||
|
/*
|
||||||
|
* NOTE 2021.04
|
||||||
|
* scss/chill.scss is the main sass file for the new chill.2
|
||||||
|
* scratch will be replaced by bootstrap, please avoid to edit in modules/scratch/_custom.scss
|
||||||
|
*/
|
||||||
|
|
||||||
// YOUR CUSTOM SCSS
|
// YOUR CUSTOM SCSS
|
||||||
@import 'custom/config/colors';
|
@import 'custom/config/colors';
|
||||||
@import 'custom/config/variables';
|
@import 'custom/config/variables';
|
||||||
@@ -156,7 +162,6 @@ dl.chill_view_data {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
blockquote.chill-user-quote,
|
blockquote.chill-user-quote,
|
||||||
div.chill-user-quote {
|
div.chill-user-quote {
|
||||||
border-left: 10px solid $chill-yellow;
|
border-left: 10px solid $chill-yellow;
|
||||||
@@ -164,12 +169,12 @@ div.chill-user-quote {
|
|||||||
padding: 0.5em 10px;
|
padding: 0.5em 10px;
|
||||||
quotes: "\201C""\201D""\2018""\2019";
|
quotes: "\201C""\201D""\2018""\2019";
|
||||||
background-color: $chill-llight-gray;
|
background-color: $chill-llight-gray;
|
||||||
|
|
||||||
blockquote {
|
blockquote {
|
||||||
margin: 1.5em 10px;
|
margin: 1.5em 10px;
|
||||||
padding: 0.5em 10px;
|
padding: 0.5em 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
blockquote:before {
|
blockquote:before {
|
||||||
color: #ccc;
|
color: #ccc;
|
||||||
content: open-quote;
|
content: open-quote;
|
||||||
@@ -182,5 +187,4 @@ div.chill-user-quote {
|
|||||||
|
|
||||||
.chill-no-data-statement {
|
.chill-no-data-statement {
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
|
|
||||||
}
|
}
|
@@ -1,42 +1,42 @@
|
|||||||
@charset "UTF-8";
|
@charset "UTF-8";
|
||||||
|
|
||||||
/// Outputs the spec and prefixed versions of the `::selection` pseudo-element.
|
/// Outputs the spec and prefixed versions of the `::selection` pseudo-element.
|
||||||
///
|
///
|
||||||
/// @param {Bool} $current-selector [false]
|
/// @param {Bool} $current-selector [false]
|
||||||
/// If set to `true`, it takes the current element into consideration.
|
/// If set to `true`, it takes the current element into consideration.
|
||||||
///
|
///
|
||||||
/// @example scss - Usage
|
/// @example scss - Usage
|
||||||
/// .element {
|
/// .element {
|
||||||
/// @include selection(true) {
|
/// @include selection(true) {
|
||||||
/// background-color: #ffbb52;
|
/// background-color: #ffbb52;
|
||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// @example css - CSS Output
|
/// @example css - CSS Output
|
||||||
/// .element::-moz-selection {
|
/// .element::-moz-selection {
|
||||||
/// background-color: #ffbb52;
|
/// background-color: #ffbb52;
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// .element::selection {
|
/// .element::selection {
|
||||||
/// background-color: #ffbb52;
|
/// background-color: #ffbb52;
|
||||||
/// }
|
/// }
|
||||||
|
|
||||||
@mixin selection($current-selector: false) {
|
@mixin selection($current-selector: false) {
|
||||||
@if $current-selector {
|
@if $current-selector {
|
||||||
&::-moz-selection {
|
&::-moz-selection {
|
||||||
@content;
|
@content;
|
||||||
}
|
}
|
||||||
|
|
||||||
&::selection {
|
&::selection {
|
||||||
@content;
|
@content;
|
||||||
}
|
}
|
||||||
} @else {
|
} @else {
|
||||||
::-moz-selection {
|
::-moz-selection {
|
||||||
@content;
|
@content;
|
||||||
}
|
}
|
||||||
|
|
||||||
::selection {
|
::selection {
|
||||||
@content;
|
@content;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user