# HG changeset patch # User Lennard de Rijk # Date 1237238224 0 # Node ID 6346175450370a7d1c35ca8ce5e875683fb1c9e4 # Parent b99f448e983ebec0811a0db40f0970f4ef0a1733 Added a new template tag to serve up background color for StudentProposals Reviews. Patch by: Lennard de Rijk Reviewed by: to-be-reviewed diff -r b99f448e983e -r 634617545037 app/soc/templates/soc/templatetags/_as_student_proposal_review.html --- /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 %} + +
  • +{% if from_student %} +
    +{% else %} +
    +{% endif %} +On {{ created|date:"jS F Y H:i" }} +{% if is_public %} +{{ author }} wrote: +{% else %} +{{ author }} gave a score of {{ score }} and wrote: +{% endif %} +

    {{ content|safe }}

    +
    +
  • diff -r b99f448e983e -r 634617545037 app/soc/views/helper/templatetags/comments_helpers.py --- 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