Show More
@@ -0,0 +1,95 b'' | |||
|
1 | <%inherit file="base/base.html"/> | |
|
2 | ||
|
3 | <%def name="title()"> | |
|
4 | ${_('Repository managment')} | |
|
5 | </%def> | |
|
6 | <%def name="breadcrumbs()"> | |
|
7 | ${h.link_to(u'Home',h.url('/'))} | |
|
8 | / | |
|
9 | ${h.link_to(c.repo_name,h.url('files_home',repo_name=c.repo_name))} | |
|
10 | / | |
|
11 | ${_('files')} | |
|
12 | </%def> | |
|
13 | <%def name="page_nav()"> | |
|
14 | <form action="log"> | |
|
15 | <dl class="search"> | |
|
16 | <dt><label>Search: </label></dt> | |
|
17 | <dd><input type="text" name="rev" /></dd> | |
|
18 | </dl> | |
|
19 | </form> | |
|
20 | ||
|
21 | ${self.menu('files')} | |
|
22 | </%def> | |
|
23 | <%def name="css()"> | |
|
24 | <link rel="stylesheet" href="/css/style-monoblue_custom.css" type="text/css" /> | |
|
25 | <link rel="stylesheet" href="/css/pygments.css" type="text/css" /> | |
|
26 | </%def> | |
|
27 | <%def name="main()"> | |
|
28 | ||
|
29 | <h2 class="no-link no-border">${_('Files')}</h2> | |
|
30 | <div id="files_data"> | |
|
31 | <h2>${_('File')}: ${c.repo_name}/${c.f_path}</h2> | |
|
32 | %if c.files_list.is_dir(): | |
|
33 | <table class="code-browser"> | |
|
34 | <thead> | |
|
35 | <tr> | |
|
36 | <th class="width-50 lefted">${_('Name')}</th> | |
|
37 | <th class="width-10 righted">${_('Size')}</th> | |
|
38 | <th class="width-10 righted">${_('Revision')}</th> | |
|
39 | <th class="width-15 righted">${_('Last modified')}</th> | |
|
40 | <th class="width-15 righted">${_('Last commiter')}</th> | |
|
41 | </tr> | |
|
42 | </thead> | |
|
43 | <tr> | |
|
44 | % if c.files_list.parent: | |
|
45 | <td colspan="5" class="browser-dir"> | |
|
46 | ${h.link_to('..',h.url('files_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.files_list.parent))} | |
|
47 | </td> | |
|
48 | %endif | |
|
49 | </tr> | |
|
50 | <%def name="file_class(node)"> | |
|
51 | %if node.is_file(): | |
|
52 | browser-file | |
|
53 | %else: | |
|
54 | browser-dir | |
|
55 | %endif | |
|
56 | </%def> | |
|
57 | ||
|
58 | ||
|
59 | %for cnt,node in enumerate(c.files_list): | |
|
60 | <tr class="parity${cnt%2}"> | |
|
61 | ||
|
62 | <td class="${file_class(node)}"> | |
|
63 | ${h.link_to(node.name,h.url('files_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=node.path),class_='file or dir')} | |
|
64 | </td> | |
|
65 | <td> | |
|
66 | %if node.is_file(): | |
|
67 | ${h.filesizeformat(node.size)} | |
|
68 | %endif | |
|
69 | </td> | |
|
70 | <td> | |
|
71 | %if node.is_file(): | |
|
72 | ${node.last_changeset.revision} | |
|
73 | %endif | |
|
74 | </td> | |
|
75 | <td> | |
|
76 | %if node.is_file(): | |
|
77 | ${node.last_changeset.date} | |
|
78 | %endif | |
|
79 | </td> | |
|
80 | <td> | |
|
81 | %if node.is_file(): | |
|
82 | ${node.last_changeset.author} | |
|
83 | %endif | |
|
84 | ||
|
85 | </td> | |
|
86 | </tr> | |
|
87 | %endfor | |
|
88 | </table> | |
|
89 | %else: | |
|
90 | <div id="body" class="codeblock"> | |
|
91 | ${h.pygmentize(c.files_list.content,linenos=True,anchorlinenos=True,cssclass="code-highlight")} | |
|
92 | </div> | |
|
93 | %endif | |
|
94 | </div> | |
|
95 | </%def> No newline at end of file |
@@ -1,43 +1,43 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 routes import Mapper |
|
8 | 8 | |
|
9 | 9 | def make_map(config): |
|
10 | 10 | """Create, configure and return the routes Mapper""" |
|
11 | 11 | map = Mapper(directory=config['pylons.paths']['controllers'], |
|
12 | 12 | always_scan=config['debug']) |
|
13 | 13 | map.minimization = False |
|
14 | 14 | map.explicit = False |
|
15 | 15 | |
|
16 | 16 | # The ErrorController route (handles 404/500 error pages); it should |
|
17 | 17 | # likely stay at the top, ensuring it can always be resolved |
|
18 | 18 | map.connect('/error/{action}', controller='error') |
|
19 | 19 | map.connect('/error/{action}/{id}', controller='error') |
|
20 | 20 | |
|
21 | 21 | # CUSTOM ROUTES HERE |
|
22 | 22 | map.connect('hg_home', '/', controller='hg', action='index') |
|
23 | 23 | |
|
24 | 24 | |
|
25 | 25 | #REST controllers |
|
26 | 26 | map.resource('repo', 'repos', path_prefix='/_admin') |
|
27 | 27 | map.resource('user', 'users', path_prefix='/_admin') |
|
28 | 28 | |
|
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 | 32 | m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', action='add_repo') |
|
33 | 33 | |
|
34 | 34 | |
|
35 | 35 | map.connect('summary_home', '/{repo_name}/summary', controller='summary') |
|
36 | 36 | map.connect('changelog_home', '/{repo_name}/changelog', controller='changelog') |
|
37 | 37 | map.connect('branches_home', '/{repo_name}/branches', controller='branches') |
|
38 | 38 | map.connect('tags_home', '/{repo_name}/tags', controller='tags') |
|
39 | 39 | map.connect('graph_home', '/{repo_name}/graph/{revision}', controller='graph', revision='tip') |
|
40 |
map.connect('files_home', '/{repo_name}/files/{revision}/{path |
|
|
40 | map.connect('files_home', '/{repo_name}/files/{revision}/{f_path:.*}', controller='files', revision='tip', f_path='') | |
|
41 | 41 | |
|
42 | 42 | |
|
43 | 43 | return map |
@@ -1,16 +1,27 b'' | |||
|
1 | 1 | import logging |
|
2 | 2 | |
|
3 | from pylons import request, response, session, tmpl_context as c, url | |
|
3 | from pylons import request, response, session, tmpl_context as c, url, config, app_globals as g | |
|
4 | 4 | from pylons.controllers.util import abort, redirect |
|
5 | 5 | |
|
6 | 6 | from pylons_app.lib.base import BaseController, render |
|
7 | ||
|
7 | from pylons_app.lib.utils import get_repo_slug | |
|
8 | from pylons_app.model.hg_model import HgModel | |
|
8 | 9 | log = logging.getLogger(__name__) |
|
9 | 10 | |
|
10 | 11 | class FilesController(BaseController): |
|
12 | def __before__(self): | |
|
13 | c.repos_prefix = config['repos_name'] | |
|
14 | c.staticurl = g.statics | |
|
15 | c.repo_name = get_repo_slug(request) | |
|
11 | 16 | |
|
12 | def index(self): | |
|
13 | # Return a rendered template | |
|
14 | #return render('/files.mako') | |
|
15 | # or, return a string | |
|
16 | return 'Hello World' | |
|
17 | def index(self, repo_name, revision, f_path): | |
|
18 | hg_model = HgModel() | |
|
19 | c.repo = repo = hg_model.get_repo(c.repo_name) | |
|
20 | c.cur_rev = revision | |
|
21 | c.f_path = f_path | |
|
22 | c.changeset = repo.get_changeset(repo._get_revision('tip')) | |
|
23 | ||
|
24 | ||
|
25 | c.files_list = c.changeset.get_node(f_path) | |
|
26 | ||
|
27 | return render('/files.html') |
General Comments 0
You need to be logged in to leave comments.
Login now