20e47fa6cae779a3d0c1446b17b68abe4dfb3c6a
[redakcja.git] / project / templates / manager / pull_request.html
1 {% extends 'base.html' %}
2
3 {% block extrahead %}
4 <link rel="stylesheet" href="{{ STATIC_URL }}css/managment.css" type="text/css" />
5 <script type="text/javascript">
6
7     
8     $(function() {
9
10         function refreshRow(id) {
11             var row = $('#request-' +id);
12
13             $.ajax({
14                 url: "http://localhost:8000/api/pull-requests/" + id,                
15                 dataType: 'json',
16                 type: 'GET',
17                 success: function(data) {
18                     row.removeClass('status-N');
19                     row.removeClass('status-R');
20                     row.removeClass('status-A');
21                     row.addClass('status-'+ data.status);
22
23                     $('.column-doc', row).html(data.document);
24                     $('.column-status', row).html(data.status);
25
26                     alert('Merge accepted.');
27                 }
28             });            
29             
30         }
31         
32         $('.accept-button').click(function()
33         {
34             var id = parseInt($(this).attr('title'));
35             
36
37             $.ajax({
38                 url: '{% url pullrequest_list %}/'+id,
39                 data: {action: 'accept'},
40                 dataType: 'json',
41                 type: 'PUT',
42                 success: function(data) {
43                     refreshRow(id);
44                 }
45             });
46             
47         });
48         
49     });
50 </script>
51 {% endblock %}
52
53 {% block maincontent %}
54 <table class="request-report" cellspacing="0">
55     <tr>
56         <th>Utwór</th><th>Użytkownik</th><th>Komentarz</th><th>Stan</th>
57         <th>Akcje</th>
58     </tr>
59 {% if objects %}
60     {% for pullreq in objects %}
61     <tr class="status-{{pullreq.status}}" id="request-{{pullreq.id}}">
62         <td class="column-doc">{{ pullreq.document }}</td>
63         <td class="column-user">{{ pullreq.comitter }}</td>
64         <td class="column-comment">{{ pullreq.comment }}</td>
65         <td class="column-status"> {{ pullreq.status }}</td>
66         <td><button type="button" class="accept-button" title="{{pullreq.id}}">Akceptuj</button></td>
67     </tr>
68     
69     {% endfor %}
70 {% else %}
71     <tr><td colspan="*">Brak żądań</td></tr>
72 {% endif %}
73 </table>
74
75 {% endblock %}