Skip to content

Commit 25625a0

Browse files
committed
Add support for RG Chairs for pre-approving draft submissions. Also fixup the preapproval JS so it auto-focuses the draft name text input when you click one of the prefilled names.
- Legacy-Id: 7542
1 parent c125ca1 commit 25625a0

6 files changed

Lines changed: 18 additions & 17 deletions

File tree

ietf/submit/forms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def clean_document_date(self):
251251
return document_date
252252

253253
class PreapprovalForm(forms.Form):
254-
name = forms.CharField(max_length=255, required=True, label="Pre-approved name", initial="draft-ietf-")
254+
name = forms.CharField(max_length=255, required=True, label="Pre-approved name", initial="draft-")
255255

256256
def clean_name(self):
257257
n = self.cleaned_data['name'].strip().lower()
@@ -265,7 +265,7 @@ def clean_name(self):
265265
if components[-1] == "00":
266266
raise forms.ValidationError("Name appears to end with a revision number -00 - do not include the revision.")
267267
if len(components) < 4:
268-
raise forms.ValidationError("Name has less than four dash-delimited components - can't form a valid WG draft name.")
268+
raise forms.ValidationError("Name has less than four dash-delimited components - can't form a valid group draft name.")
269269
if not components[-1]:
270270
raise forms.ValidationError("Name ends with a dash.")
271271
acronym = components[2]

ietf/submit/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ def preapprovals_for_user(user):
331331
if has_role(user, "Secretariat"):
332332
return res
333333

334-
acronyms = [g.acronym for g in Group.objects.filter(role__person__user=user, type="wg")]
334+
acronyms = [g.acronym for g in Group.objects.filter(role__person__user=user, type__in=("wg", "rg"))]
335335

336336
res = res.filter(name__regex="draft-[^-]+-(%s)-.*" % "|".join(acronyms))
337337

ietf/submit/views.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,9 +398,9 @@ def approvals(request):
398398
context_instance=RequestContext(request))
399399

400400

401-
@role_required("Secretariat", "WG Chair")
401+
@role_required("Secretariat", "WG Chair", "RG Chair")
402402
def add_preapproval(request):
403-
groups = Group.objects.filter(type="wg").exclude(state="conclude").order_by("acronym").distinct()
403+
groups = Group.objects.filter(type__in=("wg", "rg")).exclude(state="conclude").order_by("acronym").distinct()
404404

405405
if not has_role(request.user, "Secretariat"):
406406
groups = groups.filter(role__person__user=request.user)
@@ -424,7 +424,7 @@ def add_preapproval(request):
424424
'form': form },
425425
context_instance=RequestContext(request))
426426

427-
@role_required("Secretariat", "WG Chair")
427+
@role_required("Secretariat", "WG Chair", "RG Chair")
428428
def cancel_preapproval(request, preapproval_id):
429429
preapproval = get_object_or_404(Preapproval, pk=preapproval_id)
430430

ietf/templates/submit/add_preapproval.html

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
<h2>Add Pre-Approval</h2>
2020

21-
<p>You can register a pre-approved draft name. Then the WG Chair
22-
approval step of WG -00 submissions is suspended for that draft name
21+
<p>You can register a pre-approved draft name. Then the chair
22+
approval step of group -00 submissions is suspended for that draft name
2323
so a future submission is posted to the data tracker immediately.</p>
2424

2525
<p>When the revision 00 draft is submitted, the pre-approval will not
@@ -33,12 +33,12 @@ <h3>Instructions</h3>
3333
like <code>.txt</code> in the name.</p>
3434

3535
{% if user|has_role:"Secretariat" %}
36-
<p>Only WG submissions are subject to approval and are thus pre-approvable.</p>
36+
<p>Only group submissions are subject to approval and are thus pre-approvable.</p>
3737
{% else %}
38-
<p>As WG Chair{% if groups|length > 1 %} of {{ groups|length }} groups{% endif %} you can pre-approve draft names on the form:
38+
<p>As chair{% if groups|length > 1 %} of {{ groups|length }} groups{% endif %} you can pre-approve draft names on the form (click to pre-fill):
3939
<table>
4040
{% for g in groups %}
41-
<tr><td class="name-template">draft-ietf-{{ g.acronym }}-<i>something</i></td></tr>
41+
<tr><td class="name-template">draft-{% if g.type_id == "rg"%}irtf{% else %}ietf{% endif %}-{{ g.acronym }}-<i>something</i></td></tr>
4242
{% endfor %}
4343
</table>
4444
</p>
@@ -56,8 +56,8 @@ <h3>Instructions</h3>
5656

5757
<tr>
5858
<td class="actions" colspan="2">
59-
<a href="{% url "submit_approvals" %}#preapprovals">Back</a>
60-
<input type="submit" value="Add pre-approval" />
59+
<a class="button" href="{% url "submit_approvals" %}#preapprovals">Cancel</a>
60+
<input class="button" type="submit" value="Add pre-approval" />
6161
</td>
6262
</tr>
6363
</table>
@@ -68,7 +68,8 @@ <h3>Instructions</h3>
6868
{% block scripts %}
6969
jQuery(function () {
7070
jQuery(".name-template").click(function (){
71-
jQuery("form.add-preapproval input[name=name]").val(jQuery(this).text().replace("something", ""));
71+
// clear text first to make sure the cursor ends up at the end
72+
jQuery("form.add-preapproval input[name=name]").text("").focus().val(jQuery(this).text().replace("something", ""));
7273
});
7374
});
7475
{% endblock %}

ietf/templates/submit/approvals.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ <h2 id="approvals">Submissions you can approve</h2>
3737

3838
<h2 id="preapprovals">Pre-approved drafts not yet submitted</h2>
3939

40-
{% if user|has_role:"Secretariat,WG Chair" %}
40+
{% if user|has_role:"Secretariat,WG Chair,RG Chair" %}
4141
<p>You can <a href="{% url "submit_add_preapproval" %}">add a pre-approval</a>.</p>
4242
{% endif %}
4343

ietf/templates/submit/cancel_preapproval.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ <h2>Cancel Pre-Approval</h2>
1515
on {{ preapproval.time }}.
1616

1717
<form class="actions" action="" method="post">{% csrf_token %}
18-
<a href="{% url "submit_approvals" %}#preapprovals">Back</a>
18+
<a class="button" href="{% url "submit_approvals" %}#preapprovals">Don't cancel</a>
1919
<input type="hidden" name="action" value="cancel" />
20-
<input type="submit" value="Cancel pre-approval" />
20+
<input class="button" type="submit" value="Cancel pre-approval" />
2121
</form>
2222

2323
{% endblock %}

0 commit comments

Comments
 (0)