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
This commit is contained in:
parent
c125ca1c64
commit
25625a0241
|
@ -251,7 +251,7 @@ class EditSubmissionForm(forms.ModelForm):
|
|||
return document_date
|
||||
|
||||
class PreapprovalForm(forms.Form):
|
||||
name = forms.CharField(max_length=255, required=True, label="Pre-approved name", initial="draft-ietf-")
|
||||
name = forms.CharField(max_length=255, required=True, label="Pre-approved name", initial="draft-")
|
||||
|
||||
def clean_name(self):
|
||||
n = self.cleaned_data['name'].strip().lower()
|
||||
|
@ -265,7 +265,7 @@ class PreapprovalForm(forms.Form):
|
|||
if components[-1] == "00":
|
||||
raise forms.ValidationError("Name appears to end with a revision number -00 - do not include the revision.")
|
||||
if len(components) < 4:
|
||||
raise forms.ValidationError("Name has less than four dash-delimited components - can't form a valid WG draft name.")
|
||||
raise forms.ValidationError("Name has less than four dash-delimited components - can't form a valid group draft name.")
|
||||
if not components[-1]:
|
||||
raise forms.ValidationError("Name ends with a dash.")
|
||||
acronym = components[2]
|
||||
|
|
|
@ -331,7 +331,7 @@ def preapprovals_for_user(user):
|
|||
if has_role(user, "Secretariat"):
|
||||
return res
|
||||
|
||||
acronyms = [g.acronym for g in Group.objects.filter(role__person__user=user, type="wg")]
|
||||
acronyms = [g.acronym for g in Group.objects.filter(role__person__user=user, type__in=("wg", "rg"))]
|
||||
|
||||
res = res.filter(name__regex="draft-[^-]+-(%s)-.*" % "|".join(acronyms))
|
||||
|
||||
|
|
|
@ -398,9 +398,9 @@ def approvals(request):
|
|||
context_instance=RequestContext(request))
|
||||
|
||||
|
||||
@role_required("Secretariat", "WG Chair")
|
||||
@role_required("Secretariat", "WG Chair", "RG Chair")
|
||||
def add_preapproval(request):
|
||||
groups = Group.objects.filter(type="wg").exclude(state="conclude").order_by("acronym").distinct()
|
||||
groups = Group.objects.filter(type__in=("wg", "rg")).exclude(state="conclude").order_by("acronym").distinct()
|
||||
|
||||
if not has_role(request.user, "Secretariat"):
|
||||
groups = groups.filter(role__person__user=request.user)
|
||||
|
@ -424,7 +424,7 @@ def add_preapproval(request):
|
|||
'form': form },
|
||||
context_instance=RequestContext(request))
|
||||
|
||||
@role_required("Secretariat", "WG Chair")
|
||||
@role_required("Secretariat", "WG Chair", "RG Chair")
|
||||
def cancel_preapproval(request, preapproval_id):
|
||||
preapproval = get_object_or_404(Preapproval, pk=preapproval_id)
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@ form .actions a { display: inline-block; margin-right: 1em; }
|
|||
|
||||
<h2>Add Pre-Approval</h2>
|
||||
|
||||
<p>You can register a pre-approved draft name. Then the WG Chair
|
||||
approval step of WG -00 submissions is suspended for that draft name
|
||||
<p>You can register a pre-approved draft name. Then the chair
|
||||
approval step of group -00 submissions is suspended for that draft name
|
||||
so a future submission is posted to the data tracker immediately.</p>
|
||||
|
||||
<p>When the revision 00 draft is submitted, the pre-approval will not
|
||||
|
@ -33,12 +33,12 @@ later cancel the pre-approval to get rid of it.</p>
|
|||
like <code>.txt</code> in the name.</p>
|
||||
|
||||
{% if user|has_role:"Secretariat" %}
|
||||
<p>Only WG submissions are subject to approval and are thus pre-approvable.</p>
|
||||
<p>Only group submissions are subject to approval and are thus pre-approvable.</p>
|
||||
{% else %}
|
||||
<p>As WG Chair{% if groups|length > 1 %} of {{ groups|length }} groups{% endif %} you can pre-approve draft names on the form:
|
||||
<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):
|
||||
<table>
|
||||
{% for g in groups %}
|
||||
<tr><td class="name-template">draft-ietf-{{ g.acronym }}-<i>something</i></td></tr>
|
||||
<tr><td class="name-template">draft-{% if g.type_id == "rg"%}irtf{% else %}ietf{% endif %}-{{ g.acronym }}-<i>something</i></td></tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</p>
|
||||
|
@ -56,8 +56,8 @@ like <code>.txt</code> in the name.</p>
|
|||
|
||||
<tr>
|
||||
<td class="actions" colspan="2">
|
||||
<a href="{% url "submit_approvals" %}#preapprovals">Back</a>
|
||||
<input type="submit" value="Add pre-approval" />
|
||||
<a class="button" href="{% url "submit_approvals" %}#preapprovals">Cancel</a>
|
||||
<input class="button" type="submit" value="Add pre-approval" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -68,7 +68,8 @@ like <code>.txt</code> in the name.</p>
|
|||
{% block scripts %}
|
||||
jQuery(function () {
|
||||
jQuery(".name-template").click(function (){
|
||||
jQuery("form.add-preapproval input[name=name]").val(jQuery(this).text().replace("something", ""));
|
||||
// clear text first to make sure the cursor ends up at the end
|
||||
jQuery("form.add-preapproval input[name=name]").text("").focus().val(jQuery(this).text().replace("something", ""));
|
||||
});
|
||||
});
|
||||
{% endblock %}
|
||||
|
|
|
@ -37,7 +37,7 @@ table.preapprovals tr:hover td a.cancel { visibility: visible; }
|
|||
|
||||
<h2 id="preapprovals">Pre-approved drafts not yet submitted</h2>
|
||||
|
||||
{% if user|has_role:"Secretariat,WG Chair" %}
|
||||
{% if user|has_role:"Secretariat,WG Chair,RG Chair" %}
|
||||
<p>You can <a href="{% url "submit_add_preapproval" %}">add a pre-approval</a>.</p>
|
||||
{% endif %}
|
||||
|
||||
|
|
|
@ -15,9 +15,9 @@ Pre-approval of <b>{{ preapproval.name }}</b> by {{ preapproval.by }}
|
|||
on {{ preapproval.time }}.
|
||||
|
||||
<form class="actions" action="" method="post">{% csrf_token %}
|
||||
<a href="{% url "submit_approvals" %}#preapprovals">Back</a>
|
||||
<a class="button" href="{% url "submit_approvals" %}#preapprovals">Don't cancel</a>
|
||||
<input type="hidden" name="action" value="cancel" />
|
||||
<input type="submit" value="Cancel pre-approval" />
|
||||
<input class="button" type="submit" value="Cancel pre-approval" />
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in a new issue