You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2012/10/19 00:32:14 UTC

[7/10] git commit: [#3883] Remove hardcoded SCM tools' names, minor fixes and cleanups.

[#3883] Remove hardcoded SCM tools' names, minor fixes and cleanups.

Signed-off-by: Peter Hartmann <ma...@gmail.com>

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

Branch: refs/heads/cj/5145
Commit: a93efacc2df9fbb935972fbd67cbe36618f7bde1
Parents: 48df4c5
Author: Peter Hartmann <ma...@gmail.com>
Authored: Wed Sep 12 18:36:53 2012 +0200
Committer: Cory Johns <jo...@geek.net>
Committed: Thu Oct 18 19:29:54 2012 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/auth.py                  |    2 +-
 Allura/allura/ext/admin/admin_main.py              |    5 ++++-
 .../allura/ext/admin/templates/project_admin.html  |   13 +++++--------
 Allura/allura/lib/plugin.py                        |    2 +-
 .../widgets/neighborhood_add_project.html          |    2 +-
 5 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a93efacc/Allura/allura/controllers/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/auth.py b/Allura/allura/controllers/auth.py
index 0f0815f..c43b571 100644
--- a/Allura/allura/controllers/auth.py
+++ b/Allura/allura/controllers/auth.py
@@ -222,7 +222,7 @@ class AuthController(BaseController):
         for p in user.my_projects():
             for p in [p] + p.direct_subprojects.all():
                 for app in p.app_configs:
-                    if not isinstance(app, RepositoryApp):
+                    if not issubclass(g.entry_points["tool"][app.tool_name], RepositoryApp):
                         continue
                     if not has_access(app, 'write', user, p):
                         continue

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a93efacc/Allura/allura/ext/admin/admin_main.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/admin_main.py b/Allura/allura/ext/admin/admin_main.py
index 51ce063..807f20d 100644
--- a/Allura/allura/ext/admin/admin_main.py
+++ b/Allura/allura/ext/admin/admin_main.py
@@ -14,6 +14,7 @@ from allura.app import Application, DefaultAdminController, SitemapEntry
 from allura.lib import helpers as h
 from allura import version
 from allura import model as M
+from allura.lib.repository import RepositoryApp
 from allura.lib.security import has_access, require_access
 from allura.lib.widgets import form_fields as ffw
 from allura.lib import exceptions as forge_exc
@@ -139,7 +140,9 @@ class ProjectAdminController(BaseController):
     @with_trailing_slash
     @expose('jinja:allura.ext.admin:templates/project_admin.html')
     def index(self, **kw):
-        return dict()
+        scm_tools = [tool for tool in c.project.app_configs if issubclass(
+                g.entry_points["tool"][tool.tool_name], RepositoryApp)]
+        return dict(scm_tools=scm_tools)
 
     @without_trailing_slash
     @expose('jinja:allura.ext.admin:templates/project_invitations.html')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a93efacc/Allura/allura/ext/admin/templates/project_admin.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/templates/project_admin.html b/Allura/allura/ext/admin/templates/project_admin.html
index 9b6473d..519fac2 100644
--- a/Allura/allura/ext/admin/templates/project_admin.html
+++ b/Allura/allura/ext/admin/templates/project_admin.html
@@ -1,6 +1,5 @@
 {% extends g.theme.master %}
 {% set wiki_found = False %}
-{% set code_found = False %}
 {% set tracker_found = False %}
 {% set forum_found = False %}
 
@@ -49,13 +48,11 @@
     <p>Source Control Management will help you keep track of code changes over time. A repository has already been created, checkout, add files and upload code.</p>
   </div>
   <div class="grid-4">
-    {% for tool in c.project.app_configs %}
-      {% if ('code' in tool.options.mount_point) and not code_found %}
-        <a href="{{c.project.url()}}{{tool.options.mount_point}}/fork">Checkout repo</a><br>
-        <a href="{{c.project.url()}}{{tool.options.mount_point}}/">View source</a>
-        {% set code_found = True %}
-      {% endif %}
-    {% endfor %}
+    {% if scm_tools %}
+      {% set tool = scm_tools[0] %}
+      <a href="{{c.project.url()}}{{tool.options.mount_point}}/fork">Checkout repo</a><br>
+      <a href="{{c.project.url()}}{{tool.options.mount_point}}/">View source</a>
+    {% endif %}
   </div>
   <div style="clear:both"></div>
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a93efacc/Allura/allura/lib/plugin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index e75365d..13356b1 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -315,7 +315,7 @@ class ProjectRegistrationProvider(object):
             name="tools", options=[
                 forms.ew.Option(label=tool.tool_label, html_value=tool.tool_label) \
                 for tool in g.entry_points["tool"].itervalues() if tool.installable
-            ]
+            ], selected=True
         )
 
     @classmethod

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a93efacc/Allura/allura/templates/widgets/neighborhood_add_project.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/neighborhood_add_project.html b/Allura/allura/templates/widgets/neighborhood_add_project.html
index 07ea5c1..ad3fbd8 100644
--- a/Allura/allura/templates/widgets/neighborhood_add_project.html
+++ b/Allura/allura/templates/widgets/neighborhood_add_project.html
@@ -33,7 +33,7 @@
         {% if tool.installable %}
             <div class="tool">
                 <img src="{{ g.theme.app_icon_url(tool, 48) }}" alt="{{ tool.tool_label}} icon">
-                <input type="checkbox" value="{{ tool.tool_label }}"
+                <input checked type="checkbox" value="{{ tool.tool_label }}"
                        name="{{ widget.context_for(widget.fields.tools)['rendered_name'] }}"
                        id="{{ widget.context_for(widget.fields.tools)['rendered_name'] }}_{{ tool.tool_label }}">
                 <h1><label for="{{ widget.context_for(widget.fields.tools)['rendered_name'] }}_{{ tool.tool_label }}">{{ tool.tool_label }}</label></h1>