43c7846f309448b70c394522036b332019fc6909
[qcg-portal.git] / qcg / templates / qcg / job_templates.html
1 {% extends 'qcg/base.html' %}
2
3 {% block extra_js %}
4     <script>
5         $(function() {
6             $('.delete-template').on('click', function() {
7                 var $this = $(this),
8                     $modal = $('#delete-modal');
9
10                 $modal.attr('action', $this.data('url'));
11                 $modal.find('em').text($this.data('name'));
12             });
13         });
14     </script>
15 {% endblock %}
16
17 {% block container %}
18     <h1 class="page-header">{% block title %}Szablony zadania{% endblock %}</h1>
19
20     {% if templates %}
21         <table class="table table-hover">
22             <thead>
23                 <tr>
24                     <th class="text-right" style="width: 40px">#</th>
25                     <th>Nazwa</th>
26                     <th style="width: 200px">Data utworzenia</th>
27                     <th style="width: 200px">Data modyfikacji</th>
28                     <th></th>
29                 </tr>
30             </thead>
31             <tbody>
32                 {% for template in templates %}
33                     <tr>
34                         <td class="text-right">{{ forloop.counter }}</td>
35                         <td><a href="{{ template.get_absolute_url }}">{{ template.name }}</a></td>
36                         <td>{{ template.created }}</td>
37                         <td>{{ template.updated }}</td>
38                         <td class="text-right">
39                             <button class="btn btn-xs btn-danger delete-template" title="Usuń"
40                                     data-url="{% url 'template_delete' template.id %}"
41                                     data-name="{{ template.name }}"
42                                     data-toggle="modal" data-target="#delete-modal">
43                                 <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
44                             </button>
45                         </td>
46                     </tr>
47                 {% endfor %}
48             </tbody>
49         </table>
50     {% else %}
51         <div id="no-items" class="alert alert-info">
52             <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
53             Brak zapisanych szablonów zadań
54         </div>
55     {% endif %}
56
57     <form id="delete-modal" action="" method="post" class="modal fade" tabindex="-1"
58           role="dialog" aria-labelledby="delete-modal-label" aria-hidden="true">
59         <div class="modal-dialog">
60             <div class="modal-content">
61                 <div class="modal-header">
62                     <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
63                     <h4 class="modal-title" id="delete-modal-label">Usuwanie szablonu</h4>
64                 </div>
65                 <div class="modal-body">
66                     {% csrf_token %}
67                     <p>Czy na pewno usunąć szablon <em></em>?</p>
68                 </div>
69                 <div class="modal-footer">
70                     <button type="button" class="btn btn-default" data-dismiss="modal">Anuluj</button>
71                     <button type="submit" class="btn btn-danger">Usuń</button>
72                 </div>
73             </div>
74         </div>
75     </form>
76
77 {% endblock %}