Procházet zdrojové kódy

Evolution #590: Mail pour news

Sevajol Bastien před 12 roky
rodič
revize
28af1b1120

+ 5 - 1
app/Resources/translations/flash.fr.yml Zobrazit soubor

30
     token_invalid: Le lien pour mettre a jour votre email est périmé, veuillez relancer la procédure.
30
     token_invalid: Le lien pour mettre a jour votre email est périmé, veuillez relancer la procédure.
31
     success:       Votre email a correctement été mis a jour.
31
     success:       Votre email a correctement été mis a jour.
32
     wait:          Vous devez attendre avant de pouvoir faire une nouvelle demande de changement d'email.
32
     wait:          Vous devez attendre avant de pouvoir faire une nouvelle demande de changement d'email.
33
-  session_expired: Vous avez été déconnecté, veuillez vous ré-identifier
33
+  session_expired: Vous avez été déconnecté, veuillez vous ré-identifier
34
+
35
+presubscription:
36
+  success:         Nous avons bien pris note de votre demande !
37
+  error:           Une erreur est survenue, veuillez réessayer

+ 5 - 0
app/Resources/translations/userui.fr.yml Zobrazit soubor

1
 login:
1
 login:
2
   remember_me:
2
   remember_me:
3
     label:     Rester connecté
3
     label:     Rester connecté
4
+  presubscription:
5
+    info:       |
6
+                Vous souhaitez être informé de l'ouverture officielle de muzi.ch ?
7
+                Saisissez votre email et nous vous ferons part de cette nouvelle le moment venu !
8
+    submit:     Enregistrer mon email
4
 
9
 
5
 security:
10
 security:
6
   login:
11
   login:

+ 34 - 0
src/Muzich/CoreBundle/Entity/Presubscription.php Zobrazit soubor

1
+<?php
2
+
3
+namespace Muzich\CoreBundle\Entity;
4
+
5
+use Doctrine\ORM\Mapping as ORM;
6
+use Gedmo\Mapping\Annotation as Gedmo;
7
+use Symfony\Component\Validator\Constraints as Assert;
8
+use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
9
+
10
+/**
11
+ * @ORM\Entity
12
+ * @ORM\Table(name="presubscription")
13
+ * @UniqueEntity("email")
14
+ */
15
+class Presubscription
16
+{
17
+  
18
+  /**
19
+   * @ORM\Id
20
+   * @ORM\Column(type="integer")
21
+   * @ORM\GeneratedValue(strategy="AUTO")
22
+   * @var type int
23
+   */
24
+  protected $id;
25
+  
26
+  /**
27
+   * @ORM\Column(type="string", length=255, unique=true, nullable=false)
28
+   * @Assert\NotBlank()
29
+   * @Assert\Email()
30
+   * @var type string
31
+   */
32
+  public $email;
33
+  
34
+}

+ 2 - 0
src/Muzich/CoreBundle/Resources/views/layout.html.twig Zobrazit soubor

33
         </div>
33
         </div>
34
           
34
           
35
         <aside id="sidebar">
35
         <aside id="sidebar">
36
+          {% block sidebar_top %}{% endblock %}
36
           {% include 'MuzichCoreBundle:Layout:side.html.twig' %}
37
           {% include 'MuzichCoreBundle:Layout:side.html.twig' %}
38
+          {% block sidebar_bottom %}{% endblock %}
37
         </aside>
39
         </aside>
38
           
40
           
39
       </div>
41
       </div>

+ 36 - 3
src/Muzich/IndexBundle/Controller/IndexController.php Zobrazit soubor

5
 use Muzich\CoreBundle\lib\Controller;
5
 use Muzich\CoreBundle\lib\Controller;
6
 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
6
 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
7
 use Symfony\Component\Security\Core\SecurityContext;
7
 use Symfony\Component\Security\Core\SecurityContext;
8
-
9
-//use Symfony\Component\HttpFoundation\RedirectResponse;
8
+use Symfony\Component\Validator\Constraints\Email;
9
+use Symfony\Component\Validator\Constraints\Collection;
10
+use Muzich\CoreBundle\Entity\Presubscription;
11
+use Symfony\Component\HttpFoundation\Request;
10
 
12
 
11
 class IndexController extends Controller
13
 class IndexController extends Controller
12
 {
14
 {
28
     $form = $this->container->get('fos_user.registration.form');
30
     $form = $this->container->get('fos_user.registration.form');
29
     
31
     
30
     return array_merge($vars, array(
32
     return array_merge($vars, array(
31
-      'form' => $form->createView()
33
+      'form' => $form->createView(),
34
+      'presubscription_form' => $this->getPreSubscriptionForm()->createView()
32
     ));
35
     ));
33
   }
36
   }
34
   
37
   
38
+  protected function getPreSubscriptionForm()
39
+  {
40
+    return $this->createFormBuilder(new Presubscription())
41
+      ->add('email', 'email')
42
+      ->getForm()
43
+    ;
44
+  }
45
+  
35
   /**
46
   /**
36
    * Gestion du formulaire d'identification sur la page d'index.
47
    * Gestion du formulaire d'identification sur la page d'index.
37
    * 
48
    * 
68
     );
79
     );
69
   }
80
   }
70
   
81
   
82
+  public function presubscriptionAction(Request $request)
83
+  {
84
+    $form = $this->getPreSubscriptionForm();
85
+    $form->bindRequest($request);
86
+    if ($form->isValid())
87
+    {
88
+      $this->persist($form->getData());
89
+      $this->flush();
90
+      $this->setFlash('success', 'presubscription.success');
91
+      return $this->redirect($this->generateUrl('index'));
92
+    }
93
+    
94
+    $this->setFlash('error', 'presubscription.error');
95
+    return $this->render('MuzichIndexBundle:Index:index.html.twig', array(
96
+      'form' => $this->container->get('fos_user.registration.form')->createView(),
97
+      'presubscription_form' => $form->createView(),
98
+      'last_username' => '',
99
+      'error'         => '',
100
+      'registration_errors_pers' => array()
101
+    ));
102
+  }
103
+  
71
 }
104
 }

+ 7 - 1
src/Muzich/IndexBundle/Resources/config/routing.yml Zobrazit soubor

1
 ## Routing du Bundle Index
1
 ## Routing du Bundle Index
2
 
2
 
3
+presubscription_register:
4
+  pattern:  /hello/{_locale}/presubscription
5
+  defaults: { _controller: MuzichIndexBundle:Index:presubscription }
6
+  requirements:
7
+    _method:  POST
8
+
3
 index_without_locale:
9
 index_without_locale:
4
     pattern:  /hello/
10
     pattern:  /hello/
5
     defaults: { _controller: MuzichCoreBundle:Core:automaticLanguage }
11
     defaults: { _controller: MuzichCoreBundle:Core:automaticLanguage }
27
 
33
 
28
 fos_user_change_password:
34
 fos_user_change_password:
29
     resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
35
     resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
30
-    prefix: /{_locale}/change-password/
36
+    prefix: /{_locale}/change-password/

+ 4 - 0
src/Muzich/IndexBundle/Resources/views/Index/index.html.twig Zobrazit soubor

3
 {% block title %}{{ 'title.hello'|trans({}, 'navigationui') }}{% endblock %}
3
 {% block title %}{{ 'title.hello'|trans({}, 'navigationui') }}{% endblock %}
4
 {% block mainbox_classes %}mainbox_margintop mainbox_padding{% endblock %}
4
 {% block mainbox_classes %}mainbox_margintop mainbox_padding{% endblock %}
5
 
5
 
6
+{% block sidebar_top %}
7
+  {% include 'MuzichIndexBundle:Index:presubscription.html.twig' %}
8
+{% endblock %}
9
+
6
 {% block content %}
10
 {% block content %}
7
     
11
     
8
     <a href="#" id="registration_link" class="button gradient">
12
     <a href="#" id="registration_link" class="button gradient">

+ 18 - 0
src/Muzich/IndexBundle/Resources/views/Index/presubscription.html.twig Zobrazit soubor

1
+<div id="presubscription" class="nicebox">
2
+  
3
+  <p class="info">{{ 'login.presubscription.info'|trans({}, 'userui') }}</p>
4
+  
5
+  <form action="{{ path('presubscription_register') }}" method="post">
6
+    
7
+    <div class="field name">
8
+      {{ form_errors(presubscription_form.email) }}
9
+      {{ form_widget(presubscription_form.email, {'attr':{'class':'niceinput'}}) }}
10
+    </div>
11
+    
12
+    {{ form_rest(presubscription_form) }}
13
+    
14
+    <div class="alignright">
15
+      <input type="submit" class="button" value="{{ 'login.presubscription.submit'|trans({}, 'userui') }}" />
16
+    </div>
17
+  </form>
18
+</div>

+ 2 - 2
web/bundles/muzichcore/css/old.css Zobrazit soubor

335
 		 -moz-animation: animate-bg 5s linear infinite;
335
 		 -moz-animation: animate-bg 5s linear infinite;
336
 }
336
 }
337
 
337
 
338
-.info, .fos_user_info
338
+/*.info, .fos_user_info
339
 {
339
 {
340
 		 background-color: #4ea5cd;
340
 		 background-color: #4ea5cd;
341
 		 border-color: #3b8eb5;
341
 		 border-color: #3b8eb5;
342
-}
342
+}*/
343
 
343
 
344
 .error, .fos_user_error
344
 .error, .fos_user_error
345
 {
345
 {

+ 16 - 0
web/css/main.css Zobrazit soubor

1653
 p.show_info
1653
 p.show_info
1654
 {
1654
 {
1655
   margin-top: 0px;
1655
   margin-top: 0px;
1656
+}
1657
+
1658
+div#presubscription
1659
+{
1660
+  margin-top: 23px;
1661
+}
1662
+
1663
+div#presubscription input[type="email"]
1664
+{
1665
+  width: 253px;
1666
+}
1667
+
1668
+div#presubscription input[type="submit"]
1669
+{
1670
+  margin-top: 10px;
1671
+  margin-right: 1px;
1656
 }
1672
 }