Show More
@@ -29,7 +29,8 b' def make_map(config):' | |||
|
29 | 29 | #ADMIN |
|
30 | 30 | with map.submapper(path_prefix='/_admin', controller='admin') as m: |
|
31 | 31 | m.connect('admin_home', '/', action='index')#main page |
|
32 |
m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', |
|
|
32 | m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', | |
|
33 | action='add_repo') | |
|
33 | 34 | |
|
34 | 35 | |
|
35 | 36 | map.connect('changeset_home', '/{repo_name}/changeset/{revision}', |
@@ -50,4 +51,6 b' def make_map(config):' | |||
|
50 | 51 | controller='files', action='diff', revision='tip', f_path='') |
|
51 | 52 | map.connect('files_raw_home', '/{repo_name}/rawfile/{revision}/{f_path:.*}', |
|
52 | 53 | controller='files', action='rawfile', revision='tip', f_path='') |
|
54 | map.connect('files_archive_home', '/{repo_name}/archive/{revision}/{fileformat}', | |
|
55 | controller='files', action='archivefile', revision='tip') | |
|
53 | 56 | return map |
@@ -20,21 +20,33 b' class FilesController(BaseController):' | |||
|
20 | 20 | def index(self, repo_name, revision, f_path): |
|
21 | 21 | hg_model = HgModel() |
|
22 | 22 | c.repo = repo = hg_model.get_repo(c.repo_name) |
|
23 | revision = request.POST.get('at_rev', None) or revision | |
|
23 | 24 | |
|
24 | revision = request.POST.get('at_rev', None) or revision | |
|
25 | if request.POST.get('view_low'): | |
|
26 | revision = int(revision) - 1 | |
|
27 | if request.POST.get('view_high'): | |
|
28 | revision = int(revision) + 1 | |
|
25 | def get_next_rev(cur): | |
|
29 | 26 | max_rev = len(c.repo.revisions) - 1 |
|
30 | if revision > max_rev: | |
|
31 |
|
|
|
32 | ||
|
27 | r = cur + 1 | |
|
28 | if r > max_rev: | |
|
29 | r = max_rev | |
|
30 | return r | |
|
31 | ||
|
32 | def get_prev_rev(cur): | |
|
33 | r = cur - 1 | |
|
34 | return r | |
|
35 | ||
|
33 | 36 | c.f_path = f_path |
|
34 | ||
|
37 | ||
|
35 | 38 | |
|
36 | 39 | try: |
|
37 |
c |
|
|
40 | cur_rev = repo.get_changeset(revision).revision | |
|
41 | prev_rev = repo.get_changeset(get_prev_rev(cur_rev)).raw_id | |
|
42 | next_rev = repo.get_changeset(get_next_rev(cur_rev)).raw_id | |
|
43 | ||
|
44 | c.url_prev = url('files_home', repo_name=c.repo_name, | |
|
45 | revision=prev_rev, f_path=f_path) | |
|
46 | c.url_next = url('files_home', repo_name=c.repo_name, | |
|
47 | revision=next_rev, f_path=f_path) | |
|
48 | ||
|
49 | c.changeset = repo.get_changeset(revision) | |
|
38 | 50 | try: |
|
39 | 51 | c.file_msg = c.changeset.get_file_message(f_path) |
|
40 | 52 | except: |
@@ -59,6 +71,9 b' class FilesController(BaseController):' | |||
|
59 | 71 | % f_path.split('/')[-1] |
|
60 | 72 | return file_node.content |
|
61 | 73 | |
|
74 | def archivefile(self, repo_name, revision, fileformat): | |
|
75 | return '%s %s %s' % (repo_name, revision, fileformat) | |
|
76 | ||
|
62 | 77 | def diff(self, repo_name, f_path): |
|
63 | 78 | hg_model = HgModel() |
|
64 | 79 | diff1 = request.GET.get('diff1') |
@@ -8,11 +8,11 b'' | |||
|
8 | 8 | <div id="body" class="browserblock"> |
|
9 | 9 | <div class="browser-header"> |
|
10 | 10 | ${h.form(h.url.current())} |
|
11 | <span>${_('view')}@rev ${h.submit('view_low','-')}${h.text('at_rev',value=c.rev_nr,size='5')}${h.submit('view_high','+')}</span> | |
|
11 | <span>${_('view')}@rev <a style="font-size: 1.3em" href="${c.url_prev}">«</a>${h.text('at_rev',value=c.rev_nr,size='5')}<a style="font-size: 1.3em" href="${c.url_next}">»</a></span> | |
|
12 | 12 | ${h.submit('view','view')} |
|
13 | 13 | ${h.end_form()} |
|
14 | 14 | </div> |
|
15 |
<div class="browser-body"> |
|
|
15 | <div class="browser-body"> | |
|
16 | 16 | <table class="code-browser"> |
|
17 | 17 | <thead> |
|
18 | 18 | <tr> |
@@ -38,12 +38,14 b' from pylons_app.lib import filters' | |||
|
38 | 38 | <dd><pre>hg clone <a href="${c.clone_repo_url}">${c.clone_repo_url}</a></pre></dd> |
|
39 | 39 | <dt>${_('Download')}</dt> |
|
40 | 40 | <dd> |
|
41 | %for archive in c.repo_info._get_archives(): | |
|
42 | | <a href="/${c.repo_info.name}/archive/${archive['node']}${archive['extension']}"> | |
|
43 | ${c.repo_info.name}.${archive['type']} | |
|
44 | </a> | |
|
41 | %for cnt,archive in enumerate(c.repo_info._get_archives()): | |
|
42 | %if cnt >=1: | |
|
43 | | | |
|
44 | %endif | |
|
45 | ${h.link_to(c.repo_info.name+'.'+archive['type'], | |
|
46 | h.url('files_archive_home',repo_name=c.repo_info.name, | |
|
47 | revision='tip',fileformat=archive['extension']))} | |
|
45 | 48 | %endfor |
|
46 | | | |
|
47 | 49 | </dd> |
|
48 | 50 | </dl> |
|
49 | 51 |
General Comments 0
You need to be logged in to leave comments.
Login now