From 02cbe98a1fea4ea7d8dc711fbfa1d772ad34704e Mon Sep 17 00:00:00 2001
From: Michael Lee
Date: Wed, 20 Jun 2007 05:21:48 +0000
Subject: [PATCH] * 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
---
ietf/idtracker/models.py | 2 ++
ietf/mailinglists/forms.py | 3 +-
ietf/mailinglists/views.py | 4 +--
ietf/templates/mailinglists/nwg_wizard.html | 20 +++++++----
.../mailinglists/nwg_wizard_base.html | 2 +-
.../mailinglists/nwg_wizard_step0.html | 33 ++++++++++++++++++-
6 files changed, 53 insertions(+), 11 deletions(-)
diff --git a/ietf/idtracker/models.py b/ietf/idtracker/models.py
index 914dca98b..727abe215 100644
--- a/ietf/idtracker/models.py
+++ b/ietf/idtracker/models.py
@@ -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"
diff --git a/ietf/mailinglists/forms.py b/ietf/mailinglists/forms.py
index e81317e10..13c24e9c4 100644
--- a/ietf/mailinglists/forms.py
+++ b/ietf/mailinglists/forms.py
@@ -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()
diff --git a/ietf/mailinglists/views.py b/ietf/mailinglists/views.py
index cba6267bb..aa5c56c4b 100644
--- a/ietf/mailinglists/views.py
+++ b/ietf/mailinglists/views.py
@@ -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):
diff --git a/ietf/templates/mailinglists/nwg_wizard.html b/ietf/templates/mailinglists/nwg_wizard.html
index 47147f9ed..1983e1095 100644
--- a/ietf/templates/mailinglists/nwg_wizard.html
+++ b/ietf/templates/mailinglists/nwg_wizard.html
@@ -1,16 +1,24 @@
{% extends "mailinglists/nwg_wizard_base.html" %}
{% block nwgcontent %}
+View Current list
+
+
Step 3
-clean_forms: {{ clean_forms|escape }}
{% endblock %}
diff --git a/ietf/templates/mailinglists/nwg_wizard_base.html b/ietf/templates/mailinglists/nwg_wizard_base.html
index 389a9bb60..3c8792811 100644
--- a/ietf/templates/mailinglists/nwg_wizard_base.html
+++ b/ietf/templates/mailinglists/nwg_wizard_base.html
@@ -6,8 +6,8 @@
ul.errorlist { color: red; border: 1px solid red; }
{% block nwgcss %}{% endblock %}
{% endblock %}
-
{% block head %}
+{% block javascript %}{% endblock %}
{% endblock %}
diff --git a/ietf/templates/mailinglists/nwg_wizard_step0.html b/ietf/templates/mailinglists/nwg_wizard_step0.html
index 728560450..1f5ecc73c 100644
--- a/ietf/templates/mailinglists/nwg_wizard_step0.html
+++ b/ietf/templates/mailinglists/nwg_wizard_step0.html
@@ -1,4 +1,35 @@
{% extends "mailinglists/nwg_wizard_base.html" %}
+{% block javascript %}
+
+{% endblock %}
{% block nwgcontent %}
Please use this Web tool to add a new entry to the IETF Non-WG Mailing Lists Web page, to update the information on an existing entry, or to delete an existing entry.
@@ -7,7 +38,7 @@
Step 1
Please select one:
-