author | Madhusudan.C.S <madhusudancs@gmail.com> |
Tue, 08 Sep 2009 21:08:14 +0200 | |
changeset 2889 | 5c0728efdefb |
parent 2838 | 93e1f2bcfef0 |
permissions | -rw-r--r-- |
2838
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1 |
#!/usr/bin/python2.5 |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2 |
# |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3 |
# Copyright 2009 the Melange authors. |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4 |
# |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6 |
# you may not use this file except in compliance with the License. |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7 |
# You may obtain a copy of the License at |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8 |
# |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9 |
# http://www.apache.org/licenses/LICENSE-2.0 |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
10 |
# |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
11 |
# Unless required by applicable law or agreed to in writing, software |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
12 |
# distributed under the License is distributed on an "AS IS" BASIS, |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
13 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
14 |
# See the License for the specific language governing permissions and |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
15 |
# limitations under the License. |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
16 |
|
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
17 |
"""A Django template tag library containing GHOP Task |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
18 |
specific Comments helpers. |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
19 |
""" |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
20 |
|
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
21 |
__authors__ = [ |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
22 |
'"Madhusudan.C.S" <madhusudancs@gmail.com>', |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
23 |
] |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
24 |
|
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
25 |
|
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
26 |
from django import template |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
27 |
|
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
28 |
|
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
29 |
register = template.Library() |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
30 |
|
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
31 |
|
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
32 |
@register.inclusion_tag( |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
33 |
'modules/ghop/templatetags/_as_ghop_task_comments.html', |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
34 |
takes_context=True) |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
35 |
def as_ghop_task_comment(context, comment): |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
36 |
"""Returns a HTML representation of a GHOP task's comments. |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
37 |
""" |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
38 |
|
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
39 |
context['comment'] = comment |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
40 |
context['comment_id'] = comment.key().id_or_name() |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
41 |
return context |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
42 |
|
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
43 |
|
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
44 |
@register.inclusion_tag( |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
45 |
'modules/ghop/templatetags/_as_ghop_task_ws.html', |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
46 |
takes_context=True) |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
47 |
def as_ghop_task_ws(context, comment): |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
48 |
"""Returns a HTML representation of a GHOP task's work submissions. |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
49 |
""" |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
50 |
|
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
51 |
context['ws'] = comment |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
52 |
context['ws_id'] = comment.key().id_or_name() |
93e1f2bcfef0
Added templatetag and filter libraries for GHOP.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
53 |
return context |