3b19c3bd8b0e095fbfb09a69ec4d530640509ed9
[redakcja.git] / platforma / 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: '{% url pullrequest_list %}/'+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>Zgłoszono</th><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 class="column-data">{{ pullreq.timestamp }}</td>
67         <td>
68             <button type="button" class="accept-button" title="{{pullreq.id}}">Akceptuj</button>
69             <a href="{% url editor_view pullreq.document %}?user=$prq-{{pullreq.id}}">Zobacz</a>
70         </td>
71     </tr>
72     
73     {% endfor %}
74 {% else %}
75     <tr><td colspan="6">Brak żądań</td></tr>
76 {% endif %}
77 </table>
78
79 {% endblock %}