Added the possiblitity to add a description to the top of the Survey.
Thie uses the content property which has been inherited from the Work model.
--- a/app/soc/models/work.py Mon Jul 06 13:19:00 2009 +0200
+++ b/app/soc/models/work.py Mon Jul 06 14:58:46 2009 +0200
@@ -67,13 +67,13 @@
#: The content is only to be displayed to Persons in Roles eligible to
#: view them (which may be anyone, for example, with the site front page).
content = db.TextProperty(verbose_name=ugettext('Content'))
-
+
#: date when the work was created
created = db.DateTimeProperty(auto_now_add=True)
-
+
#: date when the work was last modified
modified = db.DateTimeProperty(auto_now=True)
-
+
# indicating wich user last modified the work. Used in displaying Work
modified_by = db.ReferenceProperty(reference_class=soc.models.user.User,
required=True,
--- a/app/soc/templates/soc/survey/public.html Mon Jul 06 13:19:00 2009 +0200
+++ b/app/soc/templates/soc/survey/public.html Mon Jul 06 14:58:46 2009 +0200
@@ -37,6 +37,10 @@
<form method="get" onsubmit="javascript:return false">
This page gives a preview of how users will see the Survey.
+ <div=description>
+ {{ entity.content|safe }}
+ </div>
+
<div style="width:100%; float:left;">
<div class="{{ status }}" id="survey_widget">
<table>
--- a/app/soc/templates/soc/survey/take.html Mon Jul 06 13:19:00 2009 +0200
+++ b/app/soc/templates/soc/survey/take.html Mon Jul 06 14:58:46 2009 +0200
@@ -33,6 +33,12 @@
{{ help_text }}
+ {% if entity.content %}
+ <div=survey_description>
+ {{ entity.content|safe }}
+ </div>
+ {% endif %}
+
{% if form_action %}
<form method="post" action="{{ form_action }}">
{% else %}
--- a/app/soc/views/models/survey.py Mon Jul 06 13:19:00 2009 +0200
+++ b/app/soc/views/models/survey.py Mon Jul 06 14:58:46 2009 +0200
@@ -154,10 +154,9 @@
},
]
- # survey_html: save form content if POST fails, so fields remain in UI
new_params['create_extra_dynaproperties'] = {
- #'survey_content': forms.fields.CharField(widget=surveys.EditSurvey(),
- #required=False),
+ 'content': forms.fields.CharField(required=False, label='Description',
+ widget=widgets.FullTinyMCE(attrs={'rows': 25, 'cols': 100})),
'survey_html': forms.fields.CharField(widget=forms.HiddenInput,
required=False),
'scope_path': forms.fields.CharField(widget=forms.HiddenInput,
@@ -170,7 +169,7 @@
'clean': cleaning.validate_document_acl(self, True),
}
- new_params['extra_dynaexclude'] = ['author', 'created', 'content',
+ new_params['extra_dynaexclude'] = ['author', 'created',
'home_for', 'modified_by', 'modified',
'take_survey', 'survey_content']