Dodanie opisu zmian do interfejsu zarządzania pull requestami.
[redakcja.git] / platforma / templates / manager / pull_request.html
1 {% extends 'base.html' %}
2
3 {% block bodyid %}management{% endblock %}
4
5 {% block extrahead %}
6 <link rel="stylesheet" href="{{ STATIC_URL }}css/managment.css" type="text/css" />
7 <link rel="stylesheet" href="{{ STATIC_URL }}css/pygments.css" type="text/css" />
8 <script type="text/javascript">
9
10     
11     $(function() {
12
13         function refreshRow(id) {
14             var row = $('#request-' +id);
15
16             $.ajax({
17                 url: '{% url pullrequest_list %}/'+id,
18                 dataType: 'json',
19                 type: 'GET',
20                 success: function(data) {
21                     row.removeClass('status-N');
22                     row.removeClass('status-R');
23                     row.removeClass('status-A');
24                     row.addClass('status-'+ data.status);
25
26                     $('.column-doc', row).html(data.document);
27                     $('.column-status', row).html(data.status);
28
29                     alert('Merge accepted.');
30                 }
31             });            
32             
33         }
34         
35         $('.accept-button').click(function()
36         {
37             var id = parseInt($(this).attr('title'));
38
39             $.ajax({
40                 url: '{% url pullrequest_list %}/'+id,
41                 data: {action: 'accept'},
42                 dataType: 'json',
43                 type: 'PUT',
44                 success: function(data) {
45                     refreshRow(id);
46                 }
47             });
48             
49         });
50         
51         $('.show-diff').click(function() {
52             var button = $(this);
53             
54             if (button.attr('disabled') != 'disabled') {
55                 button.attr('disabled', 'disabled');
56                 var id = parseInt(button.attr('title'));
57                 var docid = $('h2', button.parents('.pull-request')).html();
58                 var revision = $('.pull-request-revision', button.parents('.pull-request')).html();
59                 
60                 $('.diff').slideUp(function() { $(this).remove() });
61                 $('<div class="diff"></div>')
62                     .hide()
63                     .appendTo($(this).parents('.pull-request'))
64                     .slideDown('slow')
65                     .load('/api/documents/' + docid + '/diff?revision=' + revision, null, function() {
66                         button.attr('disabled', null);
67                     });
68             }
69         });
70         
71     });
72 </script>
73 {% endblock %}
74
75 {% block maincontent %}
76 {% if objects %}
77     {% for pullreq in objects %}
78     <div class="status-{{ pullreq.status }} pull-request" id="request-{{ pullreq.id }}">
79         <h2>{{ pullreq.document }}</h2>
80         <ul class="request-info">
81             <li>commiter: {{ pullreq.comitter }}</li>
82             <li>revision: <span class="pull-request-revision">{{ pullreq.source_revision }}</span></li>
83             <li>status: {{ pullreq.status }}</li>
84             <li>data: {{ pullreq.timestamp }}</li>
85         </ul>
86         <p class="comment">{{ pullreq.comment }}</p>
87         <p class="buttons">
88             <button type="button" class="awesome button green accept-button" title="{{pullreq.id}}">Akceptuj</button>
89             <button type="button" class="awesome button show-diff" title="{{pullreq.id}}">Zmiany</button>
90             <a class="awesome button" href="{% url editor_view pullreq.document %}?user=$prq-{{pullreq.id}}">Zobacz</a>
91         </p>
92     </div>
93     {% endfor %}
94 {% else %}
95     {# <tr><td colspan="6">Brak żądań</td></tr> #}
96 {% endif %}
97 {# </table> #}
98
99 {% endblock %}