# HG changeset patch # User Madhusudan.C.S # Date 1295525566 -19800 # Node ID 9f04b7bcc3330020a41255edfe9a7da46697c0c3 # Parent 6386458d749b6a315751b2d71581f49e4c2b893a Add a new templatetag to render modified on and by line in documents. Add the necessary div tags, html templates, templatetag function and the CSS to give necessary layout and styling. diff -r 6386458d749b -r 9f04b7bcc333 pytask/static/css/base.css --- a/pytask/static/css/base.css Thu Jan 20 07:56:21 2011 +0530 +++ b/pytask/static/css/base.css Thu Jan 20 17:42:46 2011 +0530 @@ -278,4 +278,25 @@ text-align:center; font-size: 16px; font-weight: bold; -} \ No newline at end of file +} + +/* CSS required for tasks and other document pages. */ +div #modification { + font-size: small; + color: #aa9922; + text-align: right; +} + +div #modification a:link, +div #modification a:visited, +div #modification a:active { + color: #b004fe; + font-weight: bold; + text-decoration: none; +} + +div #modification a:hover { + color: #fb06d0; + font-weight: bold; + text-decoration: none; +} diff -r 6386458d749b -r 9f04b7bcc333 pytask/templates/task/view_textbook.html --- a/pytask/templates/task/view_textbook.html Thu Jan 20 07:56:21 2011 +0530 +++ b/pytask/templates/task/view_textbook.html Thu Jan 20 17:42:46 2011 +0530 @@ -1,13 +1,16 @@ {% extends "base.html" %} {% load form_helpers %} +{% load browse_helpers %} + {% block title %} {{textbook.name}} {% endblock %} {% block content %} -

{{ textbook.name }}

+ {% as_modification_display "Created by" textbook.created_by textbook.creation_datetime %} +

{{ textbook.title }}

{% if can_edit %} Edit Text book @@ -17,8 +20,6 @@ Approve Text book {% endif %} -
created by {{ textbook.created_by.username }} - on {{textbook.creation_datetime|date:"D d M Y"}} at {{textbook.creation_datetime|time:"H:i"}}

{% if textbook.tags.count %} diff -r 6386458d749b -r 9f04b7bcc333 pytask/templates/templatetags/_as_modification_display.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pytask/templates/templatetags/_as_modification_display.html Thu Jan 20 17:42:46 2011 +0530 @@ -0,0 +1,6 @@ +
+ Created on {{ modification_datetime|date:"r" }} by + + {{ user.get_profile.full_name }} + +
\ No newline at end of file diff -r 6386458d749b -r 9f04b7bcc333 pytask/templatetags/browse_helpers.py --- a/pytask/templatetags/browse_helpers.py Thu Jan 20 07:56:21 2011 +0530 +++ b/pytask/templatetags/browse_helpers.py Thu Jan 20 17:42:46 2011 +0530 @@ -25,11 +25,14 @@ } -@register.inclusion_tag('templatetags/_as_div_field.html') -def as_div_field(field): - """Returns the field for each div form field. +@register.inclusion_tag('templatetags/_as_modification_display.html') +def as_modification_display(title, user, creation_datatime): + """Returns a context dictionary containing the fields necessary + to render the creation/modification """ return { - 'field': field, + 'title': title, + 'user': user, + 'modification_datetime': creation_datatime, }