]> git.ozlabs.org Git - patchwork/blob - templates/patchwork/patch.html
templates: Add CSRF (cross-site request forgery) values to form posts
[patchwork] / templates / patchwork / patch.html
1 {% extends "base.html" %}
2
3 {% load syntax %}
4 {% load person %}
5 {% load patch %}
6
7 {% block title %}{{patch.name}}{% endblock %}
8 {% block heading %}{{patch.name}}{%endblock%}
9
10 {% block body %}
11 <script language="JavaScript" type="text/javascript">
12 function toggle_headers(link_id, headers_id)
13 {
14     var link = document.getElementById(link_id)
15     var headers = document.getElementById(headers_id)
16
17     var hidden = headers.style['display'] == 'none';
18
19     if (hidden) {
20         link.innerHTML = 'hide';
21         headers.style['display'] = 'block';
22     } else {
23         link.innerHTML = 'show';
24         headers.style['display'] = 'none';
25     }
26
27 }
28 </script>
29
30 <table class="patchmeta">
31  <tr>
32   <th>Submitter</th>
33   <td>{{ patch.submitter|personify }}</td></tr>
34  </tr>
35  <tr>
36   <th>Date</th>
37   <td>{{ patch.date }}</td>
38  </tr>
39  <tr>
40   <th>Message ID</th>
41   <td>{{ patch.msgid }}</td>
42  </tr>
43  <tr>
44   <th>Download</th>
45   <td>
46    <a href="{% url patchwork.views.patch.mbox patch_id=patch.id %}"
47    >mbox</a> |
48    <a href="{% url patchwork.views.patch.content patch_id=patch.id %}"
49    >patch</a>
50    </td>
51  </tr>
52  <tr>
53   <th>Permalink</th>
54   <td><a href="{{ patch.get_absolute_url }}">{{ patch.get_absolute_url }}</a>
55  </tr>
56   <tr>
57    <th>State</td>
58    <td>{{ patch.state.name }}{% if patch.archived %}, archived{% endif %}</td>
59   </tr>
60 {% if patch.commit_ref %}
61   <tr>
62    <th>Commit</td>
63    <td>{{ patch.commit_ref }}</td>
64   </tr>
65 {% endif %}
66 {% if patch.delegate %}
67   <tr>
68    <th>Delegated to:</td>
69    <td>{{ patch.delegate.get_profile.name }}</td>
70   </tr>
71 {% endif %}
72  <tr>
73   <th>Headers</th>
74   <td><a id="togglepatchheaders"
75    href="javascript:toggle_headers('togglepatchheaders', 'patchheaders')"
76    >show</a>
77    <div id="patchheaders" class="patchheaders" style="display:none;">
78     <pre>{{patch.headers}}</pre>
79    </div>
80   </td>
81  </tr>
82 </table>
83
84 <div class="patchforms">
85
86 {% if patchform %}
87  <div class="patchform patchform-properties">
88   <h3>Patch Properties</h3>
89    <form method="post">
90     {% csrf_token %}
91     <table class="form">
92      <tr>
93       <th>Change state:</th>
94       <td>
95        {{ patchform.state }}
96        {{ patchform.state.errors }}
97       </td>
98      </tr>
99      <tr>
100       <th>Delegate to:</td>
101       <td>
102        {{ patchform.delegate }}
103        {{ patchform.delegate.errors }}
104       </td>
105      </tr>
106      <tr>
107       <th>Archived:</td>
108       <td>
109        {{ patchform.archived }}
110        {{ patchform.archived.errors }}
111       </td>
112      </tr>
113      <tr>
114       <td></td>
115       <td>
116        <input type="submit" value="Update">
117       </td>
118      </tr>
119     </table>
120   </form>
121  </div>
122 {% endif %}
123
124 {% if createbundleform %}
125  <div class="patchform patchform-bundle">
126   <h3>Bundling</h3>
127    <table class="form">
128    <!--
129     <tr>
130      <td>Ack:</td>
131      <td>
132       <form action="{% url patchwork.views.patch.patch patch_id=patch.id %}"
133        method="post">
134        {% csrf_token %}
135        <input type="hidden" name="action" value="act"/>
136        <input type="submit" value="Ack"/>
137       </form>
138      </td>
139     </tr>
140     -->
141     <tr>
142      <td>Create bundle:</td>
143      <td>
144        {% if createbundleform.non_field_errors %}
145        <dd class="errors">{{createbundleform.non_field_errors}}</dd>
146        {% endif %}
147       <form method="post">
148        {% csrf_token %}
149        <input type="hidden" name="action" value="createbundle"/>
150        {% if createbundleform.name.errors %}
151        <dd class="errors">{{createbundleform.name.errors}}</dd>
152        {% endif %}
153         {{ createbundleform.name }}
154        <input value="Create" type="submit"/>
155       </form>
156       </td>
157     </tr>
158 {% if bundles %}
159     <tr>
160      <td>Add to bundle:</td>
161      <td>
162       <form method="post">
163        {% csrf_token %}
164        <input type="hidden" name="action" value="addtobundle"/>
165        <select name="bundle_id"/>
166         {% for bundle in bundles %}
167          <option value="{{bundle.id}}">{{bundle.name}}</option>
168         {% endfor %}
169         </select>
170        <input value="Add" type="submit"/>
171       </form>
172      </td>
173     </tr>
174 {% endif %}
175    </table>
176   </form>
177
178  </div>
179 {% endif %}
180
181 {% if actionsform %}
182  <div class="patchform patchform-actions">
183   <h3>Actions</h3>
184    <table class="form">
185     <tr>
186      <td>Ack:</td>
187      <td>
188       <form action="{% url patchwork.views.patch.patch patch_id=patch.id %}"
189        method="post">
190        {% csrf_token %}
191        <input type="hidden" name="action" value="act"/>
192        <input type="submit" value="Ack"/>
193       </form>
194      </td>
195     </tr>
196    </table>
197   </form>
198  </div>
199
200 {% endif %}
201  <div style="clear: both;">
202  </div>
203 </div>
204
205
206
207
208 <h2>Comments</h2>
209 {% for comment in patch.comments %}
210 <div class="comment">
211 <div class="meta">{{ comment.submitter|personify }} - {{comment.date}}</div>
212 <pre class="content">
213 {{ comment|commentsyntax }}
214 </pre>
215 </div>
216 {% endfor %}
217
218 <h2>Patch</h2>
219 <div class="patch">
220 <pre class="content">
221 {{ patch|patchsyntax }}
222 </pre>
223 </div>
224
225 {% endblock %}