File tree Expand file tree Collapse file tree 1 file changed +4
-26
lines changed Expand file tree Collapse file tree 1 file changed +4
-26
lines changed Original file line number Diff line number Diff line change @@ -309,31 +309,7 @@ as it allows for more simple cross-browser manipulation of the page.
309
309
First let's add a link on the ``new `` form with a class ``add_tag_link ``.
310
310
Everytime this is clicked by the user, we will add an empty tag for him::
311
311
312
- {% extends "::base.html.twig" %}
313
- {% block body %}
314
- <h1>Product creation</h1>
315
-
316
- <form action="{{ path('product_create') }}" method="post" {{ form_enctype(form) }}>
317
- {{ form_widget(form) }}
318
- <p>
319
- <button type="submit">Create</button>
320
- </p>
321
- </form>
322
-
323
- <ul class="record_actions">
324
- <li>
325
- <a href="{{ path('product') }}">
326
- Back to the list
327
- </a>
328
- </li>
329
- <li>
330
- <a href="#" class="add_tag_link">
331
- Add a tag
332
- </a>
333
- </li>
334
- </ul>
335
- {% include "AcmeTodoBundle:Todo:js.html.twig" %}
336
- {% endblock %}
312
+ $('.record_action').append('<li><a href="#" class="add_tag_link">Add a tag</a></li>');
337
313
338
314
We also include a template containing the javascript needed to add
339
315
the form elements when the link is clicked.
@@ -357,7 +333,9 @@ Our script can be as simple as this::
357
333
// Display the form in the page
358
334
collectionHolder.append(form);
359
335
}
360
-
336
+ // Add the link to add tags
337
+ $('.record_action').append('<li><a href="#" class="add_tag_link">Add a tag</a></li>');
338
+ // When the link is clicked we add the field to input another tag
361
339
$('a.jslink').click(function(event){
362
340
addTagForm();
363
341
});
You can’t perform that action at this time.
0 commit comments