mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
27ca8a58d7
BIN
source/_static/bundles/docStore/doc_store_classes.png
Normal file
BIN
source/_static/bundles/docStore/doc_store_classes.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
46
source/_static/bundles/docStore/doc_store_classes.puml
Normal file
46
source/_static/bundles/docStore/doc_store_classes.puml
Normal file
@ -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
|
104
source/development/assets.rst
Normal file
104
source/development/assets.rst
Normal file
@ -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
|
||||||
|
|
||||||
|
<head>
|
||||||
|
...
|
||||||
|
<link rel="stylesheet" href="{{ asset('build/app.css') }}">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
...
|
||||||
|
<script src="{{ asset('build/app.js') }}"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.. _Webpack Encore: https://www.npmjs.com/package/@symfony/webpack-encore
|
||||||
|
.. _Webpack: https://webpack.js.org/
|
@ -31,13 +31,14 @@ As Chill rely on the `symfony <http://symfony.com>`_ framework, reading the fram
|
|||||||
Testing <make-test-working.rst>
|
Testing <make-test-working.rst>
|
||||||
Useful snippets <useful-snippets.rst>
|
Useful snippets <useful-snippets.rst>
|
||||||
manual/index.rst
|
manual/index.rst
|
||||||
|
Assets <assets.rst>
|
||||||
|
|
||||||
Layout and UI
|
Layout and UI
|
||||||
**************
|
**************
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 2
|
:maxdepth: 2
|
||||||
|
|
||||||
Layout / Template usage <user-interface/layout-template-usage.rst>
|
Layout / Template usage <user-interface/layout-template-usage.rst>
|
||||||
Classes and mixins <user-interface/css-classes.rst>
|
Classes and mixins <user-interface/css-classes.rst>
|
||||||
Widgets <user-interface/widgets.rst>
|
Widgets <user-interface/widgets.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: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.
|
* `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
|
Comments and documentation
|
||||||
--------------------------
|
--------------------------
|
||||||
@ -97,4 +97,5 @@ As files are copied from your bundle to the `app/DoctrineMigrations` directory,
|
|||||||
Inside the script
|
Inside the script
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
The script which move the migrations files to app directory `might be found here <https://redmine.champs-libres.coop/projects/chill-standard/repository/changes/app/Composer/Migrations.php?rev=master>`_.
|
The script which move the migrations files to app directory `might be found here
|
||||||
|
<https://github.com/Champs-Libres/ComposerBundleMigration/blob/master/Composer/Migrations.php>
|
||||||
|
@ -38,7 +38,7 @@ Then, render the pagination using the dedicated twig function.
|
|||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
{% if items|length > paginator.getTotalItems %}
|
{% if items|length < paginator.getTotalItems %}
|
||||||
{{ chill_pagination(paginator) }}
|
{{ chill_pagination(paginator) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ class ItemController extends Controller {
|
|||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
// first, get the number of total item are available
|
// first, get the number of total item are available
|
||||||
$total = $em
|
$total = $em
|
||||||
->createQuery("COUNT (item.id) FROM ChillMyBundle:Item item")
|
->createQuery("SELECT COUNT (item.id) FROM ChillMyBundle:Item item")
|
||||||
->getSingleScalarResult();
|
->getSingleScalarResult();
|
||||||
|
|
||||||
// get the PaginatorFactory
|
// get the PaginatorFactory
|
||||||
|
@ -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 :
|
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
|
* `id` : the name of the id column
|
||||||
* `type`: a string to indicate the type
|
* `type`: a string to indicate the type
|
||||||
* `date`: the name of the datetime column, used to order entities by date
|
* `date`: the name of the datetime column, used to order entities by date
|
||||||
* `FROM` (in capital) : the FROM clause. May contains JOIN instructions
|
* `FROM` (in capital) : the FROM clause. May contains JOIN instructions
|
||||||
|
|
||||||
Those key are optional:
|
Those key are optional:
|
||||||
|
|
||||||
* `WHERE` (in capital) : the WHERE clause.
|
* `WHERE` (in capital) : the WHERE clause.
|
||||||
|
|
||||||
Where relevant, the data must be quoted to avoid SQL injection.
|
Where relevant, the data must be quoted to avoid SQL injection.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user