diff --git a/pylons_app/controllers/files.py b/pylons_app/controllers/files.py
--- a/pylons_app/controllers/files.py
+++ b/pylons_app/controllers/files.py
@@ -22,4 +22,18 @@ class FilesController(BaseController):
c.files_list = c.changeset.get_node(f_path)
- return render('/files.html')
+ c.file_history = self._get_history(repo, c.files_list, f_path)
+ return render('files/files.html')
+
+
+ def _get_history(self, repo, node, f_path):
+ from vcs.nodes import NodeKind
+ if not node.kind is NodeKind.FILE:
+ return []
+ changesets = list(node.history)
+ changesets.reverse()
+ hist_l = []
+ for chs in changesets:
+ n_desc = 'r%s:%s' % (chs.revision, chs._short)
+ hist_l.append((chs._short, n_desc,))
+ return hist_l
diff --git a/pylons_app/templates/files.html b/pylons_app/templates/files/files.html
rename from pylons_app/templates/files.html
rename to pylons_app/templates/files/files.html
--- a/pylons_app/templates/files.html
+++ b/pylons_app/templates/files/files.html
@@ -1,4 +1,4 @@
-<%inherit file="base/base.html"/>
+<%inherit file="/base/base.html"/>
<%def name="title()">
${_('Repository managment')}
@@ -28,93 +28,11 @@
${_('Files')}
-
${_('File')}: ${h.files_breadcrumbs(c.repo_name,c.cur_rev,c.files_list.path)}
- %if c.files_list.is_dir():
-
-
-
- ${_('Name')} |
- ${_('Size')} |
- ${_('Revision')} |
- ${_('Last modified')} |
- ${_('Last commiter')} |
-
-
-
- % if c.files_list.parent:
-
- ${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")}
- |
- |
- |
- |
- |
- %endif
-
- <%def name="file_class(node)">
- %if node.is_file():
- <%return "browser-file" %>
- %else:
- <%return "browser-dir"%>
- %endif
- %def>
-
-
- %for cnt,node in enumerate(c.files_list):
-
-
-
- ${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))}
- |
-
- %if node.is_file():
- ${h.filesizeformat(node.size)}
- %endif
- |
-
- %if node.is_file():
- ${node.last_changeset.revision}
- %endif
- |
-
- %if node.is_file():
- ${node.last_changeset.date}
- %endif
- |
-
- %if node.is_file():
- ${node.last_changeset.author}
- %endif
-
- |
-
- %endfor
-
+
${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.cur_rev,c.files_list.path)}
+ %if c.files_list.is_dir():
+ <%include file='files_browser.html'/>
%else:
-
-
- ${h.pygmentize(c.files_list.content,linenos=True,anchorlinenos=True,cssclass="code-highlight")}
-
+ <%include file='files_source.html'/>
%endif
%def>
\ No newline at end of file
diff --git a/pylons_app/templates/files/files_browser.html b/pylons_app/templates/files/files_browser.html
new file mode 100644
--- /dev/null
+++ b/pylons_app/templates/files/files_browser.html
@@ -0,0 +1,57 @@
+<%def name="file_class(node)">
+ %if node.is_file():
+ <%return "browser-file" %>
+ %else:
+ <%return "browser-dir"%>
+ %endif
+%def>
+
+
+
+
+ ${_('Name')} |
+ ${_('Size')} |
+ ${_('Revision')} |
+ ${_('Last modified')} |
+ ${_('Last commiter')} |
+
+
+
+ % if c.files_list.parent:
+
+ ${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")}
+ |
+ |
+ |
+ |
+ |
+ %endif
+
+ %for cnt,node in enumerate(c.files_list):
+
+
+ ${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))}
+ |
+
+ %if node.is_file():
+ ${h.filesizeformat(node.size)}
+ %endif
+ |
+
+ %if node.is_file():
+ ${node.last_changeset.revision}
+ %endif
+ |
+
+ %if node.is_file():
+ ${node.last_changeset.date}
+ %endif
+ |
+
+ %if node.is_file():
+ ${node.last_changeset.author}
+ %endif
+ |
+
+ %endfor
+
\ No newline at end of file
diff --git a/pylons_app/templates/files/files_source.html b/pylons_app/templates/files/files_source.html
new file mode 100644
--- /dev/null
+++ b/pylons_app/templates/files/files_source.html
@@ -0,0 +1,20 @@
+
+ - ${_('Revision')}
+ - r${c.files_list.changeset.revision}:${c.files_list.changeset._short}
+ - ${_('Size')}
+ - ${h.filesizeformat(c.files_list.size)}
+ - ${_('Options')}
+ - history / annotate / raw
+ - ${_('History')}
+ -
+ ${h.form(h.url.current())}
+ ${h.hidden('diff2',c.files_list.changeset._short)}
+ ${h.select('diff1','',c.file_history)}
+ ${h.submit('diff','diff')}
+ ${h.end_form()}
+
+
+
+
+ ${h.pygmentize(c.files_list.content,linenos=True,anchorlinenos=True,cssclass="code-highlight")}
+
\ No newline at end of file