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 |
@@ -37,7 +37,7 b' def make_map(config):' | |||||
37 | map.connect('branches_home', '/{repo_name}/branches', controller='branches') |
|
37 | map.connect('branches_home', '/{repo_name}/branches', controller='branches') | |
38 | map.connect('tags_home', '/{repo_name}/tags', controller='tags') |
|
38 | map.connect('tags_home', '/{repo_name}/tags', controller='tags') | |
39 | map.connect('graph_home', '/{repo_name}/graph/{revision}', controller='graph', revision='tip') |
|
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 | return map |
|
43 | return map |
@@ -1,16 +1,27 b'' | |||||
1 | import logging |
|
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 | 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 |
|
7 | from pylons_app.lib.utils import get_repo_slug | ||
|
8 | from pylons_app.model.hg_model import HgModel | |||
8 | log = logging.getLogger(__name__) |
|
9 | log = logging.getLogger(__name__) | |
9 |
|
10 | |||
10 | class FilesController(BaseController): |
|
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): |
|
17 | def index(self, repo_name, revision, f_path): | |
13 | # Return a rendered template |
|
18 | hg_model = HgModel() | |
14 | #return render('/files.mako') |
|
19 | c.repo = repo = hg_model.get_repo(c.repo_name) | |
15 | # or, return a string |
|
20 | c.cur_rev = revision | |
16 | return 'Hello World' |
|
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