* Add javascripts to the first step
* Add a method areadirectors_set to idtracker/models.py * Edit templates to adopt same look and feel with the existing tool - Legacy-Id: 550
This commit is contained in:
parent
acd5129359
commit
02cbe98a1f
|
@ -81,6 +81,8 @@ class Area(models.Model):
|
|||
def active_area_choices():
|
||||
return [(area.area_acronym_id, area.area_acronym.acronym) for area in Area.objects.filter(status=1).select_related().order_by('acronym.acronym')]
|
||||
active_area_choices = staticmethod(active_area_choices)
|
||||
def areadirectors_set(self):
|
||||
return AreaDirector.objects.filter(area=self.area_acronym)
|
||||
class Meta:
|
||||
db_table = 'areas'
|
||||
verbose_name="area"
|
||||
|
|
|
@ -13,7 +13,8 @@ class NonWgStep1(forms.Form):
|
|||
list_id_delete = forms.ChoiceField(required=False)
|
||||
def add_edit_fields(self):
|
||||
field = self['add_edit']
|
||||
return field.as_widget(field.field.widget)
|
||||
#return field.as_widget(field.field.widget)
|
||||
return [re.sub(r'input ','input onClick="activate_nwg_widgets()" ',str(i)) for i in field.as_widget(field.field.widget)]
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(NonWgStep1, self).__init__(*args, **kwargs)
|
||||
choices=[('', '--Select a list here')] + NonWgMailingList.choices()
|
||||
|
|
|
@ -97,7 +97,7 @@ class NonWgWizard(wizard.Wizard):
|
|||
self.form_list.append(forms.form_for_instance(NonWgMailingList.objects.get(pk=form.clean_data['list_id']), formfield_callback=nonwg_callback))
|
||||
elif form.clean_data['add_edit'] == 'delete':
|
||||
list = NonWgMailingList.objects.get(pk=form.clean_data['list_id_delete'])
|
||||
self.form_list.append(gen_approval([ad.person_id for ad in list.area.areadirectors_set.all()], DeletionPickApprover))
|
||||
self.form_list.append(gen_approval([ad.person_id for ad in list.area.areadirectors_set()], DeletionPickApprover))
|
||||
self.form_list.append(Preview)
|
||||
else:
|
||||
self.clean_forms.append(form)
|
||||
|
@ -105,7 +105,7 @@ class NonWgWizard(wizard.Wizard):
|
|||
form0 = self.clean_forms[0]
|
||||
add_edit = form0.clean_data['add_edit']
|
||||
if add_edit == 'add' or add_edit == 'edit':
|
||||
self.form_list.append(gen_approval([ad.person_id for ad in Area.objects.get(area_acronym=form.clean_data['area']).areadirectors_set.all()], PickApprover))
|
||||
self.form_list.append(gen_approval([ad.person_id for ad in Area.objects.get(area_acronym=form.clean_data['area']).areadirectors_set()], PickApprover))
|
||||
self.form_list.append(Preview)
|
||||
super(NonWgWizard, self).process_step(request, form, step)
|
||||
def done(self, request, form_list):
|
||||
|
|
|
@ -1,16 +1,24 @@
|
|||
{% extends "mailinglists/nwg_wizard_base.html" %}
|
||||
|
||||
{% block nwgcontent %}
|
||||
<a href="/mailinglists/nonwg_lists/"><b>View Current list</b></a><br>
|
||||
</p><p>
|
||||
<h2>Step 3</h2>
|
||||
<form action="." method="POST">
|
||||
FORM( {{ step }} ):<table> {{ form }} </table>
|
||||
|
||||
step_info : <input type="hidden" name="{{ step_field }}" value="{{ step }}" />
|
||||
|
||||
previous_fields: {{ previous_fields }}
|
||||
<input type="hidden" name="{{ step_field }}" value="{{ step }}" />
|
||||
{{ previous_fields }}
|
||||
<table bgcolor="#88AED2" cellspacing="1" border="0">
|
||||
<tr valign="top"><td>
|
||||
<table bgcolor="#f3f8fd" cellpadding="3" cellspacing="0" border="0">
|
||||
<tr><td colspan="2">
|
||||
<h3>Please select approving Area Director: </h3>
|
||||
</td></tr>
|
||||
|
||||
{{ form }}
|
||||
</table>
|
||||
</td></tr></table>
|
||||
<input type="submit">
|
||||
</form>
|
||||
|
||||
clean_forms: {{ clean_forms|escape }}
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
ul.errorlist { color: red; border: 1px solid red; }
|
||||
{% block nwgcss %}{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
{% block head %}
|
||||
{% block javascript %}{% endblock %}
|
||||
<link rel="stylesheet" type="text/css" href="http://www.ietf.org/css/base.css" />
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
@ -1,4 +1,35 @@
|
|||
{% extends "mailinglists/nwg_wizard_base.html" %}
|
||||
{% block javascript %}
|
||||
<script language="javascript">
|
||||
function get_selected_val() {
|
||||
buttons = document.form_post["0-add_edit"]
|
||||
selected = ""
|
||||
for (i = 0; i < buttons.length; i++)
|
||||
if (buttons[i].checked)
|
||||
selected = buttons[i].value
|
||||
return selected
|
||||
}
|
||||
|
||||
|
||||
function activate_nwg_widgets() {
|
||||
selected = get_selected_val()
|
||||
if (selected == "") {
|
||||
return
|
||||
}
|
||||
if (selected == "add") {
|
||||
document.form_post["0-list_id"].disabled=true
|
||||
document.form_post["0-list_id_delete"].disabled=true
|
||||
}
|
||||
if (selected == "edit") {
|
||||
document.form_post["0-list_id"].disabled=false
|
||||
document.form_post["0-list_id_delete"].disabled=true
|
||||
} if (selected == "delete") {
|
||||
document.form_post["0-list_id"].disabled=true
|
||||
document.form_post["0-list_id_delete"].disabled=false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block nwgcontent %}
|
||||
<h4>Please use this Web tool to add a new entry to the <a href="/mailinglists/nonwg_lists/">IETF Non-WG Mailing Lists</a> Web page, to update the information on an existing entry, or to delete an existing entry.</h4>
|
||||
|
@ -7,7 +38,7 @@
|
|||
</p><p>
|
||||
<h2>Step 1</h2>
|
||||
<h3>Please select one:</h3>
|
||||
<form action="." method="POST" name="aform">
|
||||
<form action="." method="POST" name="form_post">
|
||||
{{ form.add_edit_fields.0 }}<br>
|
||||
{{ form.add_edit_fields.1 }}{{ form.list_id }}<br>
|
||||
{{ form.add_edit_fields.2 }}{{ form.list_id_delete }}<br>
|
||||
|
|
Loading…
Reference in a new issue