Fix a couple of bugs in handling editing documents associated with
milestones, also include those documents in the initial output on the edit page - Legacy-Id: 4558
This commit is contained in:
parent
488add5004
commit
02509a4d8c
ietf
static/js
|
@ -7,6 +7,7 @@ tr.milestone td { padding: 0.2em 0; cursor: pointer; vertical-align: top; }
|
|||
tr.milestone:hover { background-color: #e8f0fa; }
|
||||
td.due { width: 5em; }
|
||||
.milestone .needs-accept { font-style: italic; display: inline-block; margin-left: 0.5em; color: #2647a0; }
|
||||
.milestone .doc { display: block; padding-left: 1em; }
|
||||
.edit-milestone { display: none; }
|
||||
.edit-milestone.delete, .edit-milestone.delete input { color: #aaa !important; }
|
||||
.edit-milestone table { margin: 0.3em 0; }
|
||||
|
@ -65,8 +66,12 @@ this list</a> to the currently in-use milestones for the {{ group.acronym }} {{
|
|||
<tr class="milestone">
|
||||
<td class="due">{% if form.milestone.resolved %}{{ form.milestone.resolved }}{% else %}{{ form.milestone.due|date:"M Y" }}{% endif %}</td>
|
||||
<td>
|
||||
{{ form.milestone.desc }}
|
||||
{% if form.needs_review %}<span class="needs-accept">awaiting accept</span>{% endif %}
|
||||
<div>{{ form.milestone.desc }}
|
||||
{% if form.needs_review %}<span class="needs-accept">awaiting accept</span>{% endif %}</div>
|
||||
|
||||
{% for d in form.docs_names %}
|
||||
<div class="doc">{{ d }}</div>
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
@ -78,7 +83,7 @@ this list</a> to the currently in-use milestones for the {{ group.acronym }} {{
|
|||
|
||||
<div class="actions">
|
||||
<a href="{% if milestone_set == "charter" %}{% url doc_view name=group.charter.canonical_name %}{% else %}{% url wg_charter acronym=group.acronym %}{% endif %}">Back</a>
|
||||
<input type="submit" data-label-save="Save" data-label-review="Review changes" value="Save"/>
|
||||
<input type="submit" data-labelsave="Save" data-labelreview="Review changes" value="Save"/>
|
||||
<input type="hidden" name="action" value="save">
|
||||
</div>
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
</tr>
|
||||
<tr class="docs">
|
||||
<td>Drafts:</td>
|
||||
<td><input name="{{ form.docs.html_name }}" class="tokenized-field" data-ajax-url="{% url wg_ajax_search_docs group.acronym %}" data-pre="{{ form.docs.prepopulate }}"/>
|
||||
<td><input name="{{ form.docs.html_name }}" class="tokenized-field" data-ajaxurl="{% url wg_ajax_search_docs group.acronym %}" data-pre="{{ form.docs_prepopulate }}"/>
|
||||
{{ form.docs.errors }}
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<td>
|
||||
<div>{{ milestone.desc|escape }}</div>
|
||||
{% for d in milestone.docs.all %}
|
||||
<a class="doc" href="{% url doc_view name=d.name %}">{{ d.name }}</div>
|
||||
<a class="doc" href="{% url doc_view name=d.name %}">{{ d.name }}</a>
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -62,13 +62,17 @@ class MilestoneForm(forms.Form):
|
|||
|
||||
super(MilestoneForm, self).__init__(*args, **kwargs)
|
||||
|
||||
# figure out what to prepopulate many-to-many field with
|
||||
pre = ""
|
||||
if not self.is_bound:
|
||||
pre = self.initial.get("docs", "")
|
||||
else:
|
||||
pre = self["docs"].data or ""
|
||||
|
||||
self.fields["docs"].prepopulate = json_doc_names(parse_doc_names(pre))
|
||||
# this is ugly, but putting it on self["docs"] is buggy with a
|
||||
# bound/unbound form in Django 1.2
|
||||
self.docs_names = parse_doc_names(pre)
|
||||
self.docs_prepopulate = json_doc_names(self.docs_names)
|
||||
|
||||
def clean_docs(self):
|
||||
s = self.cleaned_data["docs"]
|
||||
|
@ -322,7 +326,7 @@ def reset_charter_milestones(request, acronym):
|
|||
try:
|
||||
milestone_ids = [int(v) for v in request.POST.getlist("milestone")]
|
||||
except ValueError as e:
|
||||
return HttpResponseBadRequest("errror in list of ids - %s" % e)
|
||||
return HttpResponseBadRequest("error in list of ids - %s" % e)
|
||||
|
||||
# delete existing
|
||||
for m in charter_milestones:
|
||||
|
|
|
@ -16,7 +16,7 @@ jQuery(function () {
|
|||
action = "save";
|
||||
|
||||
var submit = jQuery("#milestones-form input[type=submit]");
|
||||
submit.val(submit.data("label-" + action));
|
||||
submit.val(submit.data("label" + action));
|
||||
jQuery("#milestones-form input[name=action]").val(action);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,10 +4,11 @@ function setupTokenizedField(field) {
|
|||
|
||||
var pre = [];
|
||||
if (field.val())
|
||||
pre = JSON.parse(field.val());
|
||||
pre = JSON.parse((field.val() || "").replace(/"/g, '"'));
|
||||
else if (field.data("pre"))
|
||||
pre = JSON.parse(field.data("pre"));
|
||||
field.tokenInput(field.data("ajax-url"), {
|
||||
pre = JSON.parse((field.attr("data-pre") || "").replace(/"/g, '"'));
|
||||
|
||||
field.tokenInput(field.data("ajaxurl"), {
|
||||
hintText: "",
|
||||
preventDuplicates: true,
|
||||
prePopulate: pre
|
||||
|
|
Loading…
Reference in a new issue