incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wwitz...@apache.org
Subject git commit: Remove fork listing from changehistory page
Date Mon, 18 Mar 2013 21:40:58 GMT
Updated Branches:
  refs/heads/ww/forks [created] b443eee01


Remove fork listing from changehistory page


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/b443eee0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/b443eee0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/b443eee0

Branch: refs/heads/ww/forks
Commit: b443eee01b38763e9c1016f73ebd424a4d7a4687
Parents: d882b0b
Author: Wayne Witzel III <wwitzel@geek.net>
Authored: Mon Mar 18 21:40:03 2013 +0000
Committer: Wayne Witzel III <wwitzel@geek.net>
Committed: Mon Mar 18 21:40:03 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/repository.py |   16 ++++++++++++++++
 Allura/allura/lib/repository.py         |   12 ++++--------
 Allura/allura/templates/repo/forks.html |   22 ++++++++++++++++++++++
 3 files changed, 42 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b443eee0/Allura/allura/controllers/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index 4b17ea3..c9d531c 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -34,6 +34,7 @@ from allura.lib.widgets import form_fields as ffw
 from allura.controllers.base import DispatchIndex
 from allura.lib.diff import HtmlSideBySideDiff
 from paste.deploy.converters import asbool
+from allura.app import SitemapEntry
 from .base import BaseController
 
 log = logging.getLogger(__name__)
@@ -58,6 +59,21 @@ class RepoRootController(BaseController):
         redirect(url(quote('%s%s/' % (
                         branch, c.app.END_OF_REF_ESCAPE))))
 
+    @with_trailing_slash
+    @expose('jinja:allura:templates/repo/forks.html')
+    def forks(self):
+        links = []
+        if c.app.repo.forks:
+            for f in c.app.repo.forks:
+                repo_path_parts = f.url().strip('/').split('/')
+                links.append(dict(
+                    repo_url=f.url(),
+                    repo = repo_path_parts[-1],
+                    user=repo_path_parts[1],
+                    user_url=f.user,
+                ))
+        return dict(links=links)
+
     @expose()
     def refresh(self):
         allura.tasks.repo_tasks.refresh.post()

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b443eee0/Allura/allura/lib/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/repository.py b/Allura/allura/lib/repository.py
index 383ef30..7fbb0bb 100644
--- a/Allura/allura/lib/repository.py
+++ b/Allura/allura/lib/repository.py
@@ -96,6 +96,10 @@ class RepositoryApp(Application):
                 SitemapEntry(
                     'Merge Requests', c.app.url + 'merge-requests/',
                     small=merge_request_count) ]
+        if self.repo.forks:
+            links += [
+                SitemapEntry('Forks', c.app.url + 'forks/', small=len(self.repo.forks))
+            ]
         if self.repo.upstream_repo.name:
             repo_path_parts = self.repo.upstream_repo.name.strip('/').split('/')
             links += [
@@ -135,14 +139,6 @@ class RepositoryApp(Application):
                             default_branch_url+'tags/',
                             ))
                     break
-        if self.repo.forks:
-            links.append(SitemapEntry('Forks'))
-            for f in self.repo.forks:
-                repo_path_parts = f.url().strip('/').split('/')
-                links.append(SitemapEntry(
-                    '%s / %s' %
-                    (repo_path_parts[1], repo_path_parts[-1]),
-                    f.url()))
         return links
 
     def install(self, project):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b443eee0/Allura/allura/templates/repo/forks.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/forks.html b/Allura/allura/templates/repo/forks.html
new file mode 100644
index 0000000..b6a8247
--- /dev/null
+++ b/Allura/allura/templates/repo/forks.html
@@ -0,0 +1,22 @@
+{% extends 'allura:templates/repo/repo_master.html' %}
+
+{% block title %}{{c.project.name}} / {{c.app.config.options.mount_label}} / Forks{% endblock
%}
+
+{% block header %}Forks{% endblock %}
+
+{% block content %}
+<table>
+<thead>
+    <th>User</th>
+    <th>Repo</th>
+</thead>
+<tbody>
+{% for link in links %}
+<tr>
+    <td><a href="{{link.user_url}}">{{link.user}}</a></td>
+    <td><a href="{{link.repo_url}}">{{link.repo}}</a></td>
+</tr>
+{% endfor %}
+</tbody>
+</table>
+{% endblock %}


Mime
View raw message