# HG changeset patch # User Lennard de Rijk # Date 1249850551 25200 # Node ID 4b8aa5b9cb2380857232535d0d06b6c88426677c # Parent 22f41aafcedc47b2f1c03fb38ef41364512d087d Added project title and student name to the ProjectSurvey take page. This required some reodering of the Survey take template and also a renamed setH elpAndStatus to _setSurveyTakeContext. diff -r 22f41aafcedc -r 4b8aa5b9cb23 app/soc/templates/soc/project_survey/take.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/soc/templates/soc/project_survey/take.html Sun Aug 09 13:42:31 2009 -0700 @@ -0,0 +1,18 @@ +{% extends "soc/survey/take.html" %} +{% comment %} +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +{% endcomment %} +{% block help_text %} +{{ block.super }} +This survey is being taken for a project titled "{{ project_entity.title }}" by {{ project_entity.student.name }}. +{% endblock help_text %} diff -r 22f41aafcedc -r 4b8aa5b9cb23 app/soc/templates/soc/survey/take.html --- a/app/soc/templates/soc/survey/take.html Sun Aug 09 13:03:47 2009 -0700 +++ b/app/soc/templates/soc/survey/take.html Sun Aug 09 13:42:31 2009 -0700 @@ -12,6 +12,7 @@ See the License for the specific language governing permissions and limitations under the License. {% endcomment %} +{% load forms_helpers %} {% block scripts %} {{ block.super }} @@ -27,46 +28,50 @@ {% block body %}
Last modified on {{ entity.modified }} by {{ entity.modified_by.name }}
-{% if survey_form %} - - {% load forms_helpers %} - - {{ help_text }} +
+ {% block help_text %} + {{ help_text }} + {% endblock help_text %} +
- {% if entity.content %} -
- {{ entity.content|safe }} -
- {% endif %} +{% block survey_description %} +{% if entity.content %} +
+ {{ entity.content|safe }} +
+{% endif %} +{% endblock survey_description %} - {% if form_action %} -
- {% else %} - - {% endif %} -
-
- - {% block form_table %} - {% as_twoline_table survey_form %} - {% endblock %} -
-
{# end survey_widget #} -
+{% block survey_form %} +{% if form_action %} + +{% else %} + +{% endif %} +
+
+ + {% block form_table %} + {% as_twoline_table survey_form %} + {% endblock %} +
+
{# end survey_widget #} +
-

-
- - - - - - -
- -
-
-
-{% endif %} +

-{% endblock %} +
+ + + + + + +
+ +
+
+ +{% endblock survey_form %} + +{% endblock body %} diff -r 22f41aafcedc -r 4b8aa5b9cb23 app/soc/views/models/project_survey.py --- a/app/soc/views/models/project_survey.py Sun Aug 09 13:03:47 2009 -0700 +++ b/app/soc/views/models/project_survey.py Sun Aug 09 13:42:31 2009 -0700 @@ -77,9 +77,12 @@ 'soc.views.models.%(module_name)s.send_reminder', 'Send Reminder for %(name)s')] + new_params['take_template'] = 'soc/project_survey/take.html' + # used for sending reminders new_params['survey_type'] = 'project' new_params['reminder_template'] = 'soc/project_survey/reminder.html' + new_params['manage_student_project_heading'] = \ 'soc/project_survey/list/heading_manage_student_project.html' new_params['manage_student_project_row'] = \ @@ -168,6 +171,31 @@ # update the properties that will be stored with the referenced project properties.update(project=project_entity, org=project_entity.scope) + def _setSurveyTakeContext(self, request, params, context, survey, + survey_record): + """Sets the context for the ProjectSurvey take page. + + This includes setting the help_text, status and project_entity. + + Args: + request: HTTP request object + params: the params for the current View + context: the context for the view to update + survey: a Survey entity + survey_record: a SurveyRecordEntity + """ + + from soc.logic.models.student_project import logic as student_project_logic + + # call super first to set the other context items + super(View, self)._setSurveyTakeContext(request, params, context, survey, + survey_record) + + # retrieve the project using the key name in the GET param + get_dict = request.GET + context['project_entity'] = student_project_logic.getFromKeyName( + get_dict['project']) + def _constructFilterForProjectSelection(self, survey, params): """Returns the filter needed for the Project selection view. diff -r 22f41aafcedc -r 4b8aa5b9cb23 app/soc/views/models/survey.py --- a/app/soc/views/models/survey.py Sun Aug 09 13:03:47 2009 -0700 +++ b/app/soc/views/models/survey.py Sun Aug 09 13:42:31 2009 -0700 @@ -506,7 +506,7 @@ # fill context with the survey_form and additional information context['survey_form'] = survey_form - self.setHelpAndStatus(context, entity, survey_record) + self._setSurveyTakeContext(request, params, context, entity, survey_record) if request.POST: return self.takePost(request, template, context, params, survey_form, @@ -642,14 +642,16 @@ """ pass - - def setHelpAndStatus(self, context, survey, survey_record): - """Get help_text and status for template use. + def _setSurveyTakeContext(self, request, params, context, survey, + survey_record): + """Sets the help_text and status for take template use. Args: + request: HTTP request object + params: the params for the current View context: the context for the view to update survey: a Survey entity - survey_record: a SurveyRecordEntity + survey_record: a SurveyRecordEntity iff exists """ if not survey.survey_end: