##// END OF EJS Templates
Adde raw file to routes, and refactoring...
marcink -
r148:d928d5f0 default
parent child Browse files
Show More
@@ -1,44 +1,53 b''
1 """Routes configuration
1 """Routes configuration
2
2
3 The more specific and detailed routes should be defined first so they
3 The more specific and detailed routes should be defined first so they
4 may take precedent over the more generic routes. For more information
4 may take precedent over the more generic routes. For more information
5 refer to the routes manual at http://routes.groovie.org/docs/
5 refer to the routes manual at http://routes.groovie.org/docs/
6 """
6 """
7 from routes import Mapper
7 from routes import Mapper
8
8
9 def make_map(config):
9 def make_map(config):
10 """Create, configure and return the routes Mapper"""
10 """Create, configure and return the routes Mapper"""
11 map = Mapper(directory=config['pylons.paths']['controllers'],
11 map = Mapper(directory=config['pylons.paths']['controllers'],
12 always_scan=config['debug'])
12 always_scan=config['debug'])
13 map.minimization = False
13 map.minimization = False
14 map.explicit = False
14 map.explicit = False
15
15
16 # The ErrorController route (handles 404/500 error pages); it should
16 # The ErrorController route (handles 404/500 error pages); it should
17 # likely stay at the top, ensuring it can always be resolved
17 # likely stay at the top, ensuring it can always be resolved
18 map.connect('/error/{action}', controller='error')
18 map.connect('/error/{action}', controller='error')
19 map.connect('/error/{action}/{id}', controller='error')
19 map.connect('/error/{action}/{id}', controller='error')
20
20
21 # CUSTOM ROUTES HERE
21 # CUSTOM ROUTES HERE
22 map.connect('hg_home', '/', controller='hg', action='index')
22 map.connect('hg_home', '/', controller='hg', action='index')
23
23
24
24
25 #REST controllers
25 #REST controllers
26 map.resource('repo', 'repos', path_prefix='/_admin')
26 map.resource('repo', 'repos', path_prefix='/_admin')
27 map.resource('user', 'users', path_prefix='/_admin')
27 map.resource('user', 'users', path_prefix='/_admin')
28
28
29 #ADMIN
29 #ADMIN
30 with map.submapper(path_prefix='/_admin', controller='admin') as m:
30 with map.submapper(path_prefix='/_admin', controller='admin') as m:
31 m.connect('admin_home', '/', action='index')#main page
31 m.connect('admin_home', '/', action='index')#main page
32 m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', action='add_repo')
32 m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', action='add_repo')
33
33
34
34
35 map.connect('changeset_home', '/{repo_name}/changeset/{revision}', controller='changeset', revision='tip')
35 map.connect('changeset_home', '/{repo_name}/changeset/{revision}',
36 map.connect('summary_home', '/{repo_name}/summary', controller='summary')
36 controller='changeset', revision='tip')
37 map.connect('shortlog_home', '/{repo_name}/shortlog/{revision}', controller='shortlog', revision='tip')
37 map.connect('summary_home', '/{repo_name}/summary',
38 map.connect('branches_home', '/{repo_name}/branches', controller='branches')
38 controller='summary')
39 map.connect('tags_home', '/{repo_name}/tags', controller='tags')
39 map.connect('shortlog_home', '/{repo_name}/shortlog/{revision}',
40 map.connect('changelog_home', '/{repo_name}/changelog/{revision}', controller='changelog', revision='tip')
40 controller='shortlog', revision='tip')
41 map.connect('files_home', '/{repo_name}/files/{revision}/{f_path:.*}', controller='files', revision='tip', f_path='')
41 map.connect('branches_home', '/{repo_name}/branches',
42 map.connect('files_diff_home', '/{repo_name}/diff/{f_path:.*}', controller='files', action='diff', revision='tip', f_path='')
42 controller='branches')
43
43 map.connect('tags_home', '/{repo_name}/tags',
44 controller='tags')
45 map.connect('changelog_home', '/{repo_name}/changelog/{revision}',
46 controller='changelog', revision='tip')
47 map.connect('files_home', '/{repo_name}/files/{revision}/{f_path:.*}',
48 controller='files', revision='tip', f_path='')
49 map.connect('files_diff_home', '/{repo_name}/diff/{f_path:.*}',
50 controller='files', action='diff', revision='tip', f_path='')
51 map.connect('files_raw_home', '/{repo_name}/rawfile/{revision}/{f_path:.*}',
52 controller='files', action='rawfile', revision='tip', f_path='')
44 return map
53 return map
@@ -1,25 +1,26 b''
1 <dl class="overview">
1 <dl class="overview">
2 <dt>${_('Revision')}</dt>
2 <dt>${_('Revision')}</dt>
3 <dd>r${c.files_list.last_changeset.revision}:${c.files_list.last_changeset._short}</dd>
3 <dd>r${c.files_list.last_changeset.revision}:${c.files_list.last_changeset._short}</dd>
4 <dt>${_('Size')}</dt>
4 <dt>${_('Size')}</dt>
5 <dd>${h.filesizeformat(c.files_list.size)}</dd>
5 <dd>${h.filesizeformat(c.files_list.size)}</dd>
6 <dt>${_('Options')}</dt>
6 <dt>${_('Options')}</dt>
7 <dd>${h.link_to(_('annotate'),h.url('#'))} / ${h.link_to(_('raw'),h.url('#'))}</dd>
7 <dd>${h.link_to(_('annotate'),h.url('#'))} / ${h.link_to(_('raw'),h.url('files_raw_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))}</dd>
8 <dt>${_('History')}</dt>
8 <dt>${_('History')}</dt>
9 <dd>
9 <dd>
10 ${h.form(h.url('files_diff_home',repo_name=c.repo_name,f_path=c.f_path),method='GET')}
10 ${h.form(h.url('files_diff_home',repo_name=c.repo_name,f_path=c.f_path),method='GET')}
11 ${h.hidden('diff2',c.files_list.last_changeset._short)}
11 ${h.hidden('diff2',c.files_list.last_changeset._short)}
12 ${h.select('diff1','',c.file_history)}
12 ${h.select('diff1','',c.file_history)}
13 ${h.submit('diff','diff')}
13 ${h.submit('diff','diff')}
14 ${h.end_form()}
14 ${h.end_form()}
15 </dd>
15 </dd>
16
16
17 </dl>
17 </dl>
18 <div id="body" class="codeblock">
18 <div id="body" class="codeblock">
19 <div class="code-header">
19 <div class="code-header">
20 <span>${c.files_list.name}@r${c.files_list.last_changeset.revision}:${c.files_list.last_changeset._short}</span>
20 <span>${c.files_list.name}@r${c.files_list.last_changeset.revision}:${c.files_list.last_changeset._short}</span>
21 <span style="font-size:70%">"${c.file_msg}"</span>
21 </div>
22 </div>
22 <div class="code-body">
23 <div class="code-body">
23 ${h.pygmentize(c.files_list.content,linenos=True,anchorlinenos=True,cssclass="code-highlight")}
24 ${h.pygmentize(c.files_list.content,linenos=True,anchorlinenos=True,cssclass="code-highlight")}
24 </div>
25 </div>
25 </div> No newline at end of file
26 </div>
General Comments 0
You need to be logged in to leave comments. Login now