# HG changeset patch # User Pawel Solyga # Date 1238667098 0 # Node ID cecbef1289a5e78d1783a885fdc9f508013d0026 # Parent b3b235acdc6eebb814831a551fc2f3db62381b1e Make the mentor and organization admin comment submission on student proposal nicer. Now drop down box allows you to select comment type and based on selected type and your current Role shows you available comment options. Left TODO to put inline JS into separate JS file. Patch by: Tim Ansell (small fixes by Pawel Solyga) Reviewed by: Pawel Solyga diff -r b3b235acdc6e -r cecbef1289a5 app/soc/templates/soc/student_proposal/review.html --- a/app/soc/templates/soc/student_proposal/review.html Wed Apr 01 17:23:49 2009 +0000 +++ b/app/soc/templates/soc/student_proposal/review.html Thu Apr 02 10:11:38 2009 +0000 @@ -61,14 +61,42 @@
- - Score and Review - - - {% block form_table %} - {% as_table form %} - {% endblock %} +Score and Review + +
+
+ + + + + + + {% block comment_public_form_table %} + {% as_table comment_public %} + {% endblock %} + + + {% block comment_private_form_table %} + {% as_table comment_private %} + {% endblock %} + + + {% block comment_admin_form_table %} + {% as_table comment_admin %} + {% endblock %} +
+ Comment Type: + + +
+ @@ -117,4 +145,55 @@ {% endfor %}
+{% comment %} + TODO(pawel.solyga): Put this javascript into separate file +{% endcomment %} + + {% endblock %} diff -r b3b235acdc6e -r cecbef1289a5 app/soc/views/models/student_proposal.py --- a/app/soc/views/models/student_proposal.py Wed Apr 01 17:23:49 2009 +0000 +++ b/app/soc/views/models/student_proposal.py Thu Apr 02 10:11:38 2009 +0000 @@ -763,6 +763,37 @@ context['form'] = form(initial) + # create the special form for mentors + comment_public = ['public', 'comment'] + comment_private = ['score'] + comment_admin = ['rank', 'mentor'] + class FilterForm(object): + def __init__(self, form, fields): + self.__form = form + self.__fields = fields + + @property + def fields(self): + return dict([(k,i) for k, i in self.__form.fields.iteritems() if k in self.__fields]) + + def __iter__(self): + for x in self.__form: + if x.name not in self.__fields: + continue + yield x + + _marker = [] + def __getattr__(self, key, default=_marker): + if default is self._marker: + return getattr(self.__form, key) + else: + return getattr(self.__form, key, default) + + context['form'] = form(initial) + context['comment_public'] = FilterForm(context['form'], comment_public) + context['comment_private'] = FilterForm(context['form'], comment_private) + context['comment_admin'] = FilterForm(context['form'], comment_admin) + # get all the extra information that should be in the context review_context = self._getDefaultReviewContext(entity, org_admin, mentor) context = dicts.merge(context, review_context)