]> git.ozlabs.org Git - patchwork/blob - templates/patchwork/patch-list.html
views: Refactor generic_list() to make it less complicated
[patchwork] / templates / patchwork / patch-list.html
1 {% load person %}
2 {% load listurl %}
3
4 {% include "patchwork/pagination.html" %}
5
6
7 <table class="patchlist">
8  <tr>
9   <td class="patchlistfilters">
10  {% include "patchwork/filters.html" %}
11   </td>
12  {% if order.editable %}
13   <td class="patchlistreorder">
14    <form method="post" id="reorderform">
15     {% csrf_token %}
16     <input type="hidden" name="form" value="reorderform"/>
17     <input type="hidden" name="order_start" value="0"/>
18     <span id="reorderhelp"></span>
19     <input id="reorder-cancel" type="button" value="Cancel"
20      onClick="order_cancel_click(this)"/>
21     <input id="reorder-change" type="button" value="Change order"
22      onClick="order_button_click(this)"/>
23     </form>
24   </td>
25  {% endif %}
26  </tr>
27 </table>
28
29 {% if page.paginator.long_page and user.is_authenticated %}
30 <div class="floaty">
31  <a title="jump to form" href="#patchforms"><span
32   style="font-size: 120%">&#9662;</span></a>
33 </div>
34 {% endif %}
35
36 <form method="post">
37 {% csrf_token %}
38 <input type="hidden" name="form" value="patchlistform"/>
39 <input type="hidden" name="project" value="{{project.id}}"/>
40 <table class="patchlist" id="patchlist">
41  <thead>
42   <tr>
43    {% if user.is_authenticated %}
44    <th>
45     <input type="checkbox" onChange="select_all(this)"/>
46    </th>
47    {% endif %}
48
49    <th>
50     {% ifequal order.name "name" %}
51      <a class="colactive"
52       href="{% listurl order=order.reversed_name %}"><img
53       src="/images/16-arrow-{% if order.reversed %}up{% else %}down{%endif%}.png"
54       width="16" height="16"
55      ></a> <a class="colactive"
56       href="{% listurl order=order.reversed_name %}">Patch</a>
57     {% else %}
58      {% if not order.editable %}
59      <a class="colinactive" href="{% listurl order="name" %}">Patch</a>
60      {% else %}
61      <span class="colinactive">Patch</span>
62      {% endif %}
63     {% endifequal %}
64    </th>
65
66    <th>
67     {% ifequal order.name "date" %}
68      <a class="colactive"
69       href="{% listurl order=order.reversed_name %}"><img
70       src="/images/16-arrow-{% if order.reversed %}up{% else %}down{%endif%}.png"
71       width="16" height="16"
72      ></a> <a class="colactive"
73       href="{% listurl order=order.reversed_name %}">Date</a>
74     {% else %}
75      {% if not order.editable %}
76      <a class="colinactive" href="{% listurl order="date" %}">Date</a>
77      {% else %}
78      <span class="colinactive">Date</span>
79      {% endif %}
80     {% endifequal %}
81    </th>
82
83    <th>
84     {% ifequal order.name "submitter" %}
85      <a class="colactive"
86       href="{% listurl order=order.reversed_name %}"><img
87       src="/images/16-arrow-{% if order.reversed %}up{% else %}down{%endif%}.png"
88       width="16" height="16"
89      ></a> <a class="colactive"
90       href="{% listurl order=order.reversed_name %}">Submitter</a>
91     {% else %}
92      {% if not order.editable %}
93      <a class="colinactive" href="{% listurl order="submitter" %}">Submitter</a>
94      {% else %}
95      <span class="colinactive">Submitter</span>
96      {% endif %}
97     {% endifequal %}
98    </th>
99
100    <th>
101     {% ifequal order.name "delegate" %}
102      <a class="colactive"
103       href="{% listurl order=order.reversed_name %}"><img
104       src="/images/16-arrow-{% if order.reversed %}up{% else %}down{%endif%}.png"
105       width="16" height="16"
106      ></a> <a class="colactive"
107       href="{% listurl order=order.reversed_name %}">Delegate</a>
108     {% else %}
109      {% if not order.editable %}
110      <a class="colinactive" href="{% listurl order="delegate" %}">Delegate</a>
111      {% else %}
112      <span class="colinactive">Delegate</span>
113      {% endif %}
114     {% endifequal %}
115    </th>
116
117    <th>
118     {% ifequal order.name "state" %}
119      <a class="colactive"
120       href="{% listurl order=order.reversed_name %}"><img
121       src="/images/16-arrow-{% if order.reversed %}up{% else %}down{%endif%}.png"
122       width="16" height="16"
123      ></a> <a class="colactive"
124       href="{% listurl order=order.reversed_name %}">State</a>
125     {% else %}
126      {% if not order.editable %}
127      <a class="colinactive" href="{% listurl order="state" %}">State</a>
128      {% else %}
129      <span class="colinactive">State</span>
130      {% endif %}
131     {% endifequal %}
132    </th>
133
134   </tr>
135  </thead>
136
137 {% if page %}
138  <tbody>
139  {% for patch in page.object_list %}
140   <tr id="patch_row:{{patch.id}}" class="{% cycle 'odd' 'even' %}">
141     {% if user.is_authenticated %}
142     <td>
143     <input type="checkbox" name="patch_id:{{patch.id}}"/>
144     </td>
145     {% endif %}
146    <td><a href="{% url patchwork.views.patch.patch patch_id=patch.id %}"
147      >{{ patch.name|default:"[no subject]" }}</a></td>
148    <td>{{ patch.date|date:"Y-m-d" }}</td>
149    <td>{{ patch.submitter|personify }}</td>
150    <td>{{ patch.delegate.username }}</td>
151    <td>{{ patch.state }}</td>
152   </tr>
153  {% endfor %}
154  </tbody>
155 </table>
156
157 {% include "patchwork/pagination.html" %}
158
159 <div class="patchforms" id="patchforms" name="patchforms">
160
161 {% if patchform %}
162  <div class="patchform patchform-properties">
163   <h3>Properties</h3>
164     <table class="form">
165      <tr>
166       <th>Change state:</th>
167       <td>
168        {{ patchform.state }}
169        {{ patchform.state.errors }}
170       </td>
171      </tr>
172      <tr>
173       <th>Delegate to:</td>
174       <td>
175        {{ patchform.delegate }}
176        {{ patchform.delegate.errors }}
177       </td>
178      </tr>
179      <tr>
180       <th>Archive:</td>
181       <td>
182        {{ patchform.archived }}
183        {{ patchform.archived.errors }}
184       </td>
185      </tr>
186      <tr>
187       <td></td>
188       <td>
189        <input type="submit" name="action" value="{{patchform.action}}"/>
190       </td>
191      </tr>
192     </table>
193  </div>
194
195 {% endif %}
196
197 {% if user.is_authenticated %}
198  <div class="patchform patchform-bundle">
199   <h3>Bundling</h3>
200    <table class="form">
201     <tr>
202      <td>Create bundle:</td>
203      <td>
204       <input type="text" name="bundle_name"/>
205       <input name="action" value="Create" type="submit"/>
206       </td>
207     </tr>
208   {% if bundles %}
209     <tr>
210      <td>Add to bundle:</td>
211      <td>
212        <select name="bundle_id"/>
213         {% for bundle in bundles %}
214          <option value="{{bundle.id}}">{{bundle.name}}</option>
215         {% endfor %}
216         </select>
217        <input name="action" value="Add" type="submit"/>
218      </td>
219     </tr>
220   {% endif %}
221   {% if bundle %}
222    <tr>
223      <td>Remove from bundle:</td>
224      <td>
225        <input type="hidden" name="removed_bundle_id" value="{{bundle.id}}"/>
226        <input name="action" value="Remove" type="submit"/>
227      </td>
228     </tr>
229   {% endif %}
230   </table>
231  </div>
232 {% endif %}
233
234
235  <div style="clear: both;">
236  </div>
237 </div>
238
239 {% else %}
240  <tr>
241   <td colspan="5">No patches to display</td>
242  </tr>
243 {% endif %}
244
245  </table>
246 </form>
247