Mercurial > kallithea
changeset 4612:48d9f65d3b77
files_browser: add file_url def for use with both submodule and regular files
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Fri, 31 Oct 2014 14:09:24 -0700 |
parents | 36de86c1087f |
children | 11f01d4cdacd |
files | kallithea/templates/files/files_browser.html |
diffstat | 1 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/templates/files/files_browser.html Fri Oct 31 14:03:49 2014 -0700 +++ b/kallithea/templates/files/files_browser.html Fri Oct 31 14:09:24 2014 -0700 @@ -7,6 +7,13 @@ <%return "browser-dir"%> %endif </%def> +<%def name="file_url(node, c)"> + %if node.is_submodule(): + <%return node.url or '#'%> + %else: + <%return h.url('files_home', repo_name=c.repo_name, revision=c.changeset.raw_id, f_path=h.safe_unicode(node.path))%> + %endif +</%def> <div id="body" class="browserblock"> <div class="browser-header"> <div class="browser-nav"> @@ -67,9 +74,9 @@ <tr class="parity${cnt%2}"> <td> %if node.is_submodule(): - ${h.link_to(node.name,node.url or '#',class_=file_class(node)+" ypjax-link")} + ${h.link_to(node.name,file_url(node,c),class_=file_class(node)+" ypjax-link")} %else: - ${h.link_to(node.name, h.url('files_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=h.safe_unicode(node.path)),class_=file_class(node)+" ypjax-link")} + ${h.link_to(node.name,file_url(node,c),class_=file_class(node)+" ypjax-link")} %endif: </td> <td>