Configuration
|
@ -16,8 +16,29 @@ class AppKernel extends Kernel
|
|||
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
|
||||
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
|
||||
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
|
||||
new AppBundle\AppBundle(),
|
||||
);
|
||||
|
||||
new JMS\AopBundle\JMSAopBundle(),
|
||||
new JMS\DiExtraBundle\JMSDiExtraBundle($this),
|
||||
new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
|
||||
|
||||
new Propel\PropelBundle\PropelBundle(),
|
||||
new Stfalcon\Bundle\TinymceBundle\StfalconTinymceBundle(),
|
||||
new SimpleThings\FormExtraBundle\SimpleThingsFormExtraBundle(),
|
||||
new FOS\UserBundle\FOSUserBundle(),
|
||||
|
||||
new Trinity\Bundle\ContentManagerBundle\TrinityContentManagerBundle(),
|
||||
new Trinity\Bundle\DashBoardBundle\TrinityDashBoardBundle(),
|
||||
new Trinity\Bundle\AdminBundle\TrinityAdminBundle(),
|
||||
new Trinity\Bundle\UserBundle\TrinityUserBundle(),
|
||||
new Trinity\Bundle\AdminMenuBundle\TrinityAdminMenuBundle(),
|
||||
new Trinity\Bundle\SecurityBundle\TrinitySecurityBundle(),
|
||||
new Trinity\Bundle\WidgetBundle\TrinityWidgetBundle(),
|
||||
new Trinity\Bundle\AssetsBundle\TrinityAssetsBundle(),
|
||||
new Trinity\Bundle\AdminBreadcrumbsBundle\TrinityAdminBreadcrumbsBundle(),
|
||||
new Trinity\Bundle\MediaBundle\TrinityMediaBundle(),
|
||||
new Trinity\Bundle\VarsEditorBundle\TrinityVarsEditorBundle(),
|
||||
new Trinity\Bundle\ContactBundle\TrinityContactBundle(),
|
||||
new Trinity\Bundle\EditorialBlockBundle\TrinityEditorialBlockBundle(),
|
||||
|
||||
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
|
||||
$bundles[] = new Acme\DemoBundle\AcmeDemoBundle();
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
imports:
|
||||
- { resource: parameters.yml }
|
||||
- { resource: security.yml }
|
||||
- { resource: deploy.yml }
|
||||
- { resource: trinity_admin_menu.yml }
|
||||
- { resource: trinity_content_manager.yml }
|
||||
- { resource: trinity_dash_board.yml }
|
||||
- { resource: trinity_vars_editor.yml }
|
||||
- { resource: trinity_editorial_block.yml }
|
||||
- { resource: vars.yml }
|
||||
|
||||
framework:
|
||||
#esi: ~
|
||||
|
@ -23,8 +30,13 @@ framework:
|
|||
|
||||
# Twig Configuration
|
||||
twig:
|
||||
debug: "%kernel.debug%"
|
||||
strict_variables: "%kernel.debug%"
|
||||
debug: %kernel.debug%
|
||||
strict_variables: %kernel.debug%
|
||||
cache: false
|
||||
form:
|
||||
resources:
|
||||
- 'TrinityWidgetBundle:Form:fields.html.twig'
|
||||
- 'TrinityWidgetBundle:Form:field_type_help.html.twig'
|
||||
|
||||
# Assetic Configuration
|
||||
assetic:
|
||||
|
@ -39,26 +51,16 @@ assetic:
|
|||
#yui_css:
|
||||
# jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar"
|
||||
|
||||
# Doctrine Configuration
|
||||
doctrine:
|
||||
propel:
|
||||
dbal:
|
||||
driver: "%database_driver%"
|
||||
host: "%database_host%"
|
||||
port: "%database_port%"
|
||||
dbname: "%database_name%"
|
||||
user: "%database_user%"
|
||||
password: "%database_password%"
|
||||
charset: UTF8
|
||||
# if using pdo_sqlite as your database driver:
|
||||
# 1. add the path in parameters.yml
|
||||
# e.g. database_path: "%kernel.root_dir%/data/data.db3"
|
||||
# 2. Uncomment database_path in parameters.yml.dist
|
||||
# 3. Uncomment next line:
|
||||
# path: "%database_path%"
|
||||
default_connection: default
|
||||
connections:
|
||||
default:
|
||||
driver: %database_driver%
|
||||
user: %database_user%
|
||||
password: %database_password%
|
||||
dsn: %database_driver%:host=%database_host%;dbname=%database_name%;charset=%database_charset%
|
||||
|
||||
orm:
|
||||
auto_generate_proxy_classes: "%kernel.debug%"
|
||||
auto_mapping: true
|
||||
|
||||
# Swiftmailer Configuration
|
||||
swiftmailer:
|
||||
|
|
|
@ -1,3 +1,48 @@
|
|||
app:
|
||||
resource: @AppBundle/Controller/
|
||||
trinity_admin_menu:
|
||||
resource: "@TrinityAdminMenuBundle/Controller/"
|
||||
type: annotation
|
||||
|
||||
trinity_dashboard:
|
||||
resource: "@TrinityDashBoardBundle/Controller/"
|
||||
type: annotation
|
||||
|
||||
trinity_vars_editor:
|
||||
resource: "@TrinityVarsEditorBundle/Controller/"
|
||||
type: annotation
|
||||
|
||||
trinity_user:
|
||||
resource: "@TrinityUserBundle/Controller/"
|
||||
type: annotation
|
||||
|
||||
trinity_content_manager:
|
||||
resource: "@TrinityContentManagerBundle/Controller/"
|
||||
type: annotation
|
||||
|
||||
trinity_media:
|
||||
resource: "@TrinityMediaBundle/Controller/"
|
||||
type: annotation
|
||||
|
||||
trinity_editorial_block:
|
||||
resource: "@TrinityEditorialBlockBundle/Controller"
|
||||
type: annotation
|
||||
|
||||
trinity_contact:
|
||||
resource: "@TrinityContactBundle/Controller/"
|
||||
type: annotation
|
||||
|
||||
trinity_security_user:
|
||||
resource: "@TrinityUserBundle/Resources/config/routing.yml"
|
||||
|
||||
cms_nodes:
|
||||
resource: 'Trinity\Bundle\ContentManagerBundle\Model\Node'
|
||||
type: cms_node
|
||||
|
||||
# Internal routing configuration to handle ESI
|
||||
#_internal:
|
||||
# resource: "@FrameworkBundle/Resources/config/routing/internal.xml"
|
||||
# prefix: /_internal
|
||||
|
||||
# temporaire
|
||||
fos_user_profile:
|
||||
resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
|
||||
prefix: /profile
|
||||
|
|
|
@ -60,11 +60,5 @@
|
|||
"branch-alias": {
|
||||
"dev-master": "2.7-dev"
|
||||
}
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "git@gitlab.deblan.org:simon/trinity-cms-bundles"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
1603
composer.lock
generated
|
@ -1,9 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Acme\DemoBundle;
|
||||
|
||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||
|
||||
class AcmeDemoBundle extends Bundle
|
||||
{
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Acme\DemoBundle\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Acme\DemoBundle\Form\ContactType;
|
||||
|
||||
// these import the "@Route" and "@Template" annotations
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
|
||||
class DemoController extends Controller
|
||||
{
|
||||
/**
|
||||
* @Route("/", name="_demo")
|
||||
* @Template()
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/hello/{name}", name="_demo_hello")
|
||||
* @Template()
|
||||
*/
|
||||
public function helloAction($name)
|
||||
{
|
||||
return array('name' => $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/contact", name="_demo_contact")
|
||||
* @Template()
|
||||
*/
|
||||
public function contactAction()
|
||||
{
|
||||
$form = $this->get('form.factory')->create(new ContactType());
|
||||
|
||||
$request = $this->get('request');
|
||||
if ($request->isMethod('POST')) {
|
||||
$form->submit($request);
|
||||
if ($form->isValid()) {
|
||||
$mailer = $this->get('mailer');
|
||||
// .. setup a message and send it
|
||||
// http://symfony.com/doc/current/cookbook/email.html
|
||||
|
||||
$this->get('session')->getFlashBag()->set('notice', 'Message sent!');
|
||||
|
||||
return new RedirectResponse($this->generateUrl('_demo'));
|
||||
}
|
||||
}
|
||||
|
||||
return array('form' => $form->createView());
|
||||
}
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Acme\DemoBundle\Controller;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Security\Core\SecurityContext;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
|
||||
/**
|
||||
* @Route("/demo/secured")
|
||||
*/
|
||||
class SecuredController extends Controller
|
||||
{
|
||||
/**
|
||||
* @Route("/login", name="_demo_login")
|
||||
* @Template()
|
||||
*/
|
||||
public function loginAction(Request $request)
|
||||
{
|
||||
if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
|
||||
$error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
|
||||
} else {
|
||||
$error = $request->getSession()->get(SecurityContext::AUTHENTICATION_ERROR);
|
||||
}
|
||||
|
||||
return array(
|
||||
'last_username' => $request->getSession()->get(SecurityContext::LAST_USERNAME),
|
||||
'error' => $error,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/login_check", name="_security_check")
|
||||
*/
|
||||
public function securityCheckAction()
|
||||
{
|
||||
// The security layer will intercept this request
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/logout", name="_demo_logout")
|
||||
*/
|
||||
public function logoutAction()
|
||||
{
|
||||
// The security layer will intercept this request
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/hello", defaults={"name"="World"}),
|
||||
* @Route("/hello/{name}", name="_demo_secured_hello")
|
||||
* @Template()
|
||||
*/
|
||||
public function helloAction($name)
|
||||
{
|
||||
return array('name' => $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/hello/admin/{name}", name="_demo_secured_hello_admin")
|
||||
* @Template()
|
||||
*/
|
||||
public function helloadminAction($name)
|
||||
{
|
||||
return array('name' => $name);
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Acme\DemoBundle\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
|
||||
class WelcomeController extends Controller
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
/*
|
||||
* The action's view can be rendered using render() method
|
||||
* or @Template annotation as demonstrated in DemoController.
|
||||
*
|
||||
*/
|
||||
return $this->render('AcmeDemoBundle:Welcome:index.html.twig');
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Acme\DemoBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
|
||||
class AcmeDemoExtension extends Extension
|
||||
{
|
||||
public function load(array $configs, ContainerBuilder $container)
|
||||
{
|
||||
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||
$loader->load('services.xml');
|
||||
}
|
||||
|
||||
public function getAlias()
|
||||
{
|
||||
return 'acme_demo';
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Acme\DemoBundle\EventListener;
|
||||
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
|
||||
use Acme\DemoBundle\Twig\Extension\DemoExtension;
|
||||
|
||||
class ControllerListener
|
||||
{
|
||||
protected $extension;
|
||||
|
||||
public function __construct(DemoExtension $extension)
|
||||
{
|
||||
$this->extension = $extension;
|
||||
}
|
||||
|
||||
public function onKernelController(FilterControllerEvent $event)
|
||||
{
|
||||
if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) {
|
||||
$this->extension->setController($event->getController());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Acme\DemoBundle\Form;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class ContactType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder->add('email', 'email');
|
||||
$builder->add('message', 'textarea');
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return 'contact';
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
_welcome:
|
||||
pattern: /
|
||||
defaults: { _controller: AcmeDemoBundle:Welcome:index }
|
||||
|
||||
_demo_secured:
|
||||
resource: "@AcmeDemoBundle/Controller/SecuredController.php"
|
||||
type: annotation
|
||||
|
||||
_demo:
|
||||
resource: "@AcmeDemoBundle/Controller/DemoController.php"
|
||||
type: annotation
|
||||
prefix: /demo
|
|
@ -1,18 +0,0 @@
|
|||
<?xml version="1.0" ?>
|
||||
|
||||
<container xmlns="http://symfony.com/schema/dic/services"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||
|
||||
<services>
|
||||
<service id="twig.extension.acme.demo" class="Acme\DemoBundle\Twig\Extension\DemoExtension" public="false">
|
||||
<tag name="twig.extension" />
|
||||
<argument type="service" id="twig.loader" />
|
||||
</service>
|
||||
|
||||
<service id="acme.demo.listener" class="Acme\DemoBundle\EventListener\ControllerListener">
|
||||
<tag name="kernel.event_listener" event="kernel.controller" method="onKernelController" />
|
||||
<argument type="service" id="twig.extension.acme.demo" />
|
||||
</service>
|
||||
</services>
|
||||
</container>
|
|
@ -1,101 +0,0 @@
|
|||
body {
|
||||
font-size: 14px;
|
||||
font-family: "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
|
||||
}
|
||||
h1.title {
|
||||
font-size: 45px;
|
||||
padding-bottom: 30px;
|
||||
}
|
||||
.sf-reset h2 {
|
||||
font-weight: bold;
|
||||
color: #FFFFFF;
|
||||
/* Font is duplicated of body (sans-serif) */
|
||||
font-family: "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
|
||||
|
||||
margin-bottom: 10px;
|
||||
background-color: #aacd4e;
|
||||
padding: 2px 4px;
|
||||
display: inline-block;
|
||||
text-transform: uppercase;
|
||||
|
||||
}
|
||||
p {
|
||||
line-height: 20px;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
ul#demo-list a {
|
||||
background: url(../images/blue-arrow.png) no-repeat right 6px;
|
||||
padding-right: 10px;
|
||||
margin-right: 30px;
|
||||
}
|
||||
#symfony-header {
|
||||
position: relative;
|
||||
padding: 30px 30px 20px 30px;
|
||||
}
|
||||
.sf-reset .symfony-blocks-welcome {
|
||||
overflow: hidden;
|
||||
}
|
||||
.sf-reset .symfony-blocks-welcome > div {
|
||||
background-color: whitesmoke;
|
||||
float: left;
|
||||
width: 240px;
|
||||
margin-right: 14px;
|
||||
text-align: center;
|
||||
padding: 26px 20px;
|
||||
}
|
||||
.sf-reset .symfony-blocks-welcome > div.block-demo {
|
||||
margin-right: 0;
|
||||
}
|
||||
.sf-reset .symfony-blocks-welcome .illustration {
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
.sf-reset .symfony-blocks-help {
|
||||
overflow: hidden;
|
||||
}
|
||||
.sf-reset .symfony-blocks-help {
|
||||
margin-top: 30px;
|
||||
padding: 18px;
|
||||
border: 1px solid #E6E6E6;
|
||||
}
|
||||
.sf-reset .symfony-blocks-help > div {
|
||||
width: 254px;
|
||||
float: left;
|
||||
}
|
||||
.flash-message {
|
||||
padding: 10px;
|
||||
margin: 5px;
|
||||
margin-top: 15px;
|
||||
background-color: #ffe;
|
||||
}
|
||||
.sf-reset .error {
|
||||
color: red;
|
||||
}
|
||||
#login label, #contact_form label {
|
||||
display: block;
|
||||
float: left;
|
||||
width: 90px;
|
||||
}
|
||||
.sf-reset ul#menu {
|
||||
float: right;
|
||||
margin-bottom: 20px;
|
||||
padding-left: 0;
|
||||
}
|
||||
.sf-reset #menu li {
|
||||
padding-left: 0;
|
||||
margin-right: 10px;
|
||||
display: inline;
|
||||
}
|
||||
.sf-reset a,
|
||||
.sf-reset li a {
|
||||
color: #08C;
|
||||
text-decoration: none;
|
||||
}
|
||||
.sf-reset a:hover,
|
||||
.sf-reset li a:hover {
|
||||
color: #08C;
|
||||
text-decoration: underline;
|
||||
}
|
||||
.sf-reset .symfony-content pre {
|
||||
white-space: pre;
|
||||
font-family: monospace;
|
||||
}
|
Before Width: | Height: | Size: 181 B |
Before Width: | Height: | Size: 63 B |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 737 B |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 4 KiB |
Before Width: | Height: | Size: 4.7 KiB |
|
@ -1,15 +0,0 @@
|
|||
{% extends "AcmeDemoBundle::layout.html.twig" %}
|
||||
|
||||
{% block title "Symfony - Contact form" %}
|
||||
|
||||
{% block content %}
|
||||
<form action="{{ path('_demo_contact') }}" method="POST" id="contact_form">
|
||||
{{ form_errors(form) }}
|
||||
|
||||
{{ form_row(form.email) }}
|
||||
{{ form_row(form.message) }}
|
||||
|
||||
{{ form_rest(form) }}
|
||||
<input type="submit" value="Send" class="symfony-button-grey" />
|
||||
</form>
|
||||
{% endblock %}
|
|
@ -1,9 +0,0 @@
|
|||
{% extends "AcmeDemoBundle::layout.html.twig" %}
|
||||
|
||||
{% block title "Hello " ~ name %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Hello {{ name }}!</h1>
|
||||
{% endblock %}
|
||||
|
||||
{% set code = code(_self) %}
|
|
@ -1,14 +0,0 @@
|
|||
{% extends "AcmeDemoBundle::layout.html.twig" %}
|
||||
|
||||
{% block title "Symfony - Demos" %}
|
||||
|
||||
{% block content_header '' %}
|
||||
|
||||
{% block content %}
|
||||
<h1 class="title">Available demos</h1>
|
||||
<ul id="demo-list">
|
||||
<li><a href="{{ path('_demo_hello', {'name': 'World'}) }}">Hello World</a></li>
|
||||
<li><a href="{{ path('_demo_secured_hello', {'name': 'World'}) }}">Access the secured area</a> <a href="{{ path('_demo_login') }}">Go to the login page</a></li>
|
||||
{# <li><a href="{{ path('_demo_contact') }}">Send a Message</a></li> #}
|
||||
</ul>
|
||||
{% endblock %}
|
|
@ -1,11 +0,0 @@
|
|||
{% extends "AcmeDemoBundle:Secured:layout.html.twig" %}
|
||||
|
||||
{% block title "Hello " ~ name %}
|
||||
|
||||
{% block content %}
|
||||
<h1 class="title">Hello {{ name }}!</h1>
|
||||
|
||||
<a href="{{ path('_demo_secured_hello_admin', { 'name': name }) }}">Hello resource secured for <strong>admin</strong> only.</a>
|
||||
{% endblock %}
|
||||
|
||||
{% set code = code(_self) %}
|
|
@ -1,9 +0,0 @@
|
|||
{% extends "AcmeDemoBundle:Secured:layout.html.twig" %}
|
||||
|
||||
{% block title "Hello " ~ name %}
|
||||
|
||||
{% block content %}
|
||||
<h1 class="title">Hello {{ name }} secured for Admins only!</h1>
|
||||
{% endblock %}
|
||||
|
||||
{% set code = code(_self) %}
|
|
@ -1,6 +0,0 @@
|
|||
{% extends "AcmeDemoBundle::layout.html.twig" %}
|
||||
|
||||
{% block content_header_more %}
|
||||
{{ parent() }}
|
||||
<li>logged in as <strong>{{ app.user ? app.user.username : 'Anonymous' }}</strong> - <a href="{{ path('_demo_logout') }}">Logout</a></li>
|
||||
{% endblock %}
|
|
@ -1,35 +0,0 @@
|
|||
{% extends 'AcmeDemoBundle::layout.html.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<h1 class="title">Login</h1>
|
||||
|
||||
<p>
|
||||
Choose between two default users: <em>user/userpass</em> <small>(ROLE_USER)</small> or <em>admin/adminpass</em> <small>(ROLE_ADMIN)</small>
|
||||
</p>
|
||||
|
||||
{% if error %}
|
||||
<div class="error">{{ error.message }}</div>
|
||||
{% endif %}
|
||||
|
||||
<form action="{{ path("_security_check") }}" method="post" id="login">
|
||||
<div>
|
||||
<label for="username">Username</label>
|
||||
<input type="text" id="username" name="_username" value="{{ last_username }}" />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="password">Password</label>
|
||||
<input type="password" id="password" name="_password" />
|
||||
</div>
|
||||
|
||||
<button type="submit" class="sf-button">
|
||||
<span class="border-l">
|
||||
<span class="border-r">
|
||||
<span class="btn-bg">Login</span>
|
||||
</span>
|
||||
</span>
|
||||
</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
{% set code = code(_self) %}
|
|
@ -1,83 +0,0 @@
|
|||
{% extends 'AcmeDemoBundle::layout.html.twig' %}
|
||||
|
||||
{% block title %}Symfony - Welcome{% endblock %}
|
||||
|
||||
{% block content_header '' %}
|
||||
|
||||
{% block content %}
|
||||
{% set version = constant('Symfony\\Component\\HttpKernel\\Kernel::MAJOR_VERSION') ~ '.' ~ constant('Symfony\\Component\\HttpKernel\\Kernel::MINOR_VERSION')%}
|
||||
|
||||
<h1 class="title">Welcome!</h1>
|
||||
|
||||
<p>Congratulations! You have successfully installed a new Symfony application.</p>
|
||||
|
||||
<div class="symfony-blocks-welcome">
|
||||
<div class="block-quick-tour">
|
||||
<div class="illustration">
|
||||
<img src="{{ asset('bundles/acmedemo/images/welcome-quick-tour.gif') }}" alt="Quick tour" />
|
||||
</div>
|
||||
<a href="http://symfony.com/doc/{{ version }}/quick_tour/index.html" class="sf-button sf-button-selected">
|
||||
<span class="border-l">
|
||||
<span class="border-r">
|
||||
<span class="btn-bg">Read the Quick Tour</span>
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
{% if app.environment == 'dev' %}
|
||||
<div class="block-configure">
|
||||
<div class="illustration">
|
||||
<img src="{{ asset('bundles/acmedemo/images/welcome-configure.gif') }}" alt="Configure your application" />
|
||||
</div>
|
||||
<a href="{{ path('_configurator_home') }}" class="sf-button sf-button-selected">
|
||||
<span class="border-l">
|
||||
<span class="border-r">
|
||||
<span class="btn-bg">Configure</span>
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="block-demo">
|
||||
<div class="illustration">
|
||||
<img src="{{ asset('bundles/acmedemo/images/welcome-demo.gif') }}" alt="Demo" />
|
||||
</div>
|
||||
<a href="{{ path('_demo') }}" class="sf-button sf-button-selected">
|
||||
<span class="border-l">
|
||||
<span class="border-r">
|
||||
<span class="btn-bg">Run The Demo</span>
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="symfony-blocks-help">
|
||||
<div class="block-documentation">
|
||||
<ul>
|
||||
<li><strong>Documentation</strong></li>
|
||||
<li><a href="http://symfony.com/doc/{{ version }}/book/index.html">The Book</a></li>
|
||||
<li><a href="http://symfony.com/doc/{{ version }}/cookbook/index.html">The Cookbook</a></li>
|
||||
<li><a href="http://symfony.com/doc/{{ version }}/components/index.html">The Components</a></li>
|
||||
<li><a href="http://symfony.com/doc/{{ version }}/reference/index.html">Reference</a></li>
|
||||
<li><a href="http://symfony.com/doc/{{ version }}/glossary.html">Glossary</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="block-documentation-more">
|
||||
<ul>
|
||||
<li><strong>Sensio</strong></li>
|
||||
<li><a href="http://trainings.sensiolabs.com">Trainings</a></li>
|
||||
<li><a href="http://books.sensiolabs.com">Books</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="block-community">
|
||||
<ul>
|
||||
<li><strong>Community</strong></li>
|
||||
<li><a href="http://symfony.com/irc">IRC channel</a></li>
|
||||
<li><a href="http://symfony.com/mailing-lists">Mailing lists</a></li>
|
||||
<li><a href="http://forum.symfony-project.org">Forum</a></li>
|
||||
<li><a href="http://symfony.com/doc/{{ version }}/contributing/index.html">Contributing</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -1,37 +0,0 @@
|
|||
{% extends "TwigBundle::layout.html.twig" %}
|
||||
|
||||
{% block head %}
|
||||
<link rel="icon" sizes="16x16" href="{{ asset('favicon.ico') }}" />
|
||||
<link rel="stylesheet" href="{{ asset('bundles/acmedemo/css/demo.css') }}" />
|
||||
{% endblock %}
|
||||
|
||||
{% block title 'Demo Bundle' %}
|
||||
|
||||
{% block body %}
|
||||
{% for flashMessage in app.session.flashbag.get('notice') %}
|
||||
<div class="flash-message">
|
||||
<em>Notice</em>: {{ flashMessage }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
{% block content_header %}
|
||||
<ul id="menu">
|
||||
{% block content_header_more %}
|
||||
<li><a href="{{ path('_demo') }}">Demo Home</a></li>
|
||||
{% endblock %}
|
||||
</ul>
|
||||
|
||||
<div style="clear: both"></div>
|
||||
{% endblock %}
|
||||
|
||||
<div class="block">
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
|
||||
{% if code is defined %}
|
||||
<h2>Code behind this page</h2>
|
||||
<div class="block">
|
||||
<div class="symfony-content">{{ code|raw }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Acme\DemoBundle\Tests\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
class DemoControllerTest extends WebTestCase
|
||||
{
|
||||
public function testIndex()
|
||||
{
|
||||
$client = static::createClient();
|
||||
|
||||
$crawler = $client->request('GET', '/demo/hello/Fabien');
|
||||
|
||||
$this->assertGreaterThan(0, $crawler->filter('html:contains("Hello Fabien")')->count());
|
||||
}
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Acme\DemoBundle\Twig\Extension;
|
||||
|
||||
use CG\Core\ClassUtils;
|
||||
|
||||
class DemoExtension extends \Twig_Extension
|
||||
{
|
||||
protected $loader;
|
||||
protected $controller;
|
||||
|
||||
public function __construct(\Twig_LoaderInterface $loader)
|
||||
{
|
||||
$this->loader = $loader;
|
||||
}
|
||||
|
||||
public function setController($controller)
|
||||
{
|
||||
$this->controller = $controller;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFunctions()
|
||||
{
|
||||
return array(
|
||||
new \Twig_SimpleFunction('code', array($this, 'getCode'), array('is_safe' => array('html'))),
|
||||
);
|
||||
}
|
||||
|
||||
public function getCode($template)
|
||||
{
|
||||
// highlight_string highlights php code only if '<?php' tag is present.
|
||||
$controller = highlight_string("<?php" . $this->getControllerCode(), true);
|
||||
$controller = str_replace('<span style="color: #0000BB"><?php </span>', ' ', $controller);
|
||||
|
||||
$template = htmlspecialchars($this->getTemplateCode($template), ENT_QUOTES, 'UTF-8');
|
||||
|
||||
// remove the code block
|
||||
$template = str_replace('{% set code = code(_self) %}', '', $template);
|
||||
|
||||
return <<<EOF
|
||||
<p><strong>Controller Code</strong></p>
|
||||
<pre>$controller</pre>
|
||||
|
||||
<p><strong>Template Code</strong></p>
|
||||
<pre>$template</pre>
|
||||
EOF;
|
||||
}
|
||||
|
||||
protected function getControllerCode()
|
||||
{
|
||||
$class = get_class($this->controller[0]);
|
||||
if (class_exists('CG\Core\ClassUtils')) {
|
||||
$class = ClassUtils::getUserClass($class);
|
||||
}
|
||||
|
||||
$r = new \ReflectionClass($class);
|
||||
$m = $r->getMethod($this->controller[1]);
|
||||
|
||||
$code = file($r->getFilename());
|
||||
|
||||
return ' '.$m->getDocComment()."\n".implode('', array_slice($code, $m->getStartline() - 1, $m->getEndLine() - $m->getStartline() + 1));
|
||||
}
|
||||
|
||||
protected function getTemplateCode($template)
|
||||
{
|
||||
return $this->loader->getSource($template->getTemplateName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the extension.
|
||||
*
|
||||
* @return string The extension name
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'demo';
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle;
|
||||
|
||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||
|
||||
class AppBundle extends Bundle
|
||||
{
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
|
||||
class DefaultController extends Controller
|
||||
{
|
||||
/**
|
||||
* @Route("/app/example", name="homepage")
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
return $this->render('default/index.html.twig');
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Tests\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
class DefaultControllerTest extends WebTestCase
|
||||
{
|
||||
public function testIndex()
|
||||
{
|
||||
$client = static::createClient();
|
||||
|
||||
$crawler = $client->request('GET', '/');
|
||||
|
||||
$this->assertTrue($crawler->filter('html:contains("Homepage")')->count() > 0);
|
||||
}
|
||||
}
|