Added a new template tag to serve up background color for StudentProposals Reviews.
authorLennard de Rijk <ljvderijk@gmail.com>
Mon, 16 Mar 2009 21:17:04 +0000
changeset 1897 634617545037
parent 1896 b99f448e983e
child 1898 7f18e83a129f
Added a new template tag to serve up background color for StudentProposals Reviews. Patch by: Lennard de Rijk Reviewed by: to-be-reviewed
app/soc/templates/soc/templatetags/_as_student_proposal_review.html
app/soc/views/helper/templatetags/comments_helpers.py
--- /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