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/24 18:57:17 UTC
[11/17] git commit: [#3883] New project form refactored to
dynamically discover available Tools, minor cleanups.
[#3883] New project form refactored to dynamically discover available
Tools, minor 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/ff677454
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/ff677454
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/ff677454
Branch: refs/heads/cj/5145
Commit: ff67745467b644a9f29e4d534219e92cc5745974
Parents: 2bfb836
Author: Peter Hartmann <ma...@gmail.com>
Authored: Wed Sep 12 00:58:37 2012 +0200
Committer: Cory Johns <jo...@geek.net>
Committed: Wed Oct 24 16:56:28 2012 +0000
----------------------------------------------------------------------
Allura/allura/app.py | 3 +
Allura/allura/controllers/auth.py | 3 +-
Allura/allura/lib/plugin.py | 9 ++-
Allura/allura/lib/widgets/forms.py | 10 +--
.../lib/widgets/resources/css/add_project.css | 11 +--
.../widgets/neighborhood_add_project.html | 86 ++-------------
ForgeBlog/forgeblog/main.py | 4 +
ForgeDiscussion/forgediscussion/forum_main.py | 3 +
ForgeGit/forgegit/git_main.py | 5 +
ForgeHg/forgehg/hg_main.py | 5 +
ForgeSVN/forgesvn/svn_main.py | 3 +
ForgeTracker/forgetracker/tracker_main.py | 4 +
ForgeWiki/forgewiki/wiki_main.py | 10 ++-
run_tests | 2 +-
14 files changed, 62 insertions(+), 96 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ff677454/Allura/allura/app.py
----------------------------------------------------------------------
diff --git a/Allura/allura/app.py b/Allura/allura/app.py
index 62b115c..c3154eb 100644
--- a/Allura/allura/app.py
+++ b/Allura/allura/app.py
@@ -108,9 +108,11 @@ class Application(object):
:var sitemap: a list of :class:`SitemapEntries <allura.app.SitemapEntry>` to create an app navigation.
:var bool installable: toggle if the app can be installed in a project
:var bool hidden: toggle if the app should be hidden from the list of tools
+ :var tool_description: tool's description that will be displayed to forge users
:var Controller self.root: the root Controller used for the app
:var Controller self.api_root: a Controller used for API access at /rest/<neighborhood>/<project>/<app>/
:var Controller self.admin: a Controller used in the admin interface
+ :var icons: a dictionary mapping icon sizes to application-specific icons paths
"""
__version__ = None
@@ -131,6 +133,7 @@ class Application(object):
PostClass = model.Post
AttachmentClass = model.DiscussionAttachment
tool_label='Tool'
+ tool_description="This is a tool for Allura forge."
default_mount_label='Tool Name'
default_mount_point='tool'
ordinal=0
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ff677454/Allura/allura/controllers/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/auth.py b/Allura/allura/controllers/auth.py
index a65f31c..0f0815f 100644
--- a/Allura/allura/controllers/auth.py
+++ b/Allura/allura/controllers/auth.py
@@ -15,6 +15,7 @@ from allura.lib.security import require_authenticated, has_access
from allura.lib import helpers as h
from allura.lib import plugin
from allura.lib.decorators import require_post
+from allura.lib.repository import RepositoryApp
from allura.lib.widgets import SubscriptionForm, OAuthApplicationForm, OAuthRevocationForm, LoginForm
from allura.lib.widgets import forms
from allura.lib import exceptions as exc
@@ -221,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 app.tool_name.lower() in ('git', 'hg', 'svn'):
+ if not isinstance(app, RepositoryApp):
continue
if not has_access(app, 'write', user, p):
continue
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ff677454/Allura/allura/lib/plugin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index 3c7f73c..e75365d 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -308,8 +308,15 @@ class ProjectRegistrationProvider(object):
'''
def __init__(self):
- from allura.lib.widgets import forms as forms
+ from allura.lib.widgets import forms
self.add_project_widget = forms.NeighborhoodAddProjectForm
+ ## Dynamically generating CheckboxSet of installable tools
+ self.add_project_widget.fields.tools = forms.ew.CheckboxSet(
+ 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
+ ]
+ )
@classmethod
def get(cls):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ff677454/Allura/allura/lib/widgets/forms.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/forms.py b/Allura/allura/lib/widgets/forms.py
index 3163218..a952807 100644
--- a/Allura/allura/lib/widgets/forms.py
+++ b/Allura/allura/lib/widgets/forms.py
@@ -268,15 +268,9 @@ class NeighborhoodAddProjectForm(ForgeForm):
r'^[A-z][-A-z0-9]{2,}$',
messages={'invalid':'Please use only letters, numbers, and dashes 3-15 characters long.'}),
NeighborhoodProjectTakenValidator()))
-
tools = ew.CheckboxSet(name='tools', options=[
- ew.Option(label='Wiki', html_value='Wiki', selected=True),
- ew.Option(label='Git', html_value='Git', selected=True),
- ew.Option(label='Hg', html_value='Hg'),
- ew.Option(label='SVN', html_value='SVN'),
- ew.Option(label='Tickets', html_value='Tickets', selected=True),
- ew.Option(label='Discussion', html_value='Discussion', selected=True),
- ew.Option(label='Blog', html_value='Blog')
+ ## Required for Neighborhood functional tests to pass
+ ew.Option(label='Wiki', html_value='Wiki', selected=True)
])
def resources(self):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ff677454/Allura/allura/lib/widgets/resources/css/add_project.css
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/css/add_project.css b/Allura/allura/lib/widgets/resources/css/add_project.css
index 205686a..470a6e7 100644
--- a/Allura/allura/lib/widgets/resources/css/add_project.css
+++ b/Allura/allura/lib/widgets/resources/css/add_project.css
@@ -87,11 +87,6 @@ div.welcome div.grid-3{
background-image: -moz-linear-gradient(100% 100% 90deg, rgb(0,0,0), rgb(90,90,90) 100%);
border: 1px solid black;
}
-div.inner-row {
- display: block;
- position: relative;
- margin: 0 0 10px 0;
-}
div.button-row {
margin: 40px 0 100px 10px;
}
@@ -107,16 +102,14 @@ div.tool {
border-radius: 4px;
border: 1px solid #aaa;
width: 360px;
- margin-left: 10px;
+ margin: 5px;
background-color: whiteSmoke;
height: 74px;
}
-div.tool .big_icon {
- height: 50px;
+div.tool img {
left: 10px;
position: absolute;
top: 26px;
- width: 50px;
}
div.tool .checkbox-wrapper {
display: block;
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ff677454/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 389e4ba..07ea5c1 100644
--- a/Allura/allura/templates/widgets/neighborhood_add_project.html
+++ b/Allura/allura/templates/widgets/neighborhood_add_project.html
@@ -29,82 +29,18 @@
</div>
{% if not neighborhood.project_template %}
- <div class="inner-row">
- <div class="tool">
- <div class="big_icon ui-icon-tool-git"></div>
- <input checked type="checkbox" value="Git"
+ {% for tool in g.entry_points["tool"].itervalues() %}
+ {% 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 }}"
name="{{ widget.context_for(widget.fields.tools)['rendered_name'] }}"
- id="{{ widget.context_for(widget.fields.tools)['rendered_name'] }}_Git">
- <h1><label for="{{ widget.context_for(widget.fields.tools)['rendered_name'] }}_Git">Git</label></h1>
- <p>Git is a distributed version control system designed to
- handle everything from small to very large projects with speed
- and efficiency.</p>
- </div>
- <div class="tool">
- <div class="big_icon ui-icon-tool-tickets"></div>
- <input checked type="checkbox" value="Tickets"
- name="{{ widget.context_for(widget.fields.tools)['rendered_name'] }}"
- id="{{ widget.context_for(widget.fields.tools)['rendered_name'] }}_Tickets">
- <h1><label for="{{ widget.context_for(widget.fields.tools)['rendered_name'] }}_Tickets">Tickets</label></h1>
- <p>Bugs, enhancements, tasks, etc., will help you plan and
- manage your development.</p>
- </div>
- <div style="clear:both"></div>
- </div>
- <div class="inner-row">
- <div class="tool">
- <div class="big_icon ui-icon-tool-git"></div>
- <input type="checkbox" value="Hg"
- name="{{ widget.context_for(widget.fields.tools)['rendered_name'] }}"
- id="{{ widget.context_for(widget.fields.tools)['rendered_name'] }}_Hg">
- <h1><label for="{{ widget.context_for(widget.fields.tools)['rendered_name'] }}_Hg">Mercurial</label></h1>
- <p>Mercurial is a distributed source control management tool that efficiently
- handles projects of any size and offers an easy and intuitive
- interface.</p>
- </div>
- <div class="tool">
- <div class="big_icon ui-icon-tool-wiki"></div>
- <input checked type="checkbox" value="Wiki"
- name="{{ widget.context_for(widget.fields.tools)['rendered_name'] }}"
- id="{{ widget.context_for(widget.fields.tools)['rendered_name'] }}_Wiki">
- <h1><label for="{{ widget.context_for(widget.fields.tools)['rendered_name'] }}_Wiki">Wiki</label></h1>
- <p>Documentation is key to your project and the wiki tool
- helps make it easy for anyone to contribute.</p>
- </div>
- <div style="clear:both"></div>
- </div>
- <div class="inner-row">
- <div class="tool">
- <div class="big_icon ui-icon-tool-git"></div>
- <input type="checkbox" value="SVN"
- name="{{ widget.context_for(widget.fields.tools)['rendered_name'] }}"
- id="{{ widget.context_for(widget.fields.tools)['rendered_name'] }}_SVN">
- <h1><label for="{{ widget.context_for(widget.fields.tools)['rendered_name'] }}_SVN">SVN</label></h1>
- <p>Enterprise-class centralized version control for the masses.</p>
- </div>
- <div class="tool">
- <div class="big_icon ui-icon-tool-discussion"></div>
- <input checked type="checkbox" value="Discussion"
- name="{{ widget.context_for(widget.fields.tools)['rendered_name'] }}"
- id="{{ widget.context_for(widget.fields.tools)['rendered_name'] }}_Discussion">
- <h1><label for="{{ widget.context_for(widget.fields.tools)['rendered_name'] }}_Discussion">Forums</label></h1>
- <p>Collaborate with your community in your forum.</p>
- </div>
- <div style="clear:both"></div>
- </div>
- <div class="inner-row">
- <div class="tool" style="visibility: hidden"></div>
- <div class="tool">
- <div class="big_icon ui-icon-tool-blog"></div>
- <input type="checkbox" value="Blog"
- name="{{ widget.context_for(widget.fields.tools)['rendered_name'] }}"
- id="{{ widget.context_for(widget.fields.tools)['rendered_name'] }}_Blog">
- <h1><label for="{{ widget.context_for(widget.fields.tools)['rendered_name'] }}_Blog">Blog</label></h1>
- <p>Share exciting news and progress updates with your
- community.</p>
- </div>
- <div style="clear:both"></div>
- </div>
+ 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>
+ <p>{{ tool.tool_description }}</p>
+ </div>
+ {% endif %}
+ {% endfor %}
{% endif %}
{% if h.has_access(neighborhood, 'admin') and not neighborhood.project_template and neighborhood.features['private_projects'] %}
<div style="margin-top:20px">
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ff677454/ForgeBlog/forgeblog/main.py
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/main.py b/ForgeBlog/forgeblog/main.py
index 0c9b246..f961c03 100644
--- a/ForgeBlog/forgeblog/main.py
+++ b/ForgeBlog/forgeblog/main.py
@@ -52,6 +52,10 @@ class W:
class ForgeBlogApp(Application):
__version__ = version.__version__
tool_label='Blog'
+ tool_description="""
+ Share exciting news and progress updates with your
+ community.
+ """
default_mount_label='Blog'
default_mount_point='blog'
permissions = ['configure', 'read', 'write',
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ff677454/ForgeDiscussion/forgediscussion/forum_main.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/forum_main.py b/ForgeDiscussion/forgediscussion/forum_main.py
index dda7546..6cafe1e 100644
--- a/ForgeDiscussion/forgediscussion/forum_main.py
+++ b/ForgeDiscussion/forgediscussion/forum_main.py
@@ -45,6 +45,9 @@ class ForgeDiscussionApp(Application):
AttachmentClass=DM.ForumAttachment
searchable=True
tool_label='Discussion'
+ tool_description="""
+ Collaborate with your community in your forum.
+ """
default_mount_label='Discussion'
default_mount_point='discussion'
ordinal=7
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ff677454/ForgeGit/forgegit/git_main.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/git_main.py b/ForgeGit/forgegit/git_main.py
index d7e9bac..f3992f2 100644
--- a/ForgeGit/forgegit/git_main.py
+++ b/ForgeGit/forgegit/git_main.py
@@ -26,6 +26,11 @@ class ForgeGitApp(RepositoryApp):
'''This is the Git app for PyForge'''
__version__ = version.__version__
tool_label='Git'
+ tool_description="""
+ Git is a distributed version control system designed to
+ handle everything from small to very large projects with speed
+ and efficiency.
+ """
ordinal=2
forkable=True
default_branch_name='ref/master'
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ff677454/ForgeHg/forgehg/hg_main.py
----------------------------------------------------------------------
diff --git a/ForgeHg/forgehg/hg_main.py b/ForgeHg/forgehg/hg_main.py
index 55566f1..a98b720 100644
--- a/ForgeHg/forgehg/hg_main.py
+++ b/ForgeHg/forgehg/hg_main.py
@@ -26,6 +26,11 @@ class ForgeHgApp(RepositoryApp):
'''This is the Git app for PyForge'''
__version__ = version.__version__
tool_label='Mercurial'
+ tool_description="""
+ Mercurial is a distributed source control management tool that efficiently
+ handles projects of any size and offers an easy and intuitive
+ interface.
+ """
ordinal=3
forkable=True
default_branch_name='ref/default'
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ff677454/ForgeSVN/forgesvn/svn_main.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/svn_main.py b/ForgeSVN/forgesvn/svn_main.py
index bd6aa9f..d51ee33 100644
--- a/ForgeSVN/forgesvn/svn_main.py
+++ b/ForgeSVN/forgesvn/svn_main.py
@@ -34,6 +34,9 @@ class ForgeSVNApp(RepositoryApp):
ConfigOption('checkout_url', str, 'trunk')
]
tool_label='SVN'
+ tool_description="""
+ Enterprise-class centralized version control for the masses.
+ """
ordinal=4
forkable=False
default_branch_name=''
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ff677454/ForgeTracker/forgetracker/tracker_main.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tracker_main.py b/ForgeTracker/forgetracker/tracker_main.py
index b42b3ae..6f5fa06 100644
--- a/ForgeTracker/forgetracker/tracker_main.py
+++ b/ForgeTracker/forgetracker/tracker_main.py
@@ -140,6 +140,10 @@ class ForgeTrackerApp(Application):
]
searchable=True
tool_label='Tickets'
+ tool_description="""
+ Bugs, enhancements, tasks, etc., will help you plan and
+ manage your development.
+ """
default_mount_label='Tickets'
default_mount_point='tickets'
ordinal=6
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ff677454/ForgeWiki/forgewiki/wiki_main.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/wiki_main.py b/ForgeWiki/forgewiki/wiki_main.py
index 3528dd8..225be37 100644
--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -49,7 +49,11 @@ class W:
page_list = ffw.PageList()
page_size = ffw.PageSize()
search_results = SearchResults()
-
+ icons={
+ 24:'images/wiki_24.png',
+ 32:'images/wiki_32.png',
+ 48:'images/wiki_48.png'
+ }
class ForgeWikiApp(Application):
'''This is the Wiki app for PyForge'''
@@ -58,6 +62,10 @@ class ForgeWikiApp(Application):
'unmoderated_post', 'post', 'moderate', 'admin']
searchable=True
tool_label='Wiki'
+ tool_description="""
+ Documentation is key to your project and the wiki tool
+ helps make it easy for anyone to contribute.
+ """
default_mount_label='Wiki'
default_mount_point='wiki'
ordinal=5
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ff677454/run_tests
----------------------------------------------------------------------
diff --git a/run_tests b/run_tests
index a37f012..18d806e 100755
--- a/run_tests
+++ b/run_tests
@@ -32,6 +32,6 @@ for module in $TEST_MODULES; do
echo "Running tests in module $module"
cd $module
cover_package=$(echo $module | tr "[:upper:]" "[:lower:]")
- nosetests --cover-package=$cover_package --cover-html-dir=report.coverage --cover-erase $* || exit
+ nosetests --ignore-files="^test_.+_root" --cover-package=$cover_package --cover-html-dir=report.coverage --cover-erase $* || exit
) || exit
done