Merge branch 'devel'
[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 %}Zlecanie zadań{% endblock %}</h1>
19
20     <p>Zleć <a class="btn btn-default" href="{% url 'job_submit' %}" role="button">nowe zadanie</a> lub wybierz z listy zapisanych szablonów poniżej.</p>
21     <hr>
22     <h3>Zapisane szablony zadania</h3>
23
24     {% if templates %}
25         <table class="table table-hover">
26             <thead>
27                 <tr>
28                     <th class="text-right" style="width: 40px">#</th>
29                     <th>Nazwa</th>
30                     <th style="width: 200px">Data utworzenia</th>
31                     <th style="width: 200px">Data modyfikacji</th>
32                     <th></th>
33                 </tr>
34             </thead>
35             <tbody>
36                 {% for template in templates %}
37                     <tr>
38                         <td class="text-right">{{ forloop.counter }}</td>
39                         <td><a href="{{ template.get_absolute_url }}">{{ template.name }}</a></td>
40                         <td>{{ template.created }}</td>
41                         <td>{{ template.updated }}</td>
42                         <td class="text-right">
43                             <button class="btn btn-xs btn-danger delete-template" title="Usuń"
44                                     data-url="{% url 'template_delete' template.id %}"
45                                     data-name="{{ template.name }}"
46                                     data-toggle="modal" data-target="#delete-modal">
47                                 <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
48                             </button>
49                         </td>
50                     </tr>
51                 {% endfor %}
52             </tbody>
53         </table>
54     {% else %}
55         <div id="no-items" class="alert alert-info">
56             <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
57             Brak zapisanych szablonów zadań
58         </div>
59     {% endif %}
60
61     <form id="delete-modal" action="" method="post" class="modal fade" tabindex="-1"
62           role="dialog" aria-labelledby="delete-modal-label" aria-hidden="true">
63         <div class="modal-dialog">
64             <div class="modal-content">
65                 <div class="modal-header">
66                     <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
67                     <h4 class="modal-title" id="delete-modal-label">Usuwanie szablonu</h4>
68                 </div>
69                 <div class="modal-body">
70                     {% csrf_token %}
71                     <p>Czy na pewno usunąć szablon <em></em>?</p>
72                 </div>
73                 <div class="modal-footer">
74                     <button type="button" class="btn btn-default" data-dismiss="modal">Anuluj</button>
75                     <button type="submit" class="btn btn-danger">Usuń</button>
76                 </div>
77             </div>
78         </div>
79     </form>
80
81 {% endblock %}