Show More
@@ -1,44 +1,44 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}', controller='changeset', revision='tip') | |
36 | map.connect('summary_home', '/{repo_name}/summary', controller='summary') |
|
36 | map.connect('summary_home', '/{repo_name}/summary', controller='summary') | |
37 | map.connect('changelog_home', '/{repo_name}/changelog', controller='changelog') |
|
37 | map.connect('changelog_home', '/{repo_name}/changelog/{revision}', controller='changelog', revision='tip') | |
38 | map.connect('branches_home', '/{repo_name}/branches', controller='branches') |
|
38 | map.connect('branches_home', '/{repo_name}/branches', controller='branches') | |
39 | map.connect('tags_home', '/{repo_name}/tags', controller='tags') |
|
39 | map.connect('tags_home', '/{repo_name}/tags', controller='tags') | |
40 | map.connect('graph_home', '/{repo_name}/graph/{revision}', controller='graph', revision='tip') |
|
40 | map.connect('graph_home', '/{repo_name}/graph/{revision}', controller='graph', revision='tip') | |
41 | map.connect('files_home', '/{repo_name}/files/{revision}/{f_path:.*}', controller='files', revision='tip', f_path='') |
|
41 | map.connect('files_home', '/{repo_name}/files/{revision}/{f_path:.*}', controller='files', revision='tip', f_path='') | |
42 |
|
42 | |||
43 |
|
43 | |||
44 | return map |
|
44 | return map |
@@ -1,32 +1,32 b'' | |||||
1 | import logging |
|
1 | import logging | |
2 |
|
2 | |||
3 | from pylons import tmpl_context as c, app_globals as g, session, request, config, url |
|
3 | from pylons import tmpl_context as c, app_globals as g, session, request, config, url | |
4 | from pylons.controllers.util import abort, redirect |
|
4 | from pylons.controllers.util import abort, redirect | |
5 |
|
5 | |||
6 | from pylons_app.lib.base import BaseController, render |
|
6 | from pylons_app.lib.base import BaseController, render | |
7 | from pylons_app.lib.utils import get_repo_slug |
|
7 | from pylons_app.lib.utils import get_repo_slug | |
8 | from pylons_app.model.hg_model import HgModel |
|
8 | from pylons_app.model.hg_model import HgModel | |
9 | log = logging.getLogger(__name__) |
|
9 | log = logging.getLogger(__name__) | |
10 |
|
10 | |||
11 | class SummaryController(BaseController): |
|
11 | class SummaryController(BaseController): | |
12 | def __before__(self): |
|
12 | def __before__(self): | |
13 | c.repos_prefix = config['repos_name'] |
|
13 | c.repos_prefix = config['repos_name'] | |
14 |
|
14 | |||
15 | c.repo_name = get_repo_slug(request) |
|
15 | c.repo_name = get_repo_slug(request) | |
16 |
|
16 | |||
17 | def index(self): |
|
17 | def index(self): | |
18 | hg_model = HgModel() |
|
18 | hg_model = HgModel() | |
19 | c.repo_info = hg_model.get_repo(c.repo_name) |
|
19 | c.repo_info = hg_model.get_repo(c.repo_name) | |
20 | c.repo_changesets = c.repo_info.get_changesets(10) |
|
20 | c.repo_changesets = c.repo_info.get_changesets(10) | |
21 |
|
21 | |||
22 | e = request.environ |
|
22 | e = request.environ | |
23 | uri = r'%(protocol)s://%(user)s@%(host)s/%(repo_name)s' % { |
|
23 | uri = r'%(protocol)s://%(user)s@%(host)s/%(repo_name)s' % { | |
24 | 'protocol': e.get('wsgi.url_scheme'), |
|
24 | 'protocol': e.get('wsgi.url_scheme'), | |
25 | 'user':e.get('REMOTE_USER'), |
|
25 | 'user':e.get('REMOTE_USER'), | |
26 | 'host':e.get('HTTP_HOST'), |
|
26 | 'host':e.get('HTTP_HOST'), | |
27 | 'repo_name':c.repo_name, |
|
27 | 'repo_name':c.repo_name, | |
28 | } |
|
28 | } | |
29 | c.clone_repo_url = url(uri) |
|
29 | c.clone_repo_url = url(uri) | |
30 |
c.repo_tags = [] |
|
30 | c.repo_tags = c.repo_info.tags[:10] | |
31 |
c.repo_branches = [] |
|
31 | c.repo_branches = c.repo_info.branches[:10] | |
32 | return render('/summary.html') |
|
32 | return render('/summary.html') |
@@ -1,89 +1,115 b'' | |||||
1 | <%inherit file="base/base.html"/> |
|
1 | <%inherit file="base/base.html"/> | |
2 | <%! |
|
2 | <%! | |
3 | from pylons_app.lib import filters |
|
3 | from pylons_app.lib import filters | |
4 | %> |
|
4 | %> | |
5 | <%def name="title()"> |
|
5 | <%def name="title()"> | |
6 | ${_('Repository managment')} |
|
6 | ${_('Repository managment')} | |
7 | </%def> |
|
7 | </%def> | |
8 | <%def name="breadcrumbs()"> |
|
8 | <%def name="breadcrumbs()"> | |
9 | ${h.link_to(u'Home',h.url('/'))} |
|
9 | ${h.link_to(u'Home',h.url('/'))} | |
10 | / |
|
10 | / | |
11 | ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))} |
|
11 | ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))} | |
12 | / |
|
12 | / | |
13 | ${_('summary')} |
|
13 | ${_('summary')} | |
14 | </%def> |
|
14 | </%def> | |
15 | <%def name="page_nav()"> |
|
15 | <%def name="page_nav()"> | |
16 | <form action="log"> |
|
16 | <form action="log"> | |
17 | <dl class="search"> |
|
17 | <dl class="search"> | |
18 | <dt><label>Search: </label></dt> |
|
18 | <dt><label>Search: </label></dt> | |
19 | <dd><input type="text" name="rev" /></dd> |
|
19 | <dd><input type="text" name="rev" /></dd> | |
20 | </dl> |
|
20 | </dl> | |
21 | </form> |
|
21 | </form> | |
22 |
|
22 | |||
23 | ${self.menu('summary')} |
|
23 | ${self.menu('summary')} | |
24 | </%def> |
|
24 | </%def> | |
25 | <%def name="main()"> |
|
25 | <%def name="main()"> | |
26 |
|
26 | |||
27 | <h2 class="no-link no-border">${_('Mercurial Repository Overview')}</h2> |
|
27 | <h2 class="no-link no-border">${_('Mercurial Repository Overview')}</h2> | |
28 | <dl class="overview"> |
|
28 | <dl class="overview"> | |
29 | <dt>${_('name')}</dt> |
|
29 | <dt>${_('name')}</dt> | |
30 | <dd>${c.repo_info.name}</dd> |
|
30 | <dd>${c.repo_info.name}</dd> | |
31 | <dt>${_('description')}</dt> |
|
31 | <dt>${_('description')}</dt> | |
32 | <dd>${c.repo_info.description}</dd> |
|
32 | <dd>${c.repo_info.description}</dd> | |
33 | <dt>${_('contact')}</dt> |
|
33 | <dt>${_('contact')}</dt> | |
34 | <dd>${c.repo_info.contact}</dd> |
|
34 | <dd>${c.repo_info.contact}</dd> | |
35 | <dt>${_('last change')}</dt> |
|
35 | <dt>${_('last change')}</dt> | |
36 | <dd>${c.repo_info.last_change|n,filters.rfc822date} - ${c.repo_info.last_change|n,filters.age}</dd> |
|
36 | <dd>${c.repo_info.last_change|n,filters.rfc822date} - ${c.repo_info.last_change|n,filters.age}</dd> | |
37 | <dt>${_('url')}</dt> |
|
37 | <dt>${_('url')}</dt> | |
38 |
<dd><pre> |
|
38 | <dd><pre>hg clone <a href="${c.clone_repo_url}">${c.clone_repo_url}</a></pre></dd> | |
39 | <dt>${_('Download')}</dt> |
|
39 | <dt>${_('Download')}</dt> | |
40 | <dd> |
|
40 | <dd> | |
41 | %for archive in c.repo_info._get_archives(): |
|
41 | %for archive in c.repo_info._get_archives(): | |
42 | | <a href="/${c.repo_info.name}/archive/${archive['node']}${archive['extension']}"> |
|
42 | | <a href="/${c.repo_info.name}/archive/${archive['node']}${archive['extension']}"> | |
43 | ${c.repo_info.name}.${archive['type']} |
|
43 | ${c.repo_info.name}.${archive['type']} | |
44 | </a> |
|
44 | </a> | |
45 | %endfor |
|
45 | %endfor | |
46 | | |
|
46 | | | |
47 | </dd> |
|
47 | </dd> | |
48 | </dl> |
|
48 | </dl> | |
49 |
|
49 | |||
50 | <h2>${h.link_to(_('Changes'),h.url('changelog_home',repo_name=c.repo_name))}</h2> |
|
50 | <h2>${h.link_to(_('Changes'),h.url('changelog_home',repo_name=c.repo_name))}</h2> | |
51 | <table> |
|
51 | <table> | |
52 | %for cnt,cs in enumerate(c.repo_changesets): |
|
52 | %for cnt,cs in enumerate(c.repo_changesets): | |
53 | <tr class="parity${cnt%2}"> |
|
53 | <tr class="parity${cnt%2}"> | |
54 | <td>${cs._ctx.date()|n,filters.age}</td> |
|
54 | <td>${cs._ctx.date()|n,filters.age}</td> | |
55 | <td>${cs.author}</td> |
|
55 | <td>${cs.author}</td> | |
56 | <td> |
|
56 | <td> | |
57 |
|
57 | |||
58 | ${h.link_to(cs.message,h.url('changeset_home',repo_name=c.repo_name,revision=cs._short))} |
|
58 | ${h.link_to(cs.message,h.url('changeset_home',repo_name=c.repo_name,revision=cs._short))} | |
59 | <span class="logtags"> |
|
59 | <span class="logtags"> | |
60 | <span class="branchtag">${cs.branch}</span> |
|
60 | <span class="branchtag">${cs.branch}</span> | |
61 | %for tag in cs.tags: |
|
61 | %for tag in cs.tags: | |
62 | <span class="tagtag">${tag}</span> |
|
62 | <span class="tagtag">${tag}</span> | |
63 | %endfor |
|
63 | %endfor | |
64 | </span> |
|
64 | </span> | |
65 | </td> |
|
65 | </td> | |
66 | <td class="nowrap"> |
|
66 | <td class="nowrap"> | |
67 | ${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=cs._short))} |
|
67 | ${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=cs._short))} | |
68 | | |
|
68 | | | |
69 | ${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=cs._short))} |
|
69 | ${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=cs._short))} | |
70 | </td> |
|
70 | </td> | |
71 | </tr> |
|
71 | </tr> | |
72 | %endfor |
|
72 | %endfor | |
73 | </table> |
|
73 | </table> | |
74 |
|
74 | |||
75 | <h2>${h.link_to(_('Tags'),h.url('tags_home',repo_name=c.repo_name))}</h2> |
|
75 | <h2>${h.link_to(_('Tags'),h.url('tags_home',repo_name=c.repo_name))}</h2> | |
76 | <table> |
|
76 | <table> | |
77 | %for tag in c.repo_tags: |
|
77 | %for cnt,tag in enumerate(c.repo_tags): | |
78 | ${tag} |
|
78 | <tr class="parity${cnt%2}"> | |
|
79 | <td>${tag._ctx.date()|n,filters.age}</td> | |||
|
80 | <td></td> | |||
|
81 | <td> | |||
|
82 | <span class="logtags"> | |||
|
83 | <span class="tagtag">${h.link_to(tag.tags[-1],h.url('changeset_home',repo_name=c.repo_name,revision=tag._short))}</span> | |||
|
84 | </span> | |||
|
85 | </td> | |||
|
86 | <td class="nowrap"> | |||
|
87 | ${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=tag._short))} | |||
|
88 | | | |||
|
89 | ${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=tag._short))} | |||
|
90 | </td> | |||
|
91 | </tr> | |||
79 | %endfor |
|
92 | %endfor | |
80 | </table> |
|
93 | </table> | |
81 |
|
94 | |||
82 | <h2>${h.link_to(_('Branches'),h.url('branches_home',repo_name=c.repo_name))}</h2> |
|
95 | <h2>${h.link_to(_('Branches'),h.url('branches_home',repo_name=c.repo_name))}</h2> | |
83 | <table> |
|
96 | <table> | |
84 | %for branch in c.repo_branches: |
|
97 | %for cnt,branch in enumerate(c.repo_branches): | |
85 | ${branch} |
|
98 | <tr class="parity${cnt%2}"> | |
|
99 | <td>${branch._ctx.date()|n,filters.age}</td> | |||
|
100 | <td></td> | |||
|
101 | <td> | |||
|
102 | <span class="logtags"> | |||
|
103 | <span class="branchtag">${h.link_to(branch.branch,h.url('changeset_home',repo_name=c.repo_name,revision=branch._short))}</span> | |||
|
104 | </span> | |||
|
105 | </td> | |||
|
106 | <td class="nowrap"> | |||
|
107 | ${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=branch._short))} | |||
|
108 | | | |||
|
109 | ${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=branch._short))} | |||
|
110 | </td> | |||
|
111 | </tr> | |||
86 | %endfor |
|
112 | %endfor | |
87 | </table> |
|
113 | </table> | |
88 |
|
114 | |||
89 | </%def> No newline at end of file |
|
115 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now