Commit 5066752d2f061a6fac3a30a7ff1d47de200bd310
1 parent
8dcc72ca6e
Exists in
feature/karellys
uso html
Showing
5 changed files
with
93 additions
and
21 deletions
Show diff stats
app/Resources/views/aldea/index.html.twig
1 | 1 | {% extends 'base.html.twig' %} |
2 | 2 | |
3 | 3 | {% block body %} |
4 | - <h1>Aldeas list</h1> | |
4 | +{% for type, flashMessage in app.session.flashbag.all() %} | |
5 | +<div class="alert alert-{{ type }} fade in"> | |
6 | +<button class="close" data-dismiss="alert" type="button">×</button> | |
7 | +{% if flashMessage.title is defined %} | |
8 | +<strong>{{ flashMessage.title }}</strong> | |
9 | +{{ flashMessage.message }} | |
10 | +{% else %} | |
11 | +{{ type }} | |
12 | +{% endif %} | |
13 | +</div> | |
14 | +{% endfor %} | |
5 | 15 | |
6 | - <table> | |
16 | + <h1>Lista aldea</h1> | |
17 | + | |
18 | + <table class="table table-condensed" > | |
7 | 19 | <thead> |
8 | 20 | <tr> |
9 | - <th>Id</th> | |
10 | - <th>Descripcion</th> | |
11 | - <th>Codigosucre</th> | |
12 | - <th>Codigoaldea</th> | |
13 | - <th>Estatus</th> | |
14 | - <th>Actions</th> | |
15 | - </tr> | |
21 | + <th><strong>id</th> | |
22 | + <th><strong>Cursodescripcion</th> | |
23 | + <th><strong>codigoSucre</th> | |
24 | + <th><strong>codigoAldea</th> | |
25 | + <th><strong>Estatus</th> | |
26 | + <th><strong>Actions</th> | |
27 | + | |
16 | 28 | </thead> |
17 | 29 | <tbody> |
18 | 30 | {% for aldea in aldeas %} |
... | ... | @@ -24,12 +36,12 @@ |
24 | 36 | <td>{% if aldea.estatus %}Yes{% else %}No{% endif %}</td> |
25 | 37 | <td> |
26 | 38 | <ul> |
27 | - <li> | |
39 | + | |
28 | 40 | <a href="{{ path('aldea_show', { 'id': aldea.id }) }}">show</a> |
29 | - </li> | |
30 | - <li> | |
41 | + | |
42 | + | |
31 | 43 | <a href="{{ path('aldea_edit', { 'id': aldea.id }) }}">edit</a> |
32 | - </li> | |
44 | + | |
33 | 45 | </ul> |
34 | 46 | </td> |
35 | 47 | </tr> |
... | ... | @@ -38,8 +50,11 @@ |
38 | 50 | </table> |
39 | 51 | |
40 | 52 | <ul> |
41 | - <li> | |
42 | - <a href="{{ path('aldea_new') }}">Create a new aldea</a> | |
43 | - </li> | |
53 | + | |
54 | + | |
55 | + <a class="btn btn-default" href="{{ path('aldea_new') }}">Agregar Aldea</a> | |
56 | + {#<input type="button" value="Agregar Aldea" onclick= a href("{{ path('aldea_new') }}");"/>#} | |
57 | + {#<button type="button" class="btn btn-primary"> Agregar aldea </button>#} | |
58 | + | |
44 | 59 | </ul> |
45 | 60 | {% endblock %} | ... | ... |
app/Resources/views/aldea/new.html.twig
... | ... | @@ -3,14 +3,66 @@ |
3 | 3 | {% block body %} |
4 | 4 | <h1>Aldea creation</h1> |
5 | 5 | |
6 | - {{ form_start(form) }} | |
7 | - {{ form_widget(form) }} | |
8 | - <input type="submit" value="Create" /> | |
9 | - {{ form_end(form) }} | |
6 | + {{ form_start(form, {'attr': {'novalidate': 'novalidate'}, 'action': path('aldea_new')}) }} | |
7 | + | |
8 | + <form class="form-inline" action="/action_page.php"> | |
9 | + <div class="form-group"> | |
10 | + {{ form_label(form.descripcion) }} | |
11 | + {{ form_widget(form.descripcion) }} | |
12 | + | |
13 | + </div> | |
14 | + | |
15 | + | |
16 | + | |
17 | + {% if form.descripcion.vars.errors[0].message is defined %} | |
18 | + <span class="help-block"> | |
19 | + {{ form.descripcion.vars.errors[0].message }} | |
20 | + </span> | |
21 | + </div> | |
22 | + {% endif %} | |
23 | + | |
24 | + {{ form_label(form.codigoSucre) }} | |
25 | + {{ form_widget(form.codigoSucre) }} | |
26 | + {% if form.codigoSucre.vars.errors[0].message is defined %} | |
27 | + <span class="help-block"> | |
28 | + {{ form.codigoSucre.vars.errors[0].message }} | |
29 | + </span> | |
30 | + </div> | |
31 | + {% endif %} | |
32 | + | |
33 | +{{ form_label(form.codigoAldea) }} | |
34 | + {{ form_widget(form.codigoAldea) }} | |
35 | + {% if form.codigoAldea.vars.errors[0].message is defined %} | |
36 | + <span class="help-block"> | |
37 | + {{ form.codigoAldea.vars.errors[0].message }} | |
38 | + </span> | |
39 | + </div> | |
40 | + {% endif %} | |
41 | + | |
42 | +{{ form_label(form.estatus) }} | |
43 | + {{ form_widget(form.estatus) }} | |
44 | + {% if form.estatus.vars.errors[0].message is defined %} | |
45 | + <span class="help-block"> | |
46 | + {{ form.estatus.vars.errors[0].message }} | |
47 | + </span> | |
48 | + </div> | |
49 | + {% endif %} | |
50 | + | |
51 | + | |
10 | 52 | |
11 | 53 | <ul> |
12 | 54 | <li> |
55 | + | |
56 | + <input type="submit" value="Create" /> | |
57 | + {{ form_end(form) }} | |
13 | 58 | <a href="{{ path('aldea_index') }}">Back to the list</a> |
14 | 59 | </li> |
15 | 60 | </ul> |
16 | 61 | {% endblock %} |
62 | + | |
63 | + | |
64 | + | |
65 | + | |
66 | + | |
67 | + | |
68 | + | ... | ... |
app/Resources/views/usuario/new.html.twig
src/UBV/PracticaBundle/Controller/aldeaController.php
... | ... | @@ -49,6 +49,8 @@ class aldeaController extends Controller |
49 | 49 | $em->persist($aldea); |
50 | 50 | $em->flush(); |
51 | 51 | |
52 | + $this->get('session')->getFlashBag()->set( 'success', array( 'title' => 'Guardado!', 'message' => 'Estado creado satisfactoriamente.' ) ); | |
53 | + | |
52 | 54 | return $this->redirectToRoute('aldea_index', array('id' => $aldea->getId())); |
53 | 55 | } |
54 | 56 | |
... | ... | @@ -89,6 +91,8 @@ class aldeaController extends Controller |
89 | 91 | if ($editForm->isSubmitted() && $editForm->isValid()) { |
90 | 92 | $this->getDoctrine()->getManager()->flush(); |
91 | 93 | |
94 | + $this->get('session')->getFlashBag()->set( 'success', array( 'title' => 'Guardado!', 'message' => 'Estado editado satisfactoriamente.' ) ); | |
95 | + | |
92 | 96 | return $this->redirectToRoute('aldea_edit', array('id' => $aldea->getId())); |
93 | 97 | } |
94 | 98 | ... | ... |
src/UBV/PracticaBundle/Entity/aldea.php
... | ... | @@ -30,6 +30,7 @@ class aldea |
30 | 30 | * max = 100, |
31 | 31 | * minMessage = "Por favor introduzca un Nombre de la Aldea más específico. Mínimo {{ limit }} caracteres", |
32 | 32 | * maxMessage = "Por favor introduzca un Nombre de la Aldea más breve. Máximo {{ limit }} caracteres", |
33 | + *) | |
33 | 34 | * @var string |
34 | 35 | * |
35 | 36 | * @ORM\Column(name="descripcion", type="string", length=255) |
... | ... | @@ -44,6 +45,7 @@ class aldea |
44 | 45 | * max = 30, |
45 | 46 | * minMessage = "Por favor introduzca el codigo de la Aldea más específico. Mínimo {{ limit }} caracteres", |
46 | 47 | * maxMessage = "Por favor introduzca el codigo de la Aldea más breve. Máximo {{ limit }} caracteres", |
48 | + *) | |
47 | 49 | * @var int |
48 | 50 | * |
49 | 51 | * @ORM\Column(name="codigo_sucre", type="integer") | ... | ... |