move spacename to CLChillMain to ChillMain

This commit is contained in:
Julien Fastré 2014-10-17 08:27:31 +02:00
parent f44abb26fe
commit d9aa417e3c
27 changed files with 61 additions and 121 deletions

View File

@ -1,9 +0,0 @@
<?php
namespace CL\Chill\MainBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class CLChillMainBundle extends Bundle
{
}

9
ChillMainBundle.php Normal file
View File

@ -0,0 +1,9 @@
<?php
namespace Chill\MainBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class ChillMainBundle extends Bundle
{
}

View File

@ -1,6 +1,6 @@
<?php <?php
namespace CL\Chill\MainBundle\Controller; namespace Chill\MainBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller;
@ -16,7 +16,7 @@ class AdminController extends Controller {
$page_title = 'views.Main.admin.index.page_title') { $page_title = 'views.Main.admin.index.page_title') {
return $this->render('CLChillMainBundle:Admin:index.html.twig', array( return $this->render('ChillMainBundle:Admin:index.html.twig', array(
'menu_composer' => $this->get('cl_chill_main_menu_composer'), 'menu_composer' => $this->get('cl_chill_main_menu_composer'),
'menu' => $menu, 'menu' => $menu,
'header_title' => $header_title, 'header_title' => $header_title,

View File

@ -1,6 +1,6 @@
<?php <?php
namespace CL\Chill\MainBundle\Controller; namespace Chill\MainBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller;
@ -24,6 +24,6 @@ class DefaultController extends Controller
} }
return $this->render('CLChillMainBundle::layout.html.twig'); return $this->render('ChillMainBundle::layout.html.twig');
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace CL\Chill\MainBundle\Controller; namespace Chill\MainBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller;

View File

@ -1,11 +1,11 @@
<?php <?php
namespace CL\Chill\MainBundle\DataFixtures\ORM; namespace Chill\MainBundle\DataFixtures\ORM;
use Doctrine\Common\DataFixtures\AbstractFixture; use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface; use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager; use Doctrine\Common\Persistence\ObjectManager;
use CL\Chill\MainBundle\Entity\Agent; use Chill\MainBundle\Entity\Agent;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerAwareInterface;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace CL\Chill\MainBundle\DataFixtures\ORM; namespace Chill\MainBundle\DataFixtures\ORM;
use Doctrine\Common\DataFixtures\AbstractFixture; use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface; use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
@ -23,7 +23,7 @@ class LoadCountries extends AbstractFixture {
echo "loading countries... \n"; echo "loading countries... \n";
foreach ($this->countries as $code => $name) { foreach ($this->countries as $code => $name) {
$country = new \CL\Chill\MainBundle\Entity\Country(); $country = new \Chill\MainBundle\Entity\Country();
$country->setLabel(ucwords($name)); $country->setLabel(ucwords($name));
$manager->persist($country); $manager->persist($country);
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace CL\Chill\MainBundle\DependencyInjection; namespace Chill\MainBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator; use Symfony\Component\Config\FileLocator;
@ -13,7 +13,7 @@ use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
* *
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html} * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
*/ */
class CLChillMainExtension extends Extension implements PrependExtensionInterface class ChillMainExtension extends Extension implements PrependExtensionInterface
{ {
/** /**
* {@inheritDoc} * {@inheritDoc}
@ -33,15 +33,15 @@ class CLChillMainExtension extends Extension implements PrependExtensionInterfac
public function prepend(ContainerBuilder $container) public function prepend(ContainerBuilder $container)
{ {
$bundles = $container->getParameter('kernel.bundles'); $bundles = $container->getParameter('kernel.bundles');
//add CLChillMain to assetic-enabled bundles //add ChillMain to assetic-enabled bundles
if (!isset($bundles['AsseticBundle'])) { if (!isset($bundles['AsseticBundle'])) {
throw new MissingBundleException('AsseticBundle'); throw new MissingBundleException('AsseticBundle');
} }
$asseticConfig = $container->getExtensionConfig('assetic'); $asseticConfig = $container->getExtensionConfig('assetic');
$asseticConfig['bundles'][] = 'CLChillMainBundle'; $asseticConfig['bundles'][] = 'ChillMainBundle';
$container->prependExtensionConfig('assetic', $container->prependExtensionConfig('assetic',
array('bundles' => array('CLChillMainBundle'))); array('bundles' => array('ChillMainBundle')));
//add installation_name to globals //add installation_name to globals
$chillMainConfig = $container->getExtensionConfig($this->getAlias()); $chillMainConfig = $container->getExtensionConfig($this->getAlias());

View File

@ -1,6 +1,6 @@
<?php <?php
namespace CL\Chill\MainBundle\DependencyInjection; namespace Chill\MainBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface; use Symfony\Component\Config\Definition\ConfigurationInterface;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace CL\Chill\MainBundle\DependencyInjection; namespace Chill\MainBundle\DependencyInjection;
use Exception; use Exception;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace CL\Chill\MainBundle\Entity; namespace Chill\MainBundle\Entity;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace CL\Chill\MainBundle\Entity; namespace Chill\MainBundle\Entity;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;

View File

@ -1,4 +1,4 @@
CL\Chill\MainBundle\Entity\Agent: Chill\MainBundle\Entity\Agent:
type: entity type: entity
table: agents table: agents
id: id:

View File

@ -1,4 +1,4 @@
CL\Chill\MainBundle\Entity\Country: Chill\MainBundle\Entity\Country:
type: entity type: entity
table: null table: null
fields: fields:

View File

@ -12,35 +12,13 @@ root:
cl_chill_main_homepage: cl_chill_main_homepage:
pattern: /hello pattern: /hello
defaults: { _controller: CLChillMainBundle:Default:index } defaults: { _controller: ChillMainBundle:Default:index }
chill_main_admin_central: chill_main_admin_central:
pattern: /admin pattern: /admin
defaults: { _controller: CLChillMainBundle:Admin:index } defaults: { _controller: ChillMainBundle:Admin:index }
options: options:
menus: menus:
main: main:
order: 20 order: 20
label: homepage label: homepage
chill_main_dummy_0:
pattern: /dummy
defaults: { _controller: CLChillMainBundle:Default:index }
options:
menus:
dummy0:
order: 50
label: 'test dummy 0'
dummy1:
order: 50
label: test dummy 1
chill_main_dummy_1:
pattern: /dummy1
defaults: { _controller: CLChillMainBundle:Default:index }
options:
menus:
dummy0:
order: 51
label: 'test dummy 1'

View File

@ -1,15 +1,15 @@
parameters: parameters:
# cl_chill_main.example.class: CL\Chill\MainBundle\Example # cl_chill_main.example.class: Chill\MainBundle\Example
services: services:
chill.main.menu_composer: chill.main.menu_composer:
class: CL\Chill\MainBundle\Routing\MenuComposer class: Chill\MainBundle\Routing\MenuComposer
#must be set in function to avoid circular reference with chill.main.twig.chill_menu #must be set in function to avoid circular reference with chill.main.twig.chill_menu
calls: calls:
- [setContainer, ["@service_container"]] - [setContainer, ["@service_container"]]
chill.main.twig.chill_menu: chill.main.twig.chill_menu:
class: CL\Chill\MainBundle\Routing\MenuTwig class: Chill\MainBundle\Routing\MenuTwig
arguments: arguments:
- "@chill.main.menu_composer" - "@chill.main.menu_composer"
calls: calls:

View File

@ -1,11 +1,11 @@
{% extends "CLChillMainBundle::layout.html.twig" %} {% extends "ChillMainBundle::layout.html.twig" %}
{% block title%}{{ header_title|trans }}{% endblock %} {% block title%}{{ header_title|trans }}{% endblock %}
{% block css %} {% block css %}
{% stylesheets output="css/all.css" filter="cssrewrite" {% stylesheets output="css/all.css" filter="cssrewrite"
"bundles/clchillmain/css/admin.css" "bundles/Chillmain/css/admin.css"
%} %}
<link rel="stylesheet" href="{{ asset_url }}"/> <link rel="stylesheet" href="{{ asset_url }}"/>
{% endstylesheets %} {% endstylesheets %}

View File

@ -5,21 +5,21 @@
<title>{{ installation.name }}{% block title %}{% endblock %}</title> <title>{{ installation.name }}{% block title %}{% endblock %}</title>
{% stylesheets output="css/all.css" filter="cssrewrite" {% stylesheets output="css/all.css" filter="cssrewrite"
"bundles/clchillmain/css/gumby.css" "bundles/Chillmain/css/gumby.css"
"bundles/clchillmain/css/chillmain.css" "bundles/Chillmain/css/chillmain.css"
"bundles/clchillmain/js/lib_jquery_ui_pickadate/jquery-ui-1.10.3.pickadate.css" %} "bundles/Chillmain/js/lib_jquery_ui_pickadate/jquery-ui-1.10.3.pickadate.css" %}
<link rel="stylesheet" href="{{ asset_url }}"/> <link rel="stylesheet" href="{{ asset_url }}"/>
{% endstylesheets %} {% endstylesheets %}
{% block css%}<!-- nothing added to css -->{% endblock %} {% block css%}<!-- nothing added to css -->{% endblock %}
{% javascripts output="js/libs.js" {% javascripts output="js/libs.js"
"bundles/clchillmain/js/modernizr-2.6.2.min.js" "bundles/Chillmain/js/modernizr-2.6.2.min.js"
"bundles/clchillmain/js/jquery-2.0.2.min.js" "bundles/Chillmain/js/jquery-2.0.2.min.js"
"bundles/clchillmain/js/gumby.js" "bundles/Chillmain/js/gumby.js"
"bundles/clchillmain/js/gumby.init.js" "bundles/Chillmain/js/gumby.init.js"
"bundles/clchillmain/js/ui/*.js" "bundles/Chillmain/js/ui/*.js"
"bundles/clchillmain/js/lib_jquery_ui_pickadate/jquery-ui-1.10.3.pickadate.js" %} "bundles/Chillmain/js/lib_jquery_ui_pickadate/jquery-ui-1.10.3.pickadate.js" %}
<script src="{{ asset_url }}" type="text/javascript"></script> <script src="{{ asset_url }}" type="text/javascript"></script>
{% endjavascripts %} {% endjavascripts %}

View File

@ -1,6 +1,6 @@
<?php <?php
namespace CL\Chill\MainBundle\Routing; namespace Chill\MainBundle\Routing;
use Symfony\Component\Routing\RouterInterface; use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Routing\RouteCollection;

View File

@ -19,9 +19,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
namespace CL\Chill\MainBundle\Routing; namespace Chill\MainBundle\Routing;
use CL\Chill\MainBundle\Routing\MenuComposer; use Chill\MainBundle\Routing\MenuComposer;
use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
@ -51,7 +51,7 @@ class MenuTwig extends \Twig_Extension implements ContainerAwareInterface
* @var mixed[] * @var mixed[]
*/ */
private $defaultParams = array( private $defaultParams = array(
'layout' => 'CLChillMainBundle:Menu:defaultMenu.html.twig', 'layout' => 'ChillMainBundle:Menu:defaultMenu.html.twig',
'args' => array(), 'args' => array(),
'activeRouteKey' => null 'activeRouteKey' => null
); );
@ -73,7 +73,7 @@ class MenuTwig extends \Twig_Extension implements ContainerAwareInterface
* *
* Expected params : * Expected params :
* - args: the arguments to build the path (i.e: if pattern is /something/{bar}, args must contain {'bar': 'foo'} * - args: the arguments to build the path (i.e: if pattern is /something/{bar}, args must contain {'bar': 'foo'}
* - layout: the layout. Absolute path needed (i.e.: CLChillXyzBundle:section:foo.html.twig) * - layout: the layout. Absolute path needed (i.e.: ChillXyzBundle:section:foo.html.twig)
* - activeRouteKey : the key active, will render the menu differently. * - activeRouteKey : the key active, will render the menu differently.
* *
* see https://redmine.champs-libres.coop/issues/179 for more informations * see https://redmine.champs-libres.coop/issues/179 for more informations

View File

@ -1,6 +1,6 @@
<?php <?php
namespace CL\Chill\MainBundle\Tests\Controller; namespace Chill\MainBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

View File

@ -9,7 +9,7 @@ class AppKernel extends Kernel
{ {
return array( return array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new \CL\Chill\MainBundle\CLChillMainBundle(), new Chill\MainBundle\ChillMainBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(), new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(), new Symfony\Bundle\TwigBundle\TwigBundle(),
new \Symfony\Bundle\AsseticBundle\AsseticBundle(), new \Symfony\Bundle\AsseticBundle\AsseticBundle(),

View File

@ -1,9 +1,9 @@
hello_bundle: hello_bundle:
resource: "@CLChillMainBundle/Resources/config/routing.yml" resource: "@ChillMainBundle/Resources/config/routing.yml"
chill_main_dummy_0: chill_main_dummy_0:
pattern: /dummy pattern: /dummy
defaults: { _controller: CLChillMainBundle:Default:index } defaults: { _controller: ChillMainBundle:Default:index }
options: options:
menus: menus:
dummy0: dummy0:
@ -16,7 +16,7 @@ chill_main_dummy_0:
chill_main_dummy_1: chill_main_dummy_1:
pattern: /dummy1 pattern: /dummy1
defaults: { _controller: CLChillMainBundle:Default:index } defaults: { _controller: ChillMainBundle:Default:index }
options: options:
menus: menus:
dummy0: dummy0:
@ -26,7 +26,7 @@ chill_main_dummy_1:
chill_main_dummy_2: chill_main_dummy_2:
pattern: /dummy2/{param} pattern: /dummy2/{param}
defaults: {_controller: CLChillMainBundle:Default:index } defaults: {_controller: ChillMainBundle:Default:index }
options: options:
menus: menus:
dummy0: dummy0:

View File

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
namespace CL\Chill\MainBundle\Tests\Services; namespace Chill\MainBundle\Tests\Services;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\DomCrawler\Crawler; use Symfony\Component\DomCrawler\Crawler;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace CL\Chill\MainBundle\Tests\Services; namespace Chill\MainBundle\Tests\Services;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Routing\RouteCollection;
@ -21,7 +21,7 @@ class MenuComposerTest extends KernelTestCase
/** /**
* *
* @var \CL\Chill\MainBundle\DependencyInjection\Services\MenuComposer; * @var \Chill\MainBundle\DependencyInjection\Services\MenuComposer;
*/ */
private $menuComposer; private $menuComposer;
@ -33,7 +33,7 @@ class MenuComposerTest extends KernelTestCase
} }
/** /**
* @covers \CL\Chill\MainBundle\Routing\MenuComposer * @covers \Chill\MainBundle\Routing\MenuComposer
*/ */
public function testMenuComposer() public function testMenuComposer()
{ {

View File

@ -6,7 +6,7 @@
"keywords" : ["chill", "social work"], "keywords" : ["chill", "social work"],
"homepage" : "https://github.com/Chill-project/Main", "homepage" : "https://github.com/Chill-project/Main",
"autoload": { "autoload": {
"psr-4": { "CL\\Chill\\MainBundle\\": "" } "psr-4": { "Chill\\MainBundle\\": "" }
}, },
"authors" : [ "authors" : [
{ {

View File

@ -1,38 +0,0 @@
On utilise les options de routing pour créer des entrées.
```yaml
chill_appointment_admin:
pattern: /admin
defaults: { _controller: CLChillAppointmentBundle:Admin:index }
options:
menu: admin
label: menu.Appointment.index.title
helper: menu.Appointment.index.helper
order: 200
```
Attention à ne pas utiliser deux fois le même `order`, sinon l'entrée est supprimée...
Et puis, il "suffit" de créer la fonction correspondante dans un controller.
On peut se contenter d'un "forward" vers la fonction index du controller admin dans le bundle main ('CLChillMainBundle:Controller:index') :
```php
public function indexAction() {
return $this->forward('CLChillMainBundle:Admin:index',
array(
'menu' => 'admin_appointment',
'page_title' => 'menu.appointment.admin.index',
'header_title' => 'menu.appointment.header_index'
)
);
}
```
qui ira chercher à son tour toutes les entrées ont comme option le menu correspondant. Exemple pour admin_appointment:
```yaml
options:
menu: admin_appointment
#(...)
```