~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/templatefunctions.py

  • Committer: Michael Hudson
  • Date: 2008-08-16 06:34:03 UTC
  • Revision ID: michael.hudson@canonical.com-20080816063403-2lvu1e79mpv3ymg5
make the tab capitalization consistent, see bug #252867

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
import os
17
17
from loggerhead.zptsupport import zpt
18
18
 
19
 
 
20
19
templatefunctions = {}
21
 
 
22
 
 
23
20
def templatefunc(func):
24
21
    templatefunctions[func.__name__] = func
25
22
    return func
26
23
 
27
24
 
28
25
_base = os.path.dirname(__file__)
29
 
 
30
 
 
31
26
def _pt(name):
32
27
    return zpt(os.path.join(_base, 'templates', name + '.pt'))
33
28
 
34
29
 
35
30
templatefunctions['macros'] = _pt('macros').macros
36
 
templatefunctions['breadcrumbs'] = _pt('breadcrumbs').macros
37
 
 
38
31
 
39
32
@templatefunc
40
33
def file_change_summary(url, entry, modified_file_link):
42
35
        url=url, entry=entry, modified_file_link=modified_file_link,
43
36
        **templatefunctions)
44
37
 
45
 
 
46
38
@templatefunc
47
39
def revisioninfo(url, branch, entry, modified_file_link=None):
48
40
    from loggerhead import util
51
43
        modified_file_link=modified_file_link,
52
44
        **templatefunctions)
53
45
 
54
 
 
55
46
@templatefunc
56
47
def collapse_button(group, name, branch, normal='block'):
57
48
    return _pt('collapse-button').expand(
58
49
        group=group, name=name, normal=normal, branch=branch,
59
50
        **templatefunctions)
60
51
 
61
 
 
62
52
@templatefunc
63
53
def collapse_all_button(group, branch, normal='block'):
64
54
    return _pt('collapse-all-button').expand(
65
55
        group=group, normal=normal, branch=branch,
66
56
        **templatefunctions)
67
57
 
68
 
 
69
58
@templatefunc
70
59
def revno_with_nick(entry):
71
60
    if entry.branch_nick:
74
63
        extra = ''
75
64
    return '(%s%s)'%(entry.revno, extra)
76
65
 
77
 
 
78
66
@templatefunc
79
67
def modified_file_link_rev(url, entry, item):
80
68
    return _pt('modified-file-link-rev').expand(
81
69
        url=url, entry=entry, item=item,
82
70
        **templatefunctions)
83
71
 
84
 
 
85
72
@templatefunc
86
73
def modified_file_link_log(url, entry, item):
87
74
    return _pt('modified-file-link-log').expand(
88
75
        url=url, entry=entry, item=item,
89
76
        **templatefunctions)
90
77
 
91
 
 
92
78
@templatefunc
93
79
def search_box(branch, navigation):
94
80
    return _pt('search-box').expand(branch=branch, navigation=navigation,
95
81
        **templatefunctions)
96
82
 
97
 
 
98
83
@templatefunc
99
84
def feed_link(branch, url):
100
85
    return _pt('feed-link').expand(branch=branch, url=url, **templatefunctions)
101
86
 
102
 
 
103
87
@templatefunc
104
88
def menu(branch, url, fileview_active=False):
105
89
    return _pt('menu').expand(branch=branch, url=url,