diff options
Diffstat (limited to 'src/Acme/DemoBundle/Resources')
19 files changed, 350 insertions, 0 deletions
diff --git a/src/Acme/DemoBundle/Resources/config/routing.yml b/src/Acme/DemoBundle/Resources/config/routing.yml new file mode 100644 index 00000000..06291a23 --- /dev/null +++ b/src/Acme/DemoBundle/Resources/config/routing.yml | |||
@@ -0,0 +1,12 @@ | |||
1 | _welcome: | ||
2 | path: / | ||
3 | defaults: { _controller: AcmeDemoBundle:Welcome:index } | ||
4 | |||
5 | _demo_secured: | ||
6 | resource: "@AcmeDemoBundle/Controller/SecuredController.php" | ||
7 | type: annotation | ||
8 | |||
9 | _demo: | ||
10 | resource: "@AcmeDemoBundle/Controller/DemoController.php" | ||
11 | type: annotation | ||
12 | prefix: /demo | ||
diff --git a/src/Acme/DemoBundle/Resources/config/services.xml b/src/Acme/DemoBundle/Resources/config/services.xml new file mode 100644 index 00000000..d6274ce9 --- /dev/null +++ b/src/Acme/DemoBundle/Resources/config/services.xml | |||
@@ -0,0 +1,18 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | |||
3 | <container xmlns="http://symfony.com/schema/dic/services" | ||
4 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
5 | xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> | ||
6 | |||
7 | <services> | ||
8 | <service id="twig.extension.acme.demo" class="Acme\DemoBundle\Twig\Extension\DemoExtension" public="false"> | ||
9 | <tag name="twig.extension" /> | ||
10 | <argument type="service" id="twig.loader" /> | ||
11 | </service> | ||
12 | |||
13 | <service id="acme.demo.listener" class="Acme\DemoBundle\EventListener\ControllerListener"> | ||
14 | <tag name="kernel.event_listener" event="kernel.controller" method="onKernelController" /> | ||
15 | <argument type="service" id="twig.extension.acme.demo" /> | ||
16 | </service> | ||
17 | </services> | ||
18 | </container> | ||
diff --git a/src/Acme/DemoBundle/Resources/public/css/demo.css b/src/Acme/DemoBundle/Resources/public/css/demo.css new file mode 100644 index 00000000..4dd2f16c --- /dev/null +++ b/src/Acme/DemoBundle/Resources/public/css/demo.css | |||
@@ -0,0 +1,101 @@ | |||
1 | body { | ||
2 | font-size: 14px; | ||
3 | font-family: "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; | ||
4 | } | ||
5 | h1.title { | ||
6 | font-size: 45px; | ||
7 | padding-bottom: 30px; | ||
8 | } | ||
9 | .sf-reset h2 { | ||
10 | font-weight: bold; | ||
11 | color: #FFFFFF; | ||
12 | /* Font is duplicated of body (sans-serif) */ | ||
13 | font-family: "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; | ||
14 | |||
15 | margin-bottom: 10px; | ||
16 | background-color: #aacd4e; | ||
17 | padding: 2px 4px; | ||
18 | display: inline-block; | ||
19 | text-transform: uppercase; | ||
20 | |||
21 | } | ||
22 | p { | ||
23 | line-height: 20px; | ||
24 | padding-bottom: 20px; | ||
25 | } | ||
26 | ul#demo-list a { | ||
27 | background: url(../images/blue-arrow.png) no-repeat right 6px; | ||
28 | padding-right: 10px; | ||
29 | margin-right: 30px; | ||
30 | } | ||
31 | #symfony-header { | ||
32 | position: relative; | ||
33 | padding: 30px 30px 20px 30px; | ||
34 | } | ||
35 | .sf-reset .symfony-blocks-welcome { | ||
36 | overflow: hidden; | ||
37 | } | ||
38 | .sf-reset .symfony-blocks-welcome > div { | ||
39 | background-color: whitesmoke; | ||
40 | float: left; | ||
41 | width: 240px; | ||
42 | margin-right: 14px; | ||
43 | text-align: center; | ||
44 | padding: 26px 20px; | ||
45 | } | ||
46 | .sf-reset .symfony-blocks-welcome > div.block-demo { | ||
47 | margin-right: 0; | ||
48 | } | ||
49 | .sf-reset .symfony-blocks-welcome .illustration { | ||
50 | padding-bottom: 20px; | ||
51 | } | ||
52 | .sf-reset .symfony-blocks-help { | ||
53 | overflow: hidden; | ||
54 | } | ||
55 | .sf-reset .symfony-blocks-help { | ||
56 | margin-top: 30px; | ||
57 | padding: 18px; | ||
58 | border: 1px solid #E6E6E6; | ||
59 | } | ||
60 | .sf-reset .symfony-blocks-help > div { | ||
61 | width: 254px; | ||
62 | float: left; | ||
63 | } | ||
64 | .flash-message { | ||
65 | padding: 10px; | ||
66 | margin: 5px; | ||
67 | margin-top: 15px; | ||
68 | background-color: #ffe; | ||
69 | } | ||
70 | .sf-reset .error { | ||
71 | color: red; | ||
72 | } | ||
73 | #login label, #contact_form label { | ||
74 | display: block; | ||
75 | float: left; | ||
76 | width: 90px; | ||
77 | } | ||
78 | .sf-reset ul#menu { | ||
79 | float: right; | ||
80 | margin-bottom: 20px; | ||
81 | padding-left: 0; | ||
82 | } | ||
83 | .sf-reset #menu li { | ||
84 | padding-left: 0; | ||
85 | margin-right: 10px; | ||
86 | display: inline; | ||
87 | } | ||
88 | .sf-reset a, | ||
89 | .sf-reset li a { | ||
90 | color: #08C; | ||
91 | text-decoration: none; | ||
92 | } | ||
93 | .sf-reset a:hover, | ||
94 | .sf-reset li a:hover { | ||
95 | color: #08C; | ||
96 | text-decoration: underline; | ||
97 | } | ||
98 | .sf-reset .symfony-content pre { | ||
99 | white-space: pre; | ||
100 | font-family: monospace; | ||
101 | } | ||
diff --git a/src/Acme/DemoBundle/Resources/public/images/blue-arrow.png b/src/Acme/DemoBundle/Resources/public/images/blue-arrow.png new file mode 100644 index 00000000..fa82d4b4 --- /dev/null +++ b/src/Acme/DemoBundle/Resources/public/images/blue-arrow.png | |||
Binary files differ | |||
diff --git a/src/Acme/DemoBundle/Resources/public/images/field-background.gif b/src/Acme/DemoBundle/Resources/public/images/field-background.gif new file mode 100644 index 00000000..7c0efc10 --- /dev/null +++ b/src/Acme/DemoBundle/Resources/public/images/field-background.gif | |||
Binary files differ | |||
diff --git a/src/Acme/DemoBundle/Resources/public/images/logo.gif b/src/Acme/DemoBundle/Resources/public/images/logo.gif new file mode 100644 index 00000000..703cf45f --- /dev/null +++ b/src/Acme/DemoBundle/Resources/public/images/logo.gif | |||
Binary files differ | |||
diff --git a/src/Acme/DemoBundle/Resources/public/images/search.png b/src/Acme/DemoBundle/Resources/public/images/search.png new file mode 100644 index 00000000..3c88b6a4 --- /dev/null +++ b/src/Acme/DemoBundle/Resources/public/images/search.png | |||
Binary files differ | |||
diff --git a/src/Acme/DemoBundle/Resources/public/images/welcome-configure.gif b/src/Acme/DemoBundle/Resources/public/images/welcome-configure.gif new file mode 100644 index 00000000..931179a7 --- /dev/null +++ b/src/Acme/DemoBundle/Resources/public/images/welcome-configure.gif | |||
Binary files differ | |||
diff --git a/src/Acme/DemoBundle/Resources/public/images/welcome-demo.gif b/src/Acme/DemoBundle/Resources/public/images/welcome-demo.gif new file mode 100644 index 00000000..0623de54 --- /dev/null +++ b/src/Acme/DemoBundle/Resources/public/images/welcome-demo.gif | |||
Binary files differ | |||
diff --git a/src/Acme/DemoBundle/Resources/public/images/welcome-quick-tour.gif b/src/Acme/DemoBundle/Resources/public/images/welcome-quick-tour.gif new file mode 100644 index 00000000..b9018b11 --- /dev/null +++ b/src/Acme/DemoBundle/Resources/public/images/welcome-quick-tour.gif | |||
Binary files differ | |||
diff --git a/src/Acme/DemoBundle/Resources/views/Demo/contact.html.twig b/src/Acme/DemoBundle/Resources/views/Demo/contact.html.twig new file mode 100644 index 00000000..e5b7523b --- /dev/null +++ b/src/Acme/DemoBundle/Resources/views/Demo/contact.html.twig | |||
@@ -0,0 +1,15 @@ | |||
1 | {% extends "AcmeDemoBundle::layout.html.twig" %} | ||
2 | |||
3 | {% block title "Symfony - Contact form" %} | ||
4 | |||
5 | {% block content %} | ||
6 | <form action="{{ path('_demo_contact') }}" method="POST" id="contact_form"> | ||
7 | {{ form_errors(form) }} | ||
8 | |||
9 | {{ form_row(form.email) }} | ||
10 | {{ form_row(form.message) }} | ||
11 | |||
12 | {{ form_rest(form) }} | ||
13 | <input type="submit" value="Send" class="symfony-button-grey" /> | ||
14 | </form> | ||
15 | {% endblock %} | ||
diff --git a/src/Acme/DemoBundle/Resources/views/Demo/hello.html.twig b/src/Acme/DemoBundle/Resources/views/Demo/hello.html.twig new file mode 100644 index 00000000..3997ff60 --- /dev/null +++ b/src/Acme/DemoBundle/Resources/views/Demo/hello.html.twig | |||
@@ -0,0 +1,9 @@ | |||
1 | {% extends "AcmeDemoBundle::layout.html.twig" %} | ||
2 | |||
3 | {% block title "Hello " ~ name %} | ||
4 | |||
5 | {% block content %} | ||
6 | <h1>Hello {{ name }}!</h1> | ||
7 | {% endblock %} | ||
8 | |||
9 | {% set code = code(_self) %} | ||
diff --git a/src/Acme/DemoBundle/Resources/views/Demo/index.html.twig b/src/Acme/DemoBundle/Resources/views/Demo/index.html.twig new file mode 100644 index 00000000..454a3203 --- /dev/null +++ b/src/Acme/DemoBundle/Resources/views/Demo/index.html.twig | |||
@@ -0,0 +1,14 @@ | |||
1 | {% extends "AcmeDemoBundle::layout.html.twig" %} | ||
2 | |||
3 | {% block title "Symfony - Demos" %} | ||
4 | |||
5 | {% block content_header '' %} | ||
6 | |||
7 | {% block content %} | ||
8 | <h1 class="title">Available demos</h1> | ||
9 | <ul id="demo-list"> | ||
10 | <li><a href="{{ path('_demo_hello', {'name': 'World'}) }}">Hello World</a></li> | ||
11 | <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> | ||
12 | {# <li><a href="{{ path('_demo_contact') }}">Send a Message</a></li> #} | ||
13 | </ul> | ||
14 | {% endblock %} | ||
diff --git a/src/Acme/DemoBundle/Resources/views/Secured/hello.html.twig b/src/Acme/DemoBundle/Resources/views/Secured/hello.html.twig new file mode 100644 index 00000000..faf95cf8 --- /dev/null +++ b/src/Acme/DemoBundle/Resources/views/Secured/hello.html.twig | |||
@@ -0,0 +1,11 @@ | |||
1 | {% extends "AcmeDemoBundle:Secured:layout.html.twig" %} | ||
2 | |||
3 | {% block title "Hello " ~ name %} | ||
4 | |||
5 | {% block content %} | ||
6 | <h1 class="title">Hello {{ name }}!</h1> | ||
7 | |||
8 | <a href="{{ path('_demo_secured_hello_admin', { 'name': name }) }}">Hello resource secured for <strong>admin</strong> only.</a> | ||
9 | {% endblock %} | ||
10 | |||
11 | {% set code = code(_self) %} | ||
diff --git a/src/Acme/DemoBundle/Resources/views/Secured/helloadmin.html.twig b/src/Acme/DemoBundle/Resources/views/Secured/helloadmin.html.twig new file mode 100644 index 00000000..4e3649f7 --- /dev/null +++ b/src/Acme/DemoBundle/Resources/views/Secured/helloadmin.html.twig | |||
@@ -0,0 +1,9 @@ | |||
1 | {% extends "AcmeDemoBundle:Secured:layout.html.twig" %} | ||
2 | |||
3 | {% block title "Hello " ~ name %} | ||
4 | |||
5 | {% block content %} | ||
6 | <h1 class="title">Hello {{ name }} secured for Admins only!</h1> | ||
7 | {% endblock %} | ||
8 | |||
9 | {% set code = code(_self) %} | ||
diff --git a/src/Acme/DemoBundle/Resources/views/Secured/layout.html.twig b/src/Acme/DemoBundle/Resources/views/Secured/layout.html.twig new file mode 100644 index 00000000..aeea55c5 --- /dev/null +++ b/src/Acme/DemoBundle/Resources/views/Secured/layout.html.twig | |||
@@ -0,0 +1,6 @@ | |||
1 | {% extends "AcmeDemoBundle::layout.html.twig" %} | ||
2 | |||
3 | {% block content_header_more %} | ||
4 | {{ parent() }} | ||
5 | <li>logged in as <strong>{{ app.user ? app.user.username : 'Anonymous' }}</strong> - <a href="{{ path('_demo_logout') }}">Logout</a></li> | ||
6 | {% endblock %} | ||
diff --git a/src/Acme/DemoBundle/Resources/views/Secured/login.html.twig b/src/Acme/DemoBundle/Resources/views/Secured/login.html.twig new file mode 100644 index 00000000..3e76d1df --- /dev/null +++ b/src/Acme/DemoBundle/Resources/views/Secured/login.html.twig | |||
@@ -0,0 +1,35 @@ | |||
1 | {% extends 'AcmeDemoBundle::layout.html.twig' %} | ||
2 | |||
3 | {% block content %} | ||
4 | <h1 class="title">Login</h1> | ||
5 | |||
6 | <p> | ||
7 | Choose between two default users: <em>user/userpass</em> <small>(ROLE_USER)</small> or <em>admin/adminpass</em> <small>(ROLE_ADMIN)</small> | ||
8 | </p> | ||
9 | |||
10 | {% if error %} | ||
11 | <div class="error">{{ error.message }}</div> | ||
12 | {% endif %} | ||
13 | |||
14 | <form action="{{ path("_demo_security_check") }}" method="post" id="login"> | ||
15 | <div> | ||
16 | <label for="username">Username</label> | ||
17 | <input type="text" id="username" name="_username" value="{{ last_username }}" /> | ||
18 | </div> | ||
19 | |||
20 | <div> | ||
21 | <label for="password">Password</label> | ||
22 | <input type="password" id="password" name="_password" /> | ||
23 | </div> | ||
24 | |||
25 | <button type="submit" class="sf-button"> | ||
26 | <span class="border-l"> | ||
27 | <span class="border-r"> | ||
28 | <span class="btn-bg">Login</span> | ||
29 | </span> | ||
30 | </span> | ||
31 | </button> | ||
32 | </form> | ||
33 | {% endblock %} | ||
34 | |||
35 | {% set code = code(_self) %} | ||
diff --git a/src/Acme/DemoBundle/Resources/views/Welcome/index.html.twig b/src/Acme/DemoBundle/Resources/views/Welcome/index.html.twig new file mode 100644 index 00000000..ea3a7299 --- /dev/null +++ b/src/Acme/DemoBundle/Resources/views/Welcome/index.html.twig | |||
@@ -0,0 +1,83 @@ | |||
1 | {% extends 'AcmeDemoBundle::layout.html.twig' %} | ||
2 | |||
3 | {% block title %}Symfony - Welcome{% endblock %} | ||
4 | |||
5 | {% block content_header '' %} | ||
6 | |||
7 | {% block content %} | ||
8 | {% set version = constant('Symfony\\Component\\HttpKernel\\Kernel::MAJOR_VERSION') ~ '.' ~ constant('Symfony\\Component\\HttpKernel\\Kernel::MINOR_VERSION')%} | ||
9 | |||
10 | <h1 class="title">Welcome!</h1> | ||
11 | |||
12 | <p>Congratulations! You have successfully installed a new Symfony application.</p> | ||
13 | |||
14 | <div class="symfony-blocks-welcome"> | ||
15 | <div class="block-quick-tour"> | ||
16 | <div class="illustration"> | ||
17 | <img src="{{ asset('bundles/acmedemo/images/welcome-quick-tour.gif') }}" alt="Quick tour" /> | ||
18 | </div> | ||
19 | <a href="http://symfony.com/doc/{{ version }}/quick_tour/index.html" class="sf-button sf-button-selected"> | ||
20 | <span class="border-l"> | ||
21 | <span class="border-r"> | ||
22 | <span class="btn-bg">Read the Quick Tour</span> | ||
23 | </span> | ||
24 | </span> | ||
25 | </a> | ||
26 | </div> | ||
27 | {% if app.environment == 'dev' %} | ||
28 | <div class="block-configure"> | ||
29 | <div class="illustration"> | ||
30 | <img src="{{ asset('bundles/acmedemo/images/welcome-configure.gif') }}" alt="Configure your application" /> | ||
31 | </div> | ||
32 | <a href="{{ path('_configurator_home') }}" class="sf-button sf-button-selected"> | ||
33 | <span class="border-l"> | ||
34 | <span class="border-r"> | ||
35 | <span class="btn-bg">Configure</span> | ||
36 | </span> | ||
37 | </span> | ||
38 | </a> | ||
39 | </div> | ||
40 | {% endif %} | ||
41 | <div class="block-demo"> | ||
42 | <div class="illustration"> | ||
43 | <img src="{{ asset('bundles/acmedemo/images/welcome-demo.gif') }}" alt="Demo" /> | ||
44 | </div> | ||
45 | <a href="{{ path('_demo') }}" class="sf-button sf-button-selected"> | ||
46 | <span class="border-l"> | ||
47 | <span class="border-r"> | ||
48 | <span class="btn-bg">Run The Demo</span> | ||
49 | </span> | ||
50 | </span> | ||
51 | </a> | ||
52 | </div> | ||
53 | </div> | ||
54 | |||
55 | <div class="symfony-blocks-help"> | ||
56 | <div class="block-documentation"> | ||
57 | <ul> | ||
58 | <li><strong>Documentation</strong></li> | ||
59 | <li><a href="http://symfony.com/doc/{{ version }}/book/index.html">The Book</a></li> | ||
60 | <li><a href="http://symfony.com/doc/{{ version }}/cookbook/index.html">The Cookbook</a></li> | ||
61 | <li><a href="http://symfony.com/doc/{{ version }}/components/index.html">The Components</a></li> | ||
62 | <li><a href="http://symfony.com/doc/{{ version }}/reference/index.html">Reference</a></li> | ||
63 | <li><a href="http://symfony.com/doc/{{ version }}/glossary.html">Glossary</a></li> | ||
64 | </ul> | ||
65 | </div> | ||
66 | <div class="block-documentation-more"> | ||
67 | <ul> | ||
68 | <li><strong>Sensio</strong></li> | ||
69 | <li><a href="http://trainings.sensiolabs.com">Trainings</a></li> | ||
70 | <li><a href="http://books.sensiolabs.com">Books</a></li> | ||
71 | </ul> | ||
72 | </div> | ||
73 | <div class="block-community"> | ||
74 | <ul> | ||
75 | <li><strong>Community</strong></li> | ||
76 | <li><a href="http://symfony.com/irc">IRC channel</a></li> | ||
77 | <li><a href="http://symfony.com/mailing-lists">Mailing lists</a></li> | ||
78 | <li><a href="http://forum.symfony-project.org">Forum</a></li> | ||
79 | <li><a href="http://symfony.com/doc/{{ version }}/contributing/index.html">Contributing</a></li> | ||
80 | </ul> | ||
81 | </div> | ||
82 | </div> | ||
83 | {% endblock %} | ||
diff --git a/src/Acme/DemoBundle/Resources/views/layout.html.twig b/src/Acme/DemoBundle/Resources/views/layout.html.twig new file mode 100644 index 00000000..d7e97d56 --- /dev/null +++ b/src/Acme/DemoBundle/Resources/views/layout.html.twig | |||
@@ -0,0 +1,37 @@ | |||
1 | {% extends "TwigBundle::layout.html.twig" %} | ||
2 | |||
3 | {% block head %} | ||
4 | <link rel="icon" sizes="16x16" href="{{ asset('favicon.ico') }}" /> | ||
5 | <link rel="stylesheet" href="{{ asset('bundles/acmedemo/css/demo.css') }}" /> | ||
6 | {% endblock %} | ||
7 | |||
8 | {% block title 'Demo Bundle' %} | ||
9 | |||
10 | {% block body %} | ||
11 | {% for flashMessage in app.session.flashbag.get('notice') %} | ||
12 | <div class="flash-message"> | ||
13 | <em>Notice</em>: {{ flashMessage }} | ||
14 | </div> | ||
15 | {% endfor %} | ||
16 | |||
17 | {% block content_header %} | ||
18 | <ul id="menu"> | ||
19 | {% block content_header_more %} | ||
20 | <li><a href="{{ path('_demo') }}">Demo Home</a></li> | ||
21 | {% endblock %} | ||
22 | </ul> | ||
23 | |||
24 | <div style="clear: both"></div> | ||
25 | {% endblock %} | ||
26 | |||
27 | <div class="block"> | ||
28 | {% block content %}{% endblock %} | ||
29 | </div> | ||
30 | |||
31 | {% if code is defined %} | ||
32 | <h2>Code behind this page</h2> | ||
33 | <div class="block"> | ||
34 | <div class="symfony-content">{{ code|raw }}</div> | ||
35 | </div> | ||
36 | {% endif %} | ||
37 | {% endblock %} | ||