Show More
@@ -0,0 +1,57 b'' | |||||
|
1 | <%def name="file_class(node)"> | |||
|
2 | %if node.is_file(): | |||
|
3 | <%return "browser-file" %> | |||
|
4 | %else: | |||
|
5 | <%return "browser-dir"%> | |||
|
6 | %endif | |||
|
7 | </%def> | |||
|
8 | ||||
|
9 | <table class="code-browser"> | |||
|
10 | <thead> | |||
|
11 | <tr> | |||
|
12 | <th class="width-50 lefted">${_('Name')}</th> | |||
|
13 | <th class="width-10 righted">${_('Size')}</th> | |||
|
14 | <th class="width-10 righted">${_('Revision')}</th> | |||
|
15 | <th class="width-15 righted">${_('Last modified')}</th> | |||
|
16 | <th class="width-15 righted">${_('Last commiter')}</th> | |||
|
17 | </tr> | |||
|
18 | </thead> | |||
|
19 | <tr> | |||
|
20 | % if c.files_list.parent: | |||
|
21 | <td> | |||
|
22 | ${h.link_to('..',h.url('files_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.files_list.parent),class_="browser-dir")} | |||
|
23 | </td> | |||
|
24 | <td></td> | |||
|
25 | <td></td> | |||
|
26 | <td></td> | |||
|
27 | <td></td> | |||
|
28 | %endif | |||
|
29 | </tr> | |||
|
30 | %for cnt,node in enumerate(c.files_list): | |||
|
31 | <tr class="parity${cnt%2}"> | |||
|
32 | <td> | |||
|
33 | ${h.link_to(node.name,h.url('files_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=node.path),class_=file_class(node))} | |||
|
34 | </td> | |||
|
35 | <td> | |||
|
36 | %if node.is_file(): | |||
|
37 | ${h.filesizeformat(node.size)} | |||
|
38 | %endif | |||
|
39 | </td> | |||
|
40 | <td> | |||
|
41 | %if node.is_file(): | |||
|
42 | ${node.last_changeset.revision} | |||
|
43 | %endif | |||
|
44 | </td> | |||
|
45 | <td> | |||
|
46 | %if node.is_file(): | |||
|
47 | ${node.last_changeset.date} | |||
|
48 | %endif | |||
|
49 | </td> | |||
|
50 | <td> | |||
|
51 | %if node.is_file(): | |||
|
52 | ${node.last_changeset.author} | |||
|
53 | %endif | |||
|
54 | </td> | |||
|
55 | </tr> | |||
|
56 | %endfor | |||
|
57 | </table> No newline at end of file |
@@ -0,0 +1,20 b'' | |||||
|
1 | <dl class="overview"> | |||
|
2 | <dt>${_('Revision')}</dt> | |||
|
3 | <dd>r${c.files_list.changeset.revision}:${c.files_list.changeset._short}</dd> | |||
|
4 | <dt>${_('Size')}</dt> | |||
|
5 | <dd>${h.filesizeformat(c.files_list.size)}</dd> | |||
|
6 | <dt>${_('Options')}</dt> | |||
|
7 | <dd>history / annotate / raw </dd> | |||
|
8 | <dt>${_('History')}</dt> | |||
|
9 | <dd> | |||
|
10 | ${h.form(h.url.current())} | |||
|
11 | ${h.hidden('diff2',c.files_list.changeset._short)} | |||
|
12 | ${h.select('diff1','',c.file_history)} | |||
|
13 | ${h.submit('diff','diff')} | |||
|
14 | ${h.end_form()} | |||
|
15 | </dd> | |||
|
16 | ||||
|
17 | </dl> | |||
|
18 | <div id="body" class="codeblock"> | |||
|
19 | ${h.pygmentize(c.files_list.content,linenos=True,anchorlinenos=True,cssclass="code-highlight")} | |||
|
20 | </div> No newline at end of file |
@@ -1,25 +1,39 b'' | |||||
1 | import logging |
|
1 | import logging | |
2 |
|
2 | |||
3 | from pylons import request, response, session, tmpl_context as c, url, config, app_globals as g |
|
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 | 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 FilesController(BaseController): |
|
11 | class FilesController(BaseController): | |
12 | def __before__(self): |
|
12 | def __before__(self): | |
13 | c.repos_prefix = config['repos_name'] |
|
13 | c.repos_prefix = config['repos_name'] | |
14 | c.repo_name = get_repo_slug(request) |
|
14 | c.repo_name = get_repo_slug(request) | |
15 |
|
15 | |||
16 | def index(self, repo_name, revision, f_path): |
|
16 | def index(self, repo_name, revision, f_path): | |
17 | hg_model = HgModel() |
|
17 | hg_model = HgModel() | |
18 | c.repo = repo = hg_model.get_repo(c.repo_name) |
|
18 | c.repo = repo = hg_model.get_repo(c.repo_name) | |
19 | c.cur_rev = revision |
|
19 | c.cur_rev = revision | |
20 | c.f_path = f_path |
|
20 | c.f_path = f_path | |
21 | c.changeset = repo.get_changeset(repo._get_revision(revision)) |
|
21 | c.changeset = repo.get_changeset(repo._get_revision(revision)) | |
22 |
|
22 | |||
23 | c.files_list = c.changeset.get_node(f_path) |
|
23 | c.files_list = c.changeset.get_node(f_path) | |
24 |
|
24 | |||
25 | return render('/files.html') |
|
25 | c.file_history = self._get_history(repo, c.files_list, f_path) | |
|
26 | return render('files/files.html') | |||
|
27 | ||||
|
28 | ||||
|
29 | def _get_history(self, repo, node, f_path): | |||
|
30 | from vcs.nodes import NodeKind | |||
|
31 | if not node.kind is NodeKind.FILE: | |||
|
32 | return [] | |||
|
33 | changesets = list(node.history) | |||
|
34 | changesets.reverse() | |||
|
35 | hist_l = [] | |||
|
36 | for chs in changesets: | |||
|
37 | n_desc = 'r%s:%s' % (chs.revision, chs._short) | |||
|
38 | hist_l.append((chs._short, n_desc,)) | |||
|
39 | return hist_l |
@@ -1,120 +1,38 b'' | |||||
1 | <%inherit file="base/base.html"/> |
|
1 | <%inherit file="/base/base.html"/> | |
2 |
|
2 | |||
3 | <%def name="title()"> |
|
3 | <%def name="title()"> | |
4 | ${_('Repository managment')} |
|
4 | ${_('Repository managment')} | |
5 | </%def> |
|
5 | </%def> | |
6 | <%def name="breadcrumbs()"> |
|
6 | <%def name="breadcrumbs()"> | |
7 | ${h.link_to(u'Home',h.url('/'))} |
|
7 | ${h.link_to(u'Home',h.url('/'))} | |
8 | / |
|
8 | / | |
9 | ${h.link_to(c.repo_name,h.url('files_home',repo_name=c.repo_name))} |
|
9 | ${h.link_to(c.repo_name,h.url('files_home',repo_name=c.repo_name))} | |
10 | / |
|
10 | / | |
11 | ${_('files')} |
|
11 | ${_('files')} | |
12 | </%def> |
|
12 | </%def> | |
13 | <%def name="page_nav()"> |
|
13 | <%def name="page_nav()"> | |
14 | <form action="log"> |
|
14 | <form action="log"> | |
15 | <dl class="search"> |
|
15 | <dl class="search"> | |
16 | <dt><label>Search: </label></dt> |
|
16 | <dt><label>Search: </label></dt> | |
17 | <dd><input type="text" name="rev" /></dd> |
|
17 | <dd><input type="text" name="rev" /></dd> | |
18 | </dl> |
|
18 | </dl> | |
19 | </form> |
|
19 | </form> | |
20 |
|
20 | |||
21 | ${self.menu('files')} |
|
21 | ${self.menu('files')} | |
22 | </%def> |
|
22 | </%def> | |
23 | <%def name="css()"> |
|
23 | <%def name="css()"> | |
24 | <link rel="stylesheet" href="/css/monoblue_custom.css" type="text/css" /> |
|
24 | <link rel="stylesheet" href="/css/monoblue_custom.css" type="text/css" /> | |
25 | <link rel="stylesheet" href="/css/pygments.css" type="text/css" /> |
|
25 | <link rel="stylesheet" href="/css/pygments.css" type="text/css" /> | |
26 | </%def> |
|
26 | </%def> | |
27 | <%def name="main()"> |
|
27 | <%def name="main()"> | |
28 |
|
28 | |||
29 | <h2 class="no-link no-border">${_('Files')}</h2> |
|
29 | <h2 class="no-link no-border">${_('Files')}</h2> | |
30 | <div id="files_data"> |
|
30 | <div id="files_data"> | |
31 |
<h2>${_(' |
|
31 | <h2>${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.cur_rev,c.files_list.path)}</h2> | |
32 | %if c.files_list.is_dir(): |
|
32 | %if c.files_list.is_dir(): | |
33 | <table class="code-browser"> |
|
33 | <%include file='files_browser.html'/> | |
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> |
|
|||
46 | ${h.link_to('..',h.url('files_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.files_list.parent),class_="browser-dir")} |
|
|||
47 | </td> |
|
|||
48 | <td></td> |
|
|||
49 | <td></td> |
|
|||
50 | <td></td> |
|
|||
51 | <td></td> |
|
|||
52 | %endif |
|
|||
53 | </tr> |
|
|||
54 | <%def name="file_class(node)"> |
|
|||
55 | %if node.is_file(): |
|
|||
56 | <%return "browser-file" %> |
|
|||
57 | %else: |
|
|||
58 | <%return "browser-dir"%> |
|
|||
59 | %endif |
|
|||
60 | </%def> |
|
|||
61 |
|
||||
62 |
|
||||
63 | %for cnt,node in enumerate(c.files_list): |
|
|||
64 | <tr class="parity${cnt%2}"> |
|
|||
65 |
|
||||
66 | <td> |
|
|||
67 | ${h.link_to(node.name,h.url('files_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=node.path),class_=file_class(node))} |
|
|||
68 | </td> |
|
|||
69 | <td> |
|
|||
70 | %if node.is_file(): |
|
|||
71 | ${h.filesizeformat(node.size)} |
|
|||
72 | %endif |
|
|||
73 | </td> |
|
|||
74 | <td> |
|
|||
75 | %if node.is_file(): |
|
|||
76 | ${node.last_changeset.revision} |
|
|||
77 | %endif |
|
|||
78 | </td> |
|
|||
79 | <td> |
|
|||
80 | %if node.is_file(): |
|
|||
81 | ${node.last_changeset.date} |
|
|||
82 | %endif |
|
|||
83 | </td> |
|
|||
84 | <td> |
|
|||
85 | %if node.is_file(): |
|
|||
86 | ${node.last_changeset.author} |
|
|||
87 | %endif |
|
|||
88 |
|
||||
89 | </td> |
|
|||
90 | </tr> |
|
|||
91 | %endfor |
|
|||
92 | </table> |
|
|||
93 | %else: |
|
34 | %else: | |
94 | <table class="info-table"> |
|
35 | <%include file='files_source.html'/> | |
95 | <tr> |
|
|||
96 | <td>r70:17ecc1c97401</td> |
|
|||
97 | <td>374 loc</td> |
|
|||
98 | <td>12.5 KB</td> |
|
|||
99 | <td> |
|
|||
100 | <a href="/marcinkuzminski/vcs/history/vcs/backends/hg.py">history</a> / |
|
|||
101 | <a href="/marcinkuzminski/vcs/annotate/17ecc1c97401/vcs/backends/hg.py">annotate</a> / |
|
|||
102 | <a href="/marcinkuzminski/vcs/raw/17ecc1c97401/vcs/backends/hg.py">raw</a> / |
|
|||
103 | <form class="source-view-form" method="get" action="/marcinkuzminski/vcs/diff/vcs/backends/hg.py"> |
|
|||
104 |
|
||||
105 | <input type="hidden" value="17ecc1c97401" name="diff2"> |
|
|||
106 | <select class="smaller" name="diff1"> |
|
|||
107 | <option>history</option> |
|
|||
108 | </select> |
|
|||
109 | <input type="submit" class="smaller" value="diff"> |
|
|||
110 |
|
||||
111 | </form> |
|
|||
112 | </td> |
|
|||
113 | </tr> |
|
|||
114 | </table> |
|
|||
115 | <div id="body" class="codeblock"> |
|
|||
116 | ${h.pygmentize(c.files_list.content,linenos=True,anchorlinenos=True,cssclass="code-highlight")} |
|
|||
117 | </div> |
|
|||
118 | %endif |
|
36 | %endif | |
119 | </div> |
|
37 | </div> | |
120 | </%def> No newline at end of file |
|
38 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now