/
positionField.html.twig
80 lines (60 loc) · 1.98 KB
/
positionField.html.twig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{% extends 'FuzAppBundle::layout.html.twig' %}
{% block extra_js %}
<script src="{{ asset('js/jquery.collection.js') }}"></script>
{% endblock %}
{% block title %}Store elements position in a field{% endblock %}
{% block body %}
<h2>{{ block('title') }}</h2>
<p>Use this option when you have a position field in each elements of your collection.</p>
<p>This is very useful when each element of your collection has its own database relationships.</p>
<hr/>
{%
form_theme form
'jquery.collection.html.twig'
'FuzAppBundle:Basic/PositionField:formTheme.html.twig'
%}
{{ form(form) }}
<hr/>
<table class="table">
<thead>
<th>ID</th>
<th>Name</th>
<th>Position</th>
</thead>
<tbody>
{% for action in data.actions %}
<tr>
<td>{{ action.id }}</td>
<td>{{ action.name }}</td>
<td>{{ action.position }}</td>
</tr>
{% else %}
<tr>
<td colspan="3">No actions submitted</td>
</tr>
{% endfor %}
</tbody>
</table>
<hr/>
<p>Code used:</p>
<pre>{{ block('script') | e }}</pre>
{{
tabs([
'Controller/Basic/PositionFieldController.php',
'Entity/Basic/PositionField/Actions.php',
'Entity/Basic/PositionField/Action.php',
'Form/Basic/PositionField/ActionsType.php',
'Form/Basic/PositionField/ActionType.php',
'Resources/views/Basic/PositionField/positionField.html.twig',
'Resources/views/Basic/PositionField/formTheme.html.twig',
])
}}
{% endblock %}
{% block script %}
<script type="text/javascript">
$('.actions-collection').collection({
position_field_selector: '.my-position',
allow_duplicate: true
});
</script>
{% endblock %}