You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2015/05/28 22:13:28 UTC

[26/26] allura git commit: [#7868] ticket:777 Preserve tool selection after validation errors on project registration

[#7868] ticket:777 Preserve tool selection after validation errors on project registration


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

Branch: refs/heads/master
Commit: 07f4f0ae5dcc8de34d01286ba81745886c17b759
Parents: 9b6c507
Author: Igor Bondarenko <je...@gmail.com>
Authored: Wed May 27 10:21:34 2015 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Thu May 28 20:11:47 2015 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/project.py                      |  3 +--
 Allura/allura/lib/widgets/forms.py                        |  2 ++
 .../templates/widgets/neighborhood_add_project.html       | 10 ++++++----
 3 files changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/07f4f0ae/Allura/allura/controllers/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/project.py b/Allura/allura/controllers/project.py
index d5f390a..197f859 100644
--- a/Allura/allura/controllers/project.py
+++ b/Allura/allura/controllers/project.py
@@ -188,8 +188,7 @@ class NeighborhoodController(object):
         verify = c.form_errors == {'_the_form': u'phone-verification'}
         c.show_phone_verification_overlay = verify
         c.add_project = W.add_project
-        form_data.setdefault(
-            'tools', [u'Wiki', u'Git', u'Tickets', u'Discussion'])
+        form_data.setdefault('tools', W.add_project.default_tools)
         form_data['neighborhood'] = self.neighborhood.name
         return dict(neighborhood=self.neighborhood, form_data=form_data)
 

http://git-wip-us.apache.org/repos/asf/allura/blob/07f4f0ae/Allura/allura/lib/widgets/forms.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/forms.py b/Allura/allura/lib/widgets/forms.py
index f62aa4a..0cf8c18 100644
--- a/Allura/allura/lib/widgets/forms.py
+++ b/Allura/allura/lib/widgets/forms.py
@@ -922,6 +922,8 @@ class NeighborhoodAddProjectForm(ForgeForm):
         method='post',
         submit_text='Start',
         neighborhood=None)
+    # tools installed by default
+    default_tools = [u'wiki', u'git', u'tickets', u'discussion']
 
     @property
     def fields(self):

http://git-wip-us.apache.org/repos/asf/allura/blob/07f4f0ae/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 ca21381..a84f9b5 100644
--- a/Allura/allura/templates/widgets/neighborhood_add_project.html
+++ b/Allura/allura/templates/widgets/neighborhood_add_project.html
@@ -50,13 +50,15 @@
     {% if not neighborhood.project_template %}
     {% for opt in widget.fields.tools.options %}
         {% set tool = g.entry_points["tool"][opt.html_value] %}
+        {% set _ctx = widget.context_for(widget.fields.tools) %}
         {% if tool.installable %}
         <div class="tool">
             <img src="{{ g.theme.app_icon_url(tool, 48) }}" alt="{{ opt.label }} icon">
-            <input checked type="checkbox" value="{{ opt.html_value }}"
-                   name="{{ widget.context_for(widget.fields.tools)['rendered_name'] }}"
-                   id="{{ widget.context_for(widget.fields.tools)['rendered_name'] }}_{{ opt.html_value }}">
-            <h1><label for="{{ widget.context_for(widget.fields.tools)['rendered_name'] }}_{{ opt.html_value }}">{{ opt.label }}</label></h1>
+            <input type="checkbox" value="{{ opt.html_value }}"
+                   {% if _ctx['value'] and opt.html_value in _ctx['value'] %}checked{% endif %}
+                   name="{{ _ctx['rendered_name'] }}"
+                   id="{{ _ctx['rendered_name'] }}_{{ opt.html_value }}">
+            <h1><label for="{{ _ctx['rendered_name'] }}_{{ opt.html_value }}">{{ opt.label }}</label></h1>
             <p>{{ tool.tool_description }}</p>
         </div>
         {% endif %}