Added a new template tag to serve up background color for StudentProposals Reviews.
Patch by: Lennard de Rijk
Reviewed by: to-be-reviewed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/soc/templatetags/_as_student_proposal_review.html Mon Mar 16 21:17:04 2009 +0000
@@ -0,0 +1,29 @@
+{% 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 %}
+
+<li class="studentproposalreview">
+{% if from_student %}
+ <div class="student">
+{% else %}
+ <div class="other">
+{% endif %}
+On {{ created|date:"jS F Y H:i" }}
+{% if is_public %}
+{{ author }} wrote:
+{% else %}
+{{ author }} gave a score of <b>{{ score }}</b> and wrote:
+{% endif %}
+<p>{{ content|safe }}</p>
+</div>
+</li>
--- a/app/soc/views/helper/templatetags/comments_helpers.py Mon Mar 16 21:14:55 2009 +0000
+++ b/app/soc/views/helper/templatetags/comments_helpers.py Mon Mar 16 21:17:04 2009 +0000
@@ -85,3 +85,21 @@
return context
+@register.inclusion_tag('soc/templatetags/_as_student_proposal_review.html',
+ takes_context=True)
+def as_student_proposal_review(context, review, student):
+ """Returns a HTML representation of a student proposal review.
+ """
+
+ # TODO(ljvderijk) once review editing is allowed redo this
+
+ context.update({
+ 'author': review.author_name(),
+ 'content': review.content,
+ 'created': review.created,
+ 'score': review.score,
+ 'is_public': review.is_public,
+ 'from_student': review.author.key() == student.user.key()
+ })
+
+ return context