diff --git a/source/_static/bundles/docStore/doc_store_classes.png b/source/_static/bundles/docStore/doc_store_classes.png new file mode 100644 index 000000000..9c038b928 Binary files /dev/null and b/source/_static/bundles/docStore/doc_store_classes.png differ diff --git a/source/_static/bundles/docStore/doc_store_classes.puml b/source/_static/bundles/docStore/doc_store_classes.puml new file mode 100644 index 000000000..431d268c0 --- /dev/null +++ b/source/_static/bundles/docStore/doc_store_classes.puml @@ -0,0 +1,46 @@ +# diagramme de classe du module "docStore" + +@startuml + +title Diagramme de classe du module "docStore" + + +package "PersonBundle" { + class Person + class Center + class PersonDocument +} + +package "DocStoreBundle" { + Document "many" --- "1" DocumentCategory +} + +Document <|-- "herite" PersonDocument + +class "Document" { + - int id + - varchar_150 title + - text description + - ArrayCollection_DocumentCategory categories + - varchar_150 content #link to openstack + - Center center + - Cercle cercle + - User user + - DateTime date # Creation date +} + + +class "DocumentCategory" { + .. Primary Key .. + - varchar_150 bundle_id + - int internal_bundle_id + == + - json_array name + - ArrayCollection_Document documents +} + +class "PersonDocument" { + - Person person +} + +@enduml diff --git a/source/development/assets.rst b/source/development/assets.rst new file mode 100644 index 000000000..3584ef3f6 --- /dev/null +++ b/source/development/assets.rst @@ -0,0 +1,104 @@ + +.. 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". + +.. _forms: + +Assets +####### + +The Chill assets (js, css, images, …) can be managed by `Webpack Encore`_, which is a thin wrapper for `Webpack`_ in Symfony applications. + +Installation +************ + +Webpack Encore needs to be run in a Node.js environment, using the Yarn package manager. This Node.js environment can be set up using a node docker image. The bash script `docker-node.sh` set up a Node.js environment with an adequate configuration. Launch this container by typing: + + +.. code-block:: bash + + $ bash docker-node.sh + +In this NodeJS environment, install all the assets required by Chill with: + +.. code-block:: bash + + node@b91cab4f7cfc:/app$ yarn install + +This command will install all the packages that are listed in `package.json`. + +Any further required dependencies can be installed using the Yarn package. For instance, jQuery is installed by: + +.. code-block:: bash + + node@b91cab4f7cfc:/app$ yarn add jquery --dev + + +Usage +***** + +Organize your assets +-------------------- + +Chill assets usually lives under the `/Resources/public` folder of each Chill bundle. The Webpack configuration set up in `webpack.config.js` automatically loads the required assets from the Chill bundles that are used. + +For adding your own assets to Webpack, you must add an entry in the `webpack.config.js` file. For instance, the following entry will output a file `main.js` collecting the js code (and possibly css, image, etc.) from `./assets/main.js`. + +.. code-block:: js + + .addEntry('main', './assets/main.js') + +To gather the css files, simply connect them to your js file, using `require`. The css file is seen as a dependency of your js file. : + +.. code-block:: js + + // assets/js/main.js + require('../css/app.css'); + +For finer configuration of webpack encore, we refer to the above-linked documentation. + + +Compile the assets +------------------ + +To compile the assets, run this line in the NodeJS container: + +.. code-block:: bash + + node@b91cab4f7cfc:/app$ yarn run encore dev + +While developing, you can tell Webpack Encore to continuously watch the files you are modifying: + +.. code-block:: bash + + node@b91cab4f7cfc:/app$ yarn run encore dev --watch + + +Use the assets in the templates +-------------------------------- + +Any entry defined in the webpack.config.js file can be linked to your application using the symfony `asset` helper: + +.. code-block:: html + + + ... + + + + ... + + + + + + + + +.. _Webpack Encore: https://www.npmjs.com/package/@symfony/webpack-encore +.. _Webpack: https://webpack.js.org/ diff --git a/source/development/index.rst b/source/development/index.rst index b4b6786c2..245824c4e 100644 --- a/source/development/index.rst +++ b/source/development/index.rst @@ -31,13 +31,14 @@ As Chill rely on the `symfony `_ framework, reading the fram Testing Useful snippets manual/index.rst + Assets Layout and UI ************** .. toctree:: :maxdepth: 2 - + Layout / Template usage Classes and mixins Widgets diff --git a/source/development/migrations.rst b/source/development/migrations.rst index 5a3252160..db4745bd3 100644 --- a/source/development/migrations.rst +++ b/source/development/migrations.rst @@ -87,7 +87,7 @@ You can generate migration file from the command line, using those commands: * `php app/console doctrine:migrations:diff` to generate a migration file by comparing your current database to your mapping information * `php app/console doctrine:migrations:generate` to generate a blank migration file. -Those files will be located into `app/DoctrineMigrations` directory. You will have to copy those file to your the directory `Resource/migrations` into your bundle directory. +Those files will be located into `app/DoctrineMigrations` directory. You will have to copy those file to your the directory `Resources/migrations` into your bundle directory. Comments and documentation -------------------------- @@ -97,4 +97,5 @@ As files are copied from your bundle to the `app/DoctrineMigrations` directory, Inside the script ----------------- -The script which move the migrations files to app directory `might be found here `_. +The script which move the migrations files to app directory `might be found here + diff --git a/source/development/pagination.rst b/source/development/pagination.rst index cc223a5ef..44c06b308 100644 --- a/source/development/pagination.rst +++ b/source/development/pagination.rst @@ -38,7 +38,7 @@ Then, render the pagination using the dedicated twig function. - {% if items|length > paginator.getTotalItems %} + {% if items|length < paginator.getTotalItems %} {{ chill_pagination(paginator) }} {% endif %} diff --git a/source/development/pagination/example.php b/source/development/pagination/example.php index bfcac41eb..6ed1e68ef 100644 --- a/source/development/pagination/example.php +++ b/source/development/pagination/example.php @@ -13,7 +13,7 @@ class ItemController extends Controller { $em = $this->getDoctrine()->getManager(); // first, get the number of total item are available $total = $em - ->createQuery("COUNT (item.id) FROM ChillMyBundle:Item item") + ->createQuery("SELECT COUNT (item.id) FROM ChillMyBundle:Item item") ->getSingleScalarResult(); // get the PaginatorFactory diff --git a/source/development/timelines.rst b/source/development/timelines.rst index ca1d2e317..a8d0ff0be 100644 --- a/source/development/timelines.rst +++ b/source/development/timelines.rst @@ -164,12 +164,14 @@ The `fetchQuery` function ^^^^^^^^^^^^^^^^^^^^^^^^^ The fetchQuery function help to build the UNION query to gather events. This function should return an associative array MUST have the following key : + * `id` : the name of the id column * `type`: a string to indicate the type * `date`: the name of the datetime column, used to order entities by date * `FROM` (in capital) : the FROM clause. May contains JOIN instructions Those key are optional: + * `WHERE` (in capital) : the WHERE clause. Where relevant, the data must be quoted to avoid SQL injection.