##// END OF EJS Templates
added limit for showing pygemntized source codes larger than 250kb.
marcink -
r485:9836541b celery
parent child Browse files
Show More
@@ -1,168 +1,171 b''
1 1 """Routes configuration
2 2
3 3 The more specific and detailed routes should be defined first so they
4 4 may take precedent over the more generic routes. For more information
5 5 refer to the routes manual at http://routes.groovie.org/docs/
6 6 """
7 7 from __future__ import with_statement
8 8 from routes import Mapper
9 9 from pylons_app.lib.utils import check_repo_fast as cr
10 10
11 11 def make_map(config):
12 12 """Create, configure and return the routes Mapper"""
13 13 map = Mapper(directory=config['pylons.paths']['controllers'],
14 14 always_scan=config['debug'])
15 15 map.minimization = False
16 16 map.explicit = False
17 17
18 18 # The ErrorController route (handles 404/500 error pages); it should
19 19 # likely stay at the top, ensuring it can always be resolved
20 20 map.connect('/error/{action}', controller='error')
21 21 map.connect('/error/{action}/{id}', controller='error')
22 22
23 23 # CUSTOM ROUTES HERE
24 24 map.connect('hg_home', '/', controller='hg', action='index')
25 25
26 26 def check_repo(environ, match_dict):
27 27 """
28 28 check for valid repository for proper 404 handling
29 29 @param environ:
30 30 @param match_dict:
31 31 """
32 32 repo_name = match_dict.get('repo_name')
33 33 return not cr(repo_name, config['base_path'])
34 34
35 35 #REST REPO MAP
36 36 with map.submapper(path_prefix='/_admin', controller='admin/repos') as m:
37 37 m.connect("repos", "/repos",
38 38 action="create", conditions=dict(method=["POST"]))
39 39 m.connect("repos", "/repos",
40 40 action="index", conditions=dict(method=["GET"]))
41 41 m.connect("formatted_repos", "/repos.{format}",
42 42 action="index",
43 43 conditions=dict(method=["GET"]))
44 44 m.connect("new_repo", "/repos/new",
45 45 action="new", conditions=dict(method=["GET"]))
46 46 m.connect("formatted_new_repo", "/repos/new.{format}",
47 47 action="new", conditions=dict(method=["GET"]))
48 48 m.connect("/repos/{repo_name:.*}",
49 49 action="update", conditions=dict(method=["PUT"],
50 50 function=check_repo))
51 51 m.connect("/repos/{repo_name:.*}",
52 52 action="delete", conditions=dict(method=["DELETE"],
53 53 function=check_repo))
54 54 m.connect("edit_repo", "/repos/{repo_name:.*}/edit",
55 55 action="edit", conditions=dict(method=["GET"],
56 56 function=check_repo))
57 57 m.connect("formatted_edit_repo", "/repos/{repo_name:.*}.{format}/edit",
58 58 action="edit", conditions=dict(method=["GET"],
59 59 function=check_repo))
60 60 m.connect("repo", "/repos/{repo_name:.*}",
61 61 action="show", conditions=dict(method=["GET"],
62 62 function=check_repo))
63 63 m.connect("formatted_repo", "/repos/{repo_name:.*}.{format}",
64 64 action="show", conditions=dict(method=["GET"],
65 65 function=check_repo))
66 66 #ajax delete repo perm user
67 67 m.connect('delete_repo_user', "/repos_delete_user/{repo_name:.*}",
68 68 action="delete_perm_user", conditions=dict(method=["DELETE"],
69 69 function=check_repo))
70 70
71 71 map.resource('user', 'users', controller='admin/users', path_prefix='/_admin')
72 72 map.resource('permission', 'permissions', controller='admin/permissions', path_prefix='/_admin')
73 73
74 74 #REST SETTINGS MAP
75 75 with map.submapper(path_prefix='/_admin', controller='admin/settings') as m:
76 76 m.connect("admin_settings", "/settings",
77 77 action="create", conditions=dict(method=["POST"]))
78 78 m.connect("admin_settings", "/settings",
79 79 action="index", conditions=dict(method=["GET"]))
80 80 m.connect("formatted_admin_settings", "/settings.{format}",
81 81 action="index", conditions=dict(method=["GET"]))
82 82 m.connect("admin_new_setting", "/settings/new",
83 83 action="new", conditions=dict(method=["GET"]))
84 84 m.connect("formatted_admin_new_setting", "/settings/new.{format}",
85 85 action="new", conditions=dict(method=["GET"]))
86 86 m.connect("/settings/{setting_id}",
87 87 action="update", conditions=dict(method=["PUT"]))
88 88 m.connect("/settings/{setting_id}",
89 89 action="delete", conditions=dict(method=["DELETE"]))
90 90 m.connect("admin_edit_setting", "/settings/{setting_id}/edit",
91 91 action="edit", conditions=dict(method=["GET"]))
92 92 m.connect("formatted_admin_edit_setting", "/settings/{setting_id}.{format}/edit",
93 93 action="edit", conditions=dict(method=["GET"]))
94 94 m.connect("admin_setting", "/settings/{setting_id}",
95 95 action="show", conditions=dict(method=["GET"]))
96 96 m.connect("formatted_admin_setting", "/settings/{setting_id}.{format}",
97 97 action="show", conditions=dict(method=["GET"]))
98 98 m.connect("admin_settings_my_account", "/my_account",
99 99 action="my_account", conditions=dict(method=["GET"]))
100 100 m.connect("admin_settings_my_account_update", "/my_account_update",
101 101 action="my_account_update", conditions=dict(method=["PUT"]))
102 102 m.connect("admin_settings_create_repository", "/create_repository",
103 103 action="create_repository", conditions=dict(method=["GET"]))
104 104
105 105 #ADMIN
106 106 with map.submapper(path_prefix='/_admin', controller='admin/admin') as m:
107 107 m.connect('admin_home', '', action='index')#main page
108 108 m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}',
109 109 action='add_repo')
110 110 #SEARCH
111 111 map.connect('search', '/_admin/search', controller='search')
112 112
113 113 #LOGIN/LOGOUT/REGISTER/SIGN IN
114 114 map.connect('login_home', '/_admin/login', controller='login')
115 115 map.connect('logout_home', '/_admin/logout', controller='login', action='logout')
116 116 map.connect('register', '/_admin/register', controller='login', action='register')
117 117 map.connect('reset_password', '/_admin/password_reset', controller='login', action='password_reset')
118 118
119 119 #FEEDS
120 120 map.connect('rss_feed_home', '/{repo_name:.*}/feed/rss',
121 121 controller='feed', action='rss',
122 122 conditions=dict(function=check_repo))
123 123 map.connect('atom_feed_home', '/{repo_name:.*}/feed/atom',
124 124 controller='feed', action='atom',
125 125 conditions=dict(function=check_repo))
126 126
127 127
128 128 #OTHERS
129 129 map.connect('changeset_home', '/{repo_name:.*}/changeset/{revision}',
130 130 controller='changeset', revision='tip',
131 131 conditions=dict(function=check_repo))
132 132 map.connect('raw_changeset_home', '/{repo_name:.*}/raw-changeset/{revision}',
133 controller='changeset',action='raw_changeset', revision='tip',
133 controller='changeset', action='raw_changeset', revision='tip',
134 134 conditions=dict(function=check_repo))
135 135 map.connect('summary_home', '/{repo_name:.*}/summary',
136 136 controller='summary', conditions=dict(function=check_repo))
137 137 map.connect('shortlog_home', '/{repo_name:.*}/shortlog',
138 138 controller='shortlog', conditions=dict(function=check_repo))
139 139 map.connect('branches_home', '/{repo_name:.*}/branches',
140 140 controller='branches', conditions=dict(function=check_repo))
141 141 map.connect('tags_home', '/{repo_name:.*}/tags',
142 142 controller='tags', conditions=dict(function=check_repo))
143 143 map.connect('changelog_home', '/{repo_name:.*}/changelog',
144 144 controller='changelog', conditions=dict(function=check_repo))
145 145 map.connect('files_home', '/{repo_name:.*}/files/{revision}/{f_path:.*}',
146 146 controller='files', revision='tip', f_path='',
147 147 conditions=dict(function=check_repo))
148 148 map.connect('files_diff_home', '/{repo_name:.*}/diff/{f_path:.*}',
149 149 controller='files', action='diff', revision='tip', f_path='',
150 150 conditions=dict(function=check_repo))
151 map.connect('files_raw_home', '/{repo_name:.*}/rawfile/{revision}/{f_path:.*}',
151 map.connect('files_rawfile_home', '/{repo_name:.*}/rawfile/{revision}/{f_path:.*}',
152 152 controller='files', action='rawfile', revision='tip', f_path='',
153 153 conditions=dict(function=check_repo))
154 map.connect('files_raw_home', '/{repo_name:.*}/raw/{revision}/{f_path:.*}',
155 controller='files', action='raw', revision='tip', f_path='',
156 conditions=dict(function=check_repo))
154 157 map.connect('files_annotate_home', '/{repo_name:.*}/annotate/{revision}/{f_path:.*}',
155 158 controller='files', action='annotate', revision='tip', f_path='',
156 159 conditions=dict(function=check_repo))
157 160 map.connect('files_archive_home', '/{repo_name:.*}/archive/{revision}/{fileformat}',
158 161 controller='files', action='archivefile', revision='tip',
159 162 conditions=dict(function=check_repo))
160 163 map.connect('repo_settings_update', '/{repo_name:.*}/settings',
161 164 controller='settings', action="update",
162 165 conditions=dict(method=["PUT"], function=check_repo))
163 166 map.connect('repo_settings_home', '/{repo_name:.*}/settings',
164 167 controller='settings', action='index',
165 168 conditions=dict(function=check_repo))
166 169
167 170
168 171 return map
@@ -1,199 +1,207 b''
1 1 #!/usr/bin/env python
2 2 # encoding: utf-8
3 3 # files controller for pylons
4 4 # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
5 5
6 6 # This program is free software; you can redistribute it and/or
7 7 # modify it under the terms of the GNU General Public License
8 8 # as published by the Free Software Foundation; version 2
9 9 # of the License or (at your opinion) any later version of the license.
10 10 #
11 11 # This program is distributed in the hope that it will be useful,
12 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 14 # GNU General Public License for more details.
15 15 #
16 16 # You should have received a copy of the GNU General Public License
17 17 # along with this program; if not, write to the Free Software
18 18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 19 # MA 02110-1301, USA.
20 20 """
21 21 Created on April 21, 2010
22 22 files controller for pylons
23 23 @author: marcink
24 24 """
25 25 from mercurial import archival
26 26 from pylons import request, response, session, tmpl_context as c, url
27 27 from pylons.controllers.util import redirect
28 28 from pylons_app.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
29 29 from pylons_app.lib.base import BaseController, render
30 30 from pylons_app.lib.utils import EmptyChangeset
31 31 from pylons_app.model.hg_model import HgModel
32 32 from vcs.exceptions import RepositoryError, ChangesetError
33 33 from vcs.nodes import FileNode
34 34 from vcs.utils import diffs as differ
35 35 import logging
36 36 import pylons_app.lib.helpers as h
37 37 import tempfile
38 38
39 39 log = logging.getLogger(__name__)
40 40
41 41 class FilesController(BaseController):
42 42
43 43 @LoginRequired()
44 44 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
45 45 'repository.admin')
46 46 def __before__(self):
47 47 super(FilesController, self).__before__()
48 c.file_size_limit = 250 * 1024 #limit of file size to display
48 49
49 50 def index(self, repo_name, revision, f_path):
50 51 hg_model = HgModel()
51 52 c.repo = repo = hg_model.get_repo(c.repo_name)
52 53 revision = request.POST.get('at_rev', None) or revision
53 54
54 55 def get_next_rev(cur):
55 56 max_rev = len(c.repo.revisions) - 1
56 57 r = cur + 1
57 58 if r > max_rev:
58 59 r = max_rev
59 60 return r
60 61
61 62 def get_prev_rev(cur):
62 63 r = cur - 1
63 64 return r
64 65
65 66 c.f_path = f_path
66 67
67 68
68 69 try:
69 70 cur_rev = repo.get_changeset(revision).revision
70 71 prev_rev = repo.get_changeset(get_prev_rev(cur_rev)).raw_id
71 72 next_rev = repo.get_changeset(get_next_rev(cur_rev)).raw_id
72 73
73 74 c.url_prev = url('files_home', repo_name=c.repo_name,
74 75 revision=prev_rev, f_path=f_path)
75 76 c.url_next = url('files_home', repo_name=c.repo_name,
76 77 revision=next_rev, f_path=f_path)
77 78
78 79 c.changeset = repo.get_changeset(revision)
79
80 80
81 81 c.cur_rev = c.changeset.raw_id
82 82 c.rev_nr = c.changeset.revision
83 83 c.files_list = c.changeset.get_node(f_path)
84 84 c.file_history = self._get_history(repo, c.files_list, f_path)
85 85
86 86 except (RepositoryError, ChangesetError):
87 87 c.files_list = None
88 88
89 89 return render('files/files.html')
90 90
91 91 def rawfile(self, repo_name, revision, f_path):
92 92 hg_model = HgModel()
93 93 c.repo = hg_model.get_repo(c.repo_name)
94 94 file_node = c.repo.get_changeset(revision).get_node(f_path)
95 95 response.content_type = file_node.mimetype
96 96 response.content_disposition = 'attachment; filename=%s' \
97 97 % f_path.split('/')[-1]
98 98 return file_node.content
99
100 def raw(self, repo_name, revision, f_path):
101 hg_model = HgModel()
102 c.repo = hg_model.get_repo(c.repo_name)
103 file_node = c.repo.get_changeset(revision).get_node(f_path)
104 response.content_type = 'text/plain'
105
106 return file_node.content
99 107
100 108 def annotate(self, repo_name, revision, f_path):
101 109 hg_model = HgModel()
102 110 c.repo = hg_model.get_repo(c.repo_name)
103 111 cs = c.repo.get_changeset(revision)
104 112 c.file = cs.get_node(f_path)
105 113 c.file_msg = cs.get_file_message(f_path)
106 114 c.cur_rev = cs.raw_id
107 115 c.rev_nr = cs.revision
108 116 c.f_path = f_path
109 117
110 118 return render('files/files_annotate.html')
111 119
112 120 def archivefile(self, repo_name, revision, fileformat):
113 121 archive_specs = {
114 122 '.tar.bz2': ('application/x-tar', 'tbz2'),
115 123 '.tar.gz': ('application/x-tar', 'tgz'),
116 124 '.zip': ('application/zip', 'zip'),
117 125 }
118 126 if not archive_specs.has_key(fileformat):
119 127 return 'Unknown archive type %s' % fileformat
120 128
121 129 def read_in_chunks(file_object, chunk_size=1024 * 40):
122 130 """Lazy function (generator) to read a file piece by piece.
123 131 Default chunk size: 40k."""
124 132 while True:
125 133 data = file_object.read(chunk_size)
126 134 if not data:
127 135 break
128 136 yield data
129 137
130 138 archive = tempfile.TemporaryFile()
131 139 repo = HgModel().get_repo(repo_name).repo
132 140 fname = '%s-%s%s' % (repo_name, revision, fileformat)
133 141 archival.archive(repo, archive, revision, archive_specs[fileformat][1],
134 142 prefix='%s-%s' % (repo_name, revision))
135 143 response.content_type = archive_specs[fileformat][0]
136 144 response.content_disposition = 'attachment; filename=%s' % fname
137 145 archive.seek(0)
138 146 return read_in_chunks(archive)
139 147
140 148 def diff(self, repo_name, f_path):
141 149 hg_model = HgModel()
142 150 diff1 = request.GET.get('diff1')
143 151 diff2 = request.GET.get('diff2')
144 152 c.action = request.GET.get('diff')
145 153 c.no_changes = diff1 == diff2
146 154 c.f_path = f_path
147 155 c.repo = hg_model.get_repo(c.repo_name)
148 156
149 157 try:
150 158 if diff1 not in ['', None, 'None', '0' * 12]:
151 159 c.changeset_1 = c.repo.get_changeset(diff1)
152 160 node1 = c.changeset_1.get_node(f_path)
153 161 else:
154 162 c.changeset_1 = EmptyChangeset()
155 163 node1 = FileNode('.', '')
156 164 if diff2 not in ['', None, 'None', '0' * 12]:
157 165 c.changeset_2 = c.repo.get_changeset(diff2)
158 166 node2 = c.changeset_2.get_node(f_path)
159 167 else:
160 168 c.changeset_2 = EmptyChangeset()
161 169 node2 = FileNode('.', '')
162 170 except RepositoryError:
163 171 return redirect(url('files_home',
164 172 repo_name=c.repo_name, f_path=f_path))
165 173
166 174 c.diff1 = 'r%s:%s' % (c.changeset_1.revision, c.changeset_1.raw_id)
167 175 c.diff2 = 'r%s:%s' % (c.changeset_2.revision, c.changeset_2.raw_id)
168 176 f_udiff = differ.get_udiff(node1, node2)
169 177
170 178 diff = differ.DiffProcessor(f_udiff)
171 179
172 180 if c.action == 'download':
173 181 diff_name = '%s_vs_%s.diff' % (diff1, diff2)
174 182 response.content_type = 'text/plain'
175 183 response.content_disposition = 'attachment; filename=%s' \
176 184 % diff_name
177 185 return diff.raw_diff()
178 186
179 187 elif c.action == 'raw':
180 188 c.cur_diff = '<pre class="raw">%s</pre>' % h.escape(diff.raw_diff())
181 189 elif c.action == 'diff':
182 190 c.cur_diff = diff.as_html()
183 191 else:
184 192 #default option
185 193 c.cur_diff = diff.as_html()
186 194
187 195 if not c.cur_diff: c.no_changes = True
188 196 return render('files/file_diff.html')
189 197
190 198 def _get_history(self, repo, node, f_path):
191 199 from vcs.nodes import NodeKind
192 200 if not node.kind is NodeKind.FILE:
193 201 return []
194 202 changesets = node.history
195 203 hist_l = []
196 204 for chs in changesets:
197 205 n_desc = 'r%s:%s' % (chs.revision, chs._short)
198 206 hist_l.append((chs._short, n_desc,))
199 207 return hist_l
@@ -1,52 +1,59 b''
1 1 <%inherit file="/base/base.html"/>
2 2
3 3 <%def name="title()">
4 4 ${_('File annotate')}
5 5 </%def>
6 6
7 7 <%def name="breadcrumbs_links()">
8 8 ${h.link_to(u'Home',h.url('/'))}
9 9 &raquo;
10 10 ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))}
11 11 &raquo;
12 12 ${_('annotate')} @ R${c.rev_nr}:${c.cur_rev}
13 13 </%def>
14 14
15 15 <%def name="page_nav()">
16 16 ${self.menu('files')}
17 17 </%def>
18 18 <%def name="main()">
19 19 <div class="box">
20 20 <!-- box / title -->
21 21 <div class="title">
22 22 ${self.breadcrumbs()}
23 23 </div>
24 24 <div class="table">
25 25 <div id="files_data">
26 <h2>${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.cur_rev,c.file.path)}</h2>
26 <h3 class="files_location">${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.cur_rev,c.file.path)}</h3>
27 27 <dl class="overview">
28 28 <dt>${_('Last revision')}</dt>
29 29 <dd>${h.link_to("r%s:%s" % (c.file.last_changeset.revision,c.file.last_changeset._short),
30 30 h.url('files_annotate_home',repo_name=c.repo_name,revision=c.file.last_changeset._short,f_path=c.f_path))} </dd>
31 31 <dt>${_('Size')}</dt>
32 32 <dd>${h.format_byte_size(c.file.size,binary=True)}</dd>
33 33 <dt>${_('Options')}</dt>
34 34 <dd>${h.link_to(_('show source'),
35 35 h.url('files_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))}
36 / ${h.link_to(_('show as raw'),
37 h.url('files_raw_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))}
36 38 / ${h.link_to(_('download as raw'),
37 h.url('files_raw_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))}
39 h.url('files_rawfile_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))}
38 40 </dd>
39 41 </dl>
40 42 <div id="body" class="codeblock">
41 43 <div class="code-header">
42 44 <div class="revision">${c.file.name}@r${c.file.last_changeset.revision}:${c.file.last_changeset._short}</div>
43 45 <div class="commit">"${c.file_msg}"</div>
44 46 </div>
45 47 <div class="code-body">
46 ${h.pygmentize_annotation(c.file,linenos=True,anchorlinenos=True,lineanchors='S',cssclass="code-highlight")}
48 % if c.file.size < c.file_size_limit:
49 ${h.pygmentize_annotation(c.file,linenos=True,anchorlinenos=True,lineanchors='S',cssclass="code-highlight")}
50 %else:
51 ${_('File is to big to display')} ${h.link_to(_('show as raw'),
52 h.url('files_raw_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))}
53 %endif
47 54 </div>
48 55 </div>
49 56 </div>
50 57 </div>
51 58 </div>
52 59 </%def> No newline at end of file
@@ -1,48 +1,55 b''
1 1 <dl>
2 2 <dt>${_('Last revision')}</dt>
3 3 <dd>
4 4 ${h.link_to("r%s:%s" % (c.files_list.last_changeset.revision,c.files_list.last_changeset._short),
5 5 h.url('files_home',repo_name=c.repo_name,revision=c.files_list.last_changeset._short,f_path=c.f_path))}
6 6 </dd>
7 7 <dt>${_('Size')}</dt>
8 8 <dd>${h.format_byte_size(c.files_list.size,binary=True)}</dd>
9 9 <dt>${_('Options')}</dt>
10 10 <dd>${h.link_to(_('show annotation'),
11 h.url('files_annotate_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))}
11 h.url('files_annotate_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))}
12 / ${h.link_to(_('show as raw'),
13 h.url('files_raw_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))}
12 14 / ${h.link_to(_('download as raw'),
13 h.url('files_raw_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))}
15 h.url('files_rawfile_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))}
14 16 </dd>
15 17 <dt>${_('History')}</dt>
16 18 <dd>
17 19 <div>
18 20 ${h.form(h.url('files_diff_home',repo_name=c.repo_name,f_path=c.f_path),method='get')}
19 21 ${h.hidden('diff2',c.files_list.last_changeset._short)}
20 22 ${h.select('diff1',c.files_list.last_changeset._short,c.file_history)}
21 23 ${h.submit('diff','diff to revision',class_="ui-button ui-widget ui-state-default ui-corner-all")}
22 24 ${h.submit('show_rev','show at revision',class_="ui-button ui-widget ui-state-default ui-corner-all")}
23 25 ${h.end_form()}
24 26 </div>
25 27 </dd>
26 28 </dl>
27 29
28 30
29 31 <div id="body" class="codeblock">
30 32 <div class="code-header">
31 33 <div class="revision">${c.files_list.name}@r${c.files_list.last_changeset.revision}:${c.files_list.last_changeset._short}</div>
32 34 <div class="commit">"${c.files_list.last_changeset.message}"</div>
33 35 </div>
34 36 <div class="code-body">
35 ${h.pygmentize(c.files_list,linenos=True,anchorlinenos=True,lineanchors='S',cssclass="code-highlight")}
37 % if c.files_list.size < c.file_size_limit:
38 ${h.pygmentize(c.files_list,linenos=True,anchorlinenos=True,lineanchors='S',cssclass="code-highlight")}
39 %else:
40 ${_('File is to big to display')} ${h.link_to(_('show as raw'),
41 h.url('files_raw_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))}
42 %endif
36 43 </div>
37 44 </div>
38 45
39 46 <script type="text/javascript">
40 47 YAHOO.util.Event.onDOMReady(function(){
41 48 YAHOO.util.Event.addListener('show_rev','click',function(e){
42 49 YAHOO.util.Event.preventDefault(e);
43 50 var cs = YAHOO.util.Dom.get('diff1').value;
44 51 var url = "${h.url('files_home',repo_name=c.repo_name,revision='__CS__',f_path=c.f_path)}".replace('__CS__',cs);
45 52 window.location = url;
46 53 });
47 54 });
48 55 </script> No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now