You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2015/08/03 13:30:16 UTC

[1/7] allura git commit: [#7922] Add "admin" section to the left sidebar

Repository: allura
Updated Branches:
  refs/heads/ib/7922 [created] 3c0d5bfcd


[#7922] Add "admin" section to the left sidebar


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

Branch: refs/heads/ib/7922
Commit: 071ced0f55f9399a8a6bab2902689d2a1b5061d2
Parents: 7075554
Author: Igor Bondarenko <je...@gmail.com>
Authored: Wed Jul 29 19:25:49 2015 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Fri Jul 31 12:11:22 2015 +0300

----------------------------------------------------------------------
 Allura/allura/app.py                            | 22 +++++++++
 Allura/allura/ext/admin/admin_main.py           |  5 ++-
 .../ext/admin/templates/project_tools.html      | 44 ++++--------------
 Allura/allura/lib/widgets/admin_widgets.py      | 47 ++++++++++++++++++++
 .../lib/widgets/resources/js/admin_modal.js     | 34 ++++++++++++++
 .../resources/js/admin_tool_delete_modal.js     | 40 +++++++++++++++++
 Allura/allura/public/nf/js/project_tools.js     | 39 ----------------
 .../templates/jinja_master/sidebar_menu.html    | 11 +++++
 .../widgets/admin_tool_delete_modal.html        | 34 ++++++++++++++
 9 files changed, 199 insertions(+), 77 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/071ced0f/Allura/allura/app.py
----------------------------------------------------------------------
diff --git a/Allura/allura/app.py b/Allura/allura/app.py
index 62b82fe..3aa8aad 100644
--- a/Allura/allura/app.py
+++ b/Allura/allura/app.py
@@ -44,6 +44,7 @@ from allura import model
 from allura.controllers import BaseController
 from allura.lib.decorators import require_post, memoize
 from allura.lib.utils import permanent_redirect, ConfigProxy
+from allura.lib.widgets import admin_widgets
 from allura import model as M
 
 log = logging.getLogger(__name__)
@@ -291,6 +292,14 @@ class Application(object):
         self.admin = DefaultAdminController(self)
 
     @LazyProperty
+    def admin_modal(self):
+        return admin_widgets.AdminModal()
+
+    @LazyProperty
+    def admin_tool_delete_modal(self):
+        return admin_widgets.AdminToolDeleteModal()
+
+    @LazyProperty
     def sitemap(self):
         """Return a list of :class:`SitemapEntries <allura.app.SitemapEntry>`
         describing the page hierarchy provided by this Application.
@@ -616,6 +625,19 @@ class Application(object):
             links.append(SitemapEntry('Webhooks', admin_url + 'webhooks'))
         return links
 
+    @LazyProperty
+    def admin_menu_delete_button(self):
+        anchored_tools = self.project.neighborhood.get_anchored_tools()
+        anchored = self.tool_label.lower() in anchored_tools.keys()
+        if self.uninstallable and not anchored:
+            return SitemapEntry(
+                label='Delete',
+                url='#',
+                className='admin_tool_delete_modal',
+                extra_html_attrs={
+                    'data-mount-point': self.config.options.mount_point,
+                })
+
     def handle_message(self, topic, message):
         """Handle incoming email msgs addressed to this tool.
         Default is a no-op.

http://git-wip-us.apache.org/repos/asf/allura/blob/071ced0f/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 ec61edb..dcda9be 100644
--- a/Allura/allura/ext/admin/admin_main.py
+++ b/Allura/allura/ext/admin/admin_main.py
@@ -44,6 +44,7 @@ from allura.controllers import BaseController
 from allura.lib.decorators import require_post
 from allura.tasks import export_tasks
 from allura.lib.widgets.project_list import ProjectScreenshots
+from allura.lib.widgets import admin_widgets
 
 from . import widgets as aw
 
@@ -54,8 +55,8 @@ log = logging.getLogger(__name__)
 class W:
     markdown_editor = ffw.MarkdownEdit()
     label_edit = ffw.LabelEdit()
-    mount_delete = ffw.Lightbox(name='mount_delete', trigger='a.mount_delete')
-    admin_modal = ffw.Lightbox(name='admin_modal', trigger='a.admin_modal')
+    admin_modal = admin_widgets.AdminModal()
+    mount_delete = admin_widgets.AdminToolDeleteModal()
     install_modal = ffw.Lightbox(
         name='install_modal', trigger='a.install_trig')
     explain_export_modal = ffw.Lightbox(

http://git-wip-us.apache.org/repos/asf/allura/blob/071ced0f/Allura/allura/ext/admin/templates/project_tools.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/templates/project_tools.html b/Allura/allura/ext/admin/templates/project_tools.html
index 38705ed..c9eab4a 100644
--- a/Allura/allura/ext/admin/templates/project_tools.html
+++ b/Allura/allura/ext/admin/templates/project_tools.html
@@ -17,6 +17,7 @@
        under the License.
 -#}
 {% extends g.theme.master %}
+{% from 'allura:templates/jinja_master/sidebar_menu.html' import sidebar_item with context %}
 
 {% do g.register_forge_css('css/forge/deck.css') %}
 {% do g.register_forge_js('js/project_tools.js', location='body_js_tail') %}
@@ -87,24 +88,9 @@
                         <img src="{{ g.theme.app_icon_url(app, 48) }}" alt="">
                     </li>
                     {% for link in links %}
-                    <li>
-                        <a href="{{ link.url }}" class="{{ link.className }}">{{ link.label }}</a>
-                    </li>
+                      {{sidebar_item(link)}}
                     {% endfor %}
-                    {% if app.uninstallable and not (app.tool_label.lower() in app.project.neighborhood.get_anchored_tools().keys()) %}
-                    <li>
-                      <form method="post" action="update_mounts" id="mounts_edit_2-{{loop.index0}}">
-                        <input type="hidden" class="mount_point"
-                               name="tool-{{loop.index0}}.mount_point"
-                               value="{{mount['ac'].options.mount_point}}"/>
-                        <input name="tool-{{loop.index0}}.delete" type="hidden" value="Delete"/>
-                        {% if mount['ac'].load().uninstallable %}
-                          <a href="#" class="mount_delete" data-mount-point="{{ mount['ac'].options.mount_point }}">Delete</a>
-                        {% endif %}
-                        {{lib.csrf_token()}}
-                      </form>
-                    </li>
-                    {% endif %}
+                    {{sidebar_item(app.admin_menu_delete_button)}}
                 </ul>
                 {% if not app.uninstallable %}
                   <input type="hidden" class="mount_point" value="{{mount['ac'].options.mount_point}}"/>
@@ -119,14 +105,9 @@
                         <img src="{{ g.theme.app_icon_url('subproject', 48) }}" alt="">
                     </li>
                     <li>
-                      <form method="post" action="update_mounts" id="mounts_edit_2-{{loop.index0}}">
-                          <input type="hidden" class="shortname"
-                                 name="subproject-{{loop.index0}}.shortname"
-                                 value="{{mount['sub'].shortname}}"/>
-                          <input name="subproject-{{loop.index0}}.delete" type="hidden" value="Delete"/>
-                          <a href="#" class="mount_delete" data-mount-point="{{ mount['sub'].shortname }}">Delete</a>
-                          {{lib.csrf_token()}}
-                      </form>
+                      <a href="#" data-mount-point="{{ mount['sub'].shortname }}" class="admin_tool_delete_modal">
+                        <span>Delete</span>
+                      </a>
                     </li>
                 </ul>
             </div>
@@ -137,17 +118,8 @@
 <div style="clear:both">
   {{c.page_list.display(page=page, limit=limit, count=total_mounts)}}
 </div>
-<form id="mount_delete_form" style="display:none">
-  <div class="grid-13 warning_msg">Warning: This will destroy all data in this tool and is irreversible!</div>
-  <div class="grid-13">&nbsp;</div>
-  <hr>
-  <div class="grid-13">&nbsp;</div>
-  <div class="grid-13">
-    <input type="button" value="Delete" class="continue_delete"> <input type="button" value="Cancel" class="cancel_delete close">
-  </div>
-</form>
-{{c.admin_modal.display(content='<h1 id="popup_title"></h1><div id="popup_contents"></div>')}}
-{{c.mount_delete.display(content='<h1>Confirm Delete</h1>')}}
+{{c.admin_modal.display()}}
+{{c.mount_delete.display()}}
 <div><!--dummy-->
 
 <h3 style="clear:left">Grouping</h3>

http://git-wip-us.apache.org/repos/asf/allura/blob/071ced0f/Allura/allura/lib/widgets/admin_widgets.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/admin_widgets.py b/Allura/allura/lib/widgets/admin_widgets.py
new file mode 100644
index 0000000..249962e
--- /dev/null
+++ b/Allura/allura/lib/widgets/admin_widgets.py
@@ -0,0 +1,47 @@
+#       Licensed to the Apache Software Foundation (ASF) under one
+#       or more contributor license agreements.  See the NOTICE file
+#       distributed with this work for additional information
+#       regarding copyright ownership.  The ASF licenses this file
+#       to you under the Apache License, Version 2.0 (the
+#       "License"); you may not use this file except in compliance
+#       with the License.  You may obtain a copy of the License at
+#
+#         http://www.apache.org/licenses/LICENSE-2.0
+#
+#       Unless required by applicable law or agreed to in writing,
+#       software distributed under the License is distributed on an
+#       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#       KIND, either express or implied.  See the License for the
+#       specific language governing permissions and limitations
+#       under the License.
+
+import ew.jinja2_ew as ew
+
+from allura.lib.widgets import form_fields as ffw
+
+
+class AdminModal(ffw.Lightbox):
+    defaults = dict(
+        ffw.Lightbox.defaults,
+        name='admin_modal',
+        trigger='a.admin_modal',
+        content='<h1 id="admin_modal_title"></h1>'
+                '<div id="admin_modal_contents"></div>')
+
+    def resources(self):
+        for r in super(AdminModal, self).resources():
+            yield r
+        yield ew.JSLink('js/admin_modal.js')
+
+
+class AdminToolDeleteModal(ffw.Lightbox):
+    defaults = dict(
+        ffw.Lightbox.defaults,
+        name='admin_tool_delete_modal',
+        trigger='a.admin_tool_delete_modal',
+        content_template='allura:templates/widgets/admin_tool_delete_modal.html')
+
+    def resources(self):
+        for r in super(AdminToolDeleteModal, self).resources():
+            yield r
+        yield ew.JSLink('js/admin_tool_delete_modal.js')

http://git-wip-us.apache.org/repos/asf/allura/blob/071ced0f/Allura/allura/lib/widgets/resources/js/admin_modal.js
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/js/admin_modal.js b/Allura/allura/lib/widgets/resources/js/admin_modal.js
new file mode 100644
index 0000000..41a5264
--- /dev/null
+++ b/Allura/allura/lib/widgets/resources/js/admin_modal.js
@@ -0,0 +1,34 @@
+/*
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+*/
+$(function() {
+    var cval = $.cookie('_session_id');
+    var csrf_input = $('<input name="_session_id" type="hidden" value="'+cval+'">');
+    var $popup_title = $('#admin_modal_title');
+    var $popup_contents = $('#admin_modal_contents');
+    $('a.admin_modal').click(function () {
+        var link = this;
+        $popup_title.html('');
+        $popup_contents.html('Loading...');
+        $.get(link.href, function (data) {
+            $popup_title.html($(link).html());
+            $popup_contents.html(data);
+            $popup_contents.find('form').append(csrf_input);
+        });
+    });
+});

http://git-wip-us.apache.org/repos/asf/allura/blob/071ced0f/Allura/allura/lib/widgets/resources/js/admin_tool_delete_modal.js
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/js/admin_tool_delete_modal.js b/Allura/allura/lib/widgets/resources/js/admin_tool_delete_modal.js
new file mode 100644
index 0000000..3d41261
--- /dev/null
+++ b/Allura/allura/lib/widgets/resources/js/admin_tool_delete_modal.js
@@ -0,0 +1,40 @@
+/*
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+*/
+$(function() {
+  var $form = $('#admin-tool-delete-modal-form');
+  $('a.admin_tool_delete_modal').click(function() {
+    var mount_point = $(this).data('mount-point');
+    $form.find('.mount_point').val(mount_point);
+    var tool_label = 'this';
+    if (mount_point) {
+      tool_label = 'the "' + mount_point + '"';
+    }
+    var msg = 'Warning: This will destroy all data in ';
+    msg += tool_label;
+    msg += ' tool and is irreversible!';
+    $form.find('.warning-msg').text(msg);
+  });
+  $form.find('.delete-tool').click(function() {
+    if ($form.find('.mount_point').val()) {
+      $form.submit();
+    } else {
+      console.log('Do not know which tool to delete!');
+    }
+  });
+});

http://git-wip-us.apache.org/repos/asf/allura/blob/071ced0f/Allura/allura/public/nf/js/project_tools.js
----------------------------------------------------------------------
diff --git a/Allura/allura/public/nf/js/project_tools.js b/Allura/allura/public/nf/js/project_tools.js
index a690937..c235f05 100644
--- a/Allura/allura/public/nf/js/project_tools.js
+++ b/Allura/allura/public/nf/js/project_tools.js
@@ -18,9 +18,6 @@
 */
 
 (function() {
-    // Provide CSRF protection
-    var cval = $.cookie('_session_id');
-    var csrf_input = $('<input name="_session_id" type="hidden" value="'+cval+'">');
     // Install popup
     var install_popup = $('#lightbox_install_modal');
     var install_form = $('#install_form');
@@ -50,42 +47,6 @@
             new_mount_label.val('');
         }
     });
-    // Edit popup
-    var $popup_title = $('#popup_title');
-    var $popup_contents = $('#popup_contents');
-    $('a.admin_modal').click(function () {
-        var link = this;
-        $popup_title.html('');
-        $popup_contents.html('Loading...');
-        $.get(link.href, function (data) {
-            $popup_title.html($(link).html());
-            $popup_contents.html(data);
-            $popup_contents.find('form').append(csrf_input);
-        });
-    });
-    // delete popup
-    var form_to_delete = null;
-    var mount_delete_popup = $('#lightbox_mount_delete');
-    var mount_delete_form = $('#mount_delete_form');
-    mount_delete_popup.append(mount_delete_form.show());
-    mount_delete_form.find('.continue_delete').click(function () {
-        form_to_delete.submit();
-        form_to_delete = null;
-    });
-    mount_delete_form.find('.cancel_delete').click(function () {
-        form_to_delete = null;
-    });
-    $('a.mount_delete').click(function () {
-        var tool_label = 'this';
-        var mount_point = $(this).data('mount-point');
-        if (mount_point) {
-            tool_label = 'the "' + mount_point + '"';
-        }
-        $('div.warning_msg').text('Warning: This will destroy all data in ' + tool_label + ' tool and is irreversible!');
-
-        form_to_delete = this.parentNode;
-        return false;
-    });
     // sorting
     $('#sortable').sortable({items: ".fleft:not(.isnt_sorted)"}).bind( "sortupdate", function (e) {
         var sortables = $('#sortable .fleft');

http://git-wip-us.apache.org/repos/asf/allura/blob/071ced0f/Allura/allura/templates/jinja_master/sidebar_menu.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/sidebar_menu.html b/Allura/allura/templates/jinja_master/sidebar_menu.html
index b51a15b..9a81035 100644
--- a/Allura/allura/templates/jinja_master/sidebar_menu.html
+++ b/Allura/allura/templates/jinja_master/sidebar_menu.html
@@ -54,6 +54,17 @@
       {% endfor %}
     {% endif %}
     {% if c.app %}
+      {% if h.has_access(c.app, 'admin')() %}
+        {% for s in c.app.admin_menu() %}
+          {{sidebar_item(s)}}
+        {% endfor %}
+        {{sidebar_item(c.app.admin_menu_delete_button)}}
+        {{sidebar_item(None)}}
+        {{c.app.admin_modal.display()}}
+        {% if c.app.admin_menu_delete_button %}
+          {{c.app.admin_tool_delete_modal.display()}}
+        {% endif %}
+      {% endif %}
       {% for s in c.app.sidebar_menu() %}
         {{sidebar_item(s)}}
       {% endfor %}

http://git-wip-us.apache.org/repos/asf/allura/blob/071ced0f/Allura/allura/templates/widgets/admin_tool_delete_modal.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/admin_tool_delete_modal.html b/Allura/allura/templates/widgets/admin_tool_delete_modal.html
new file mode 100644
index 0000000..dd8aab4
--- /dev/null
+++ b/Allura/allura/templates/widgets/admin_tool_delete_modal.html
@@ -0,0 +1,34 @@
+{#-
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+-#}
+{% import 'allura:templates/jinja_master/lib.html' as lib with context %}
+
+<h1>Confirm Delete</h1>
+<form method="POST"
+      action="{{c.project.url()}}admin/update_mounts"
+      id="admin-tool-delete-modal-form">
+<p class="warning-msg">Warning: This will destroy all data in this tool and is irreversible!</p>
+<hr>
+<p>
+  <input type="button" value="Delete" class="delete-tool">
+  <input type="button" value="Cancel" class="close">
+</p>
+<input type="hidden" class="mount_point" name="tool-0.mount_point"/>
+<input name="tool-0.delete" type="hidden" value="Delete"/>
+{{lib.csrf_token()}}
+</form>


[6/7] allura git commit: [#7922] ticket:826 Add tests for sitebar admin menu

Posted by je...@apache.org.
[#7922] ticket:826 Add tests for sitebar admin menu


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

Branch: refs/heads/ib/7922
Commit: 015ebd03eceef8d21cb4cb23c144bc3ddbc31c51
Parents: 6241e7d
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon Aug 3 13:37:56 2015 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Mon Aug 3 13:37:56 2015 +0300

----------------------------------------------------------------------
 ForgeWiki/forgewiki/tests/functional/test_root.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/015ebd03/ForgeWiki/forgewiki/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/tests/functional/test_root.py b/ForgeWiki/forgewiki/tests/functional/test_root.py
index 276c4b9..e2604bc 100644
--- a/ForgeWiki/forgewiki/tests/functional/test_root.py
+++ b/ForgeWiki/forgewiki/tests/functional/test_root.py
@@ -819,3 +819,20 @@ class TestRootController(TestController):
                 'Page creation rate limit exceeded. Please try again later.')
             p = model.Page.query.get(title='page2')
             assert_equal(p, None)
+
+    def test_sidebar_admin_menu(self):
+        r = self.app.get('/p/test/wiki/Home/')
+        menu = r.html.find('div', {'id': 'sidebar-admin-menu'})
+        menu = [li.find('span').getText() for li in menu.findAll('li')]
+        assert_equal(
+            menu,
+            ['Admin', 'Set Home', 'Permissions', 'Options', 'Label', 'Delete'])
+
+    def test_sidebar_admin_menu_invisible_to_not_admin(self):
+        def assert_invisible_for(username):
+            env = {'username': username}
+            r = self.app.get('/p/test/wiki/Home/', extra_environ=env)
+            menu = r.html.find('div', {'id': 'sidebar-admin-menu'})
+            assert_equal(menu, None)
+        assert_invisible_for('*anonymous')
+        assert_invisible_for('test-user')


[7/7] allura git commit: [#7922] ticket:826 Add docstrings for new properties

Posted by je...@apache.org.
[#7922] ticket:826 Add docstrings for new properties


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

Branch: refs/heads/ib/7922
Commit: 3c0d5bfcd6b37d146c2204c2d9be368527e2b948
Parents: 015ebd0
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon Aug 3 13:46:11 2015 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Mon Aug 3 13:46:11 2015 +0300

----------------------------------------------------------------------
 Allura/allura/app.py | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/3c0d5bfc/Allura/allura/app.py
----------------------------------------------------------------------
diff --git a/Allura/allura/app.py b/Allura/allura/app.py
index 67fff89..f060204 100644
--- a/Allura/allura/app.py
+++ b/Allura/allura/app.py
@@ -293,10 +293,12 @@ class Application(object):
 
     @LazyProperty
     def admin_modal(self):
+        """Returns modal dialog widget for app's admin options"""
         return admin_widgets.AdminModal()
 
     @LazyProperty
     def admin_tool_delete_modal(self):
+        """Returns modal dialog widget for app's delete workflow"""
         return admin_widgets.AdminToolDeleteModal()
 
     @LazyProperty
@@ -627,6 +629,7 @@ class Application(object):
 
     @LazyProperty
     def admin_menu_collapse_button(self):
+        """Returns button for showing/hiding admin sidebar menu"""
         return SitemapEntry(
             label='Admin',
             url='#',
@@ -636,6 +639,7 @@ class Application(object):
 
     @LazyProperty
     def admin_menu_delete_button(self):
+        """Returns button for deleting an app if app can be deleted"""
         anchored_tools = self.project.neighborhood.get_anchored_tools()
         anchored = self.tool_label.lower() in anchored_tools.keys()
         if self.uninstallable and not anchored:


[5/7] allura git commit: [#7922] ticket:826 Fix tests

Posted by je...@apache.org.
[#7922] ticket:826 Fix tests


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

Branch: refs/heads/ib/7922
Commit: 6241e7d350a9bed3c2918457ddd6df7c5273fdc2
Parents: bcafc37
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon Aug 3 13:21:53 2015 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Mon Aug 3 13:21:53 2015 +0300

----------------------------------------------------------------------
 .../tests/functional/test_neighborhood.py       |  2 +-
 AlluraTest/alluratest/controller.py             |  6 ++
 .../tests/functional/test_controllers.py        | 13 +++--
 .../forgetracker/tests/functional/test_root.py  | 61 ++++++++++++--------
 .../forgewiki/tests/functional/test_rest.py     |  2 +-
 .../forgewiki/tests/functional/test_root.py     |  9 ++-
 6 files changed, 60 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/6241e7d3/Allura/allura/tests/functional/test_neighborhood.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_neighborhood.py b/Allura/allura/tests/functional/test_neighborhood.py
index f87e9ea..f91ddc9 100644
--- a/Allura/allura/tests/functional/test_neighborhood.py
+++ b/Allura/allura/tests/functional/test_neighborhood.py
@@ -173,7 +173,7 @@ class TestNeighborhood(TestController):
 
         r = self.app.get('/p/test/admin/tools')
         assert '<div class="fleft isnt_sorted">' in r
-        delete_tool = r.html.find('a', {'class': 'mount_delete'})
+        delete_tool = r.html.findAll('a', {'class': 'admin_tool_delete_modal'})
         assert_equal(len(delete_tool), 1)
 
     def test_show_title(self):

http://git-wip-us.apache.org/repos/asf/allura/blob/6241e7d3/AlluraTest/alluratest/controller.py
----------------------------------------------------------------------
diff --git a/AlluraTest/alluratest/controller.py b/AlluraTest/alluratest/controller.py
index 5a61ab7..babf262 100644
--- a/AlluraTest/alluratest/controller.py
+++ b/AlluraTest/alluratest/controller.py
@@ -185,6 +185,12 @@ class TestController(object):
         json_dict = json_dict.strip(' ;')
         return json.loads(json_dict)
 
+    def find_form(self, resp, cond):
+        """Find form on the page that meets given condition"""
+        for f in resp.forms.itervalues():
+            if cond(f):
+                return f
+
 
 class TestRestApiBase(TestController):
 

http://git-wip-us.apache.org/repos/asf/allura/blob/6241e7d3/ForgeGit/forgegit/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/functional/test_controllers.py b/ForgeGit/forgegit/tests/functional/test_controllers.py
index 48969fc..dd79b57 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -574,10 +574,15 @@ class TestFork(_TestCase):
         r = self._follow(r, **kw)
         return r
 
+    def _find_request_merge_form(self, resp):
+        cond = lambda f: f.action == 'do_request_merge'
+        return self.find_form(resp, cond)
+
     def _request_merge(self, **kw):
         r = self.app.get('/p/test2/code/request_merge', **kw)
         r = self._follow(r, **kw)
-        r = r.forms[0].submit()
+        form = self._find_request_merge_form(r)
+        r = form.submit()
         r = self._follow(r, **kw)
         mr_num = r.request.url.split('/')[-2]
         assert mr_num.isdigit(), mr_num
@@ -640,7 +645,7 @@ class TestFork(_TestCase):
         assert 'git checkout master' in merge_instructions
         assert 'git fetch git://git.localhost/p/test2/code master' in merge_instructions
         assert 'git merge {}'.format(c_id) in merge_instructions
-        assert_in('less than 1 minute ago', r.html.findAll('p')[0].getText())
+        assert_in('less than 1 minute ago', r.html.findAll('p')[2].getText())
 
         merge_form = r.html.find('form', action='merge')
         assert merge_form
@@ -669,8 +674,8 @@ class TestFork(_TestCase):
         r, mr_num = self._request_merge()
         r = self.app.get('/p/test/src-git/merge-requests/')
         assert 'href="%s/"' % mr_num in r, r
-        assert_equal(r.html.findAll('span')[8].getText(), 'less than 1 minute ago')
-        assert_equal(r.html.findAll('span')[9].getText(), 'less than 1 minute ago')
+        assert_equal(r.html.findAll('span')[-2].getText(), 'less than 1 minute ago')
+        assert_equal(r.html.findAll('span')[-1].getText(), 'less than 1 minute ago')
 
     def test_merge_request_update_status(self):
         r, mr_num = self._request_merge()

http://git-wip-us.apache.org/repos/asf/allura/blob/6241e7d3/ForgeTracker/forgetracker/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index 89041d7..2f7f05d 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -27,6 +27,7 @@ import allura
 import mock
 
 import PIL
+from BeautifulSoup import BeautifulSoup
 from mock import patch
 from nose.tools import (
     assert_true,
@@ -65,11 +66,19 @@ class TrackerTestController(TestController):
     def setup_with_tools(self):
         pass
 
+    def _find_new_ticket_form(self, resp):
+        cond = lambda f: f.action.endswith('/save_ticket')
+        return self.find_form(resp, cond)
+
+    def _find_update_ticket_form(self, resp):
+        cond = lambda f: f.action.endswith('/update_ticket_from_widget')
+        return self.find_form(resp, cond)
+
     def new_ticket(self, mount_point='/bugs/', extra_environ=None, **kw):
         extra_environ = extra_environ or {}
         response = self.app.get(mount_point + 'new/',
                                 extra_environ=extra_environ)
-        form = response.forms[1]
+        form = self._find_new_ticket_form(response)
         # If this is ProjectUserCombo's select populate it
         # with all the users in the project. This is a workaround for tests,
         # in real enviroment this is populated via ajax.
@@ -346,7 +355,7 @@ class TestFunctionalController(TrackerTestController):
 
     def test_new_ticket_form(self):
         response = self.app.get('/bugs/new/')
-        form = response.forms[1]
+        form = self._find_new_ticket_form(response)
         form['ticket_form.summary'] = 'test new ticket form'
         form['ticket_form.description'] = 'test new ticket form description'
         response = form.submit().follow()
@@ -841,7 +850,8 @@ class TestFunctionalController(TrackerTestController):
         }, upload_files=[upload]).follow()
         assert file_name in ticket_editor, ticket_editor.showbrowser()
         req = self.app.get('/bugs/1/')
-        file_link = req.html.findAll('form')[1].findAll('a')[1]
+        form = self._find_update_ticket_form(req)
+        file_link = BeautifulSoup(form.text).findAll('a')[1]
         assert_equal(file_link.string, file_name)
         self.app.post(str(file_link['href']), {
             'delete': 'True'
@@ -883,7 +893,8 @@ class TestFunctionalController(TrackerTestController):
         ticket_editor = self.app.post('/bugs/1/update_ticket', {
             'summary': 'zzz'
         }, upload_files=[upload]).follow()
-        download = self.app.get(str(ticket_editor.html.findAll('form')[1].findAll('a')[1]['href']))
+        form = self._find_update_ticket_form(ticket_editor)
+        download = self.app.get(str(BeautifulSoup(form.text).findAll('a')[1]['href']))
         assert_equal(download.body, file_data)
 
     def test_two_attachments(self):
@@ -1229,18 +1240,17 @@ class TestFunctionalController(TrackerTestController):
             '/admin/bugs/set_custom_fields', params=variable_encode(params))
         # Test new ticket form
         r = self.app.get('/bugs/new/')
-        form = r.forms[1]
+        form = self._find_new_ticket_form(r)
         form['ticket_form.custom_fields._priority'] = 'urgent'
         form['ticket_form.custom_fields._category'] = 'bugs'
         error_form = form.submit()
-        assert_equal(error_form.forms[1]['ticket_form.custom_fields._priority'].value,
-                     'urgent')
-        assert_equal(error_form.forms[1]['ticket_form.custom_fields._category'].value,
-                     'bugs')
+        form = self._find_new_ticket_form(error_form)
+        assert_equal(form['ticket_form.custom_fields._priority'].value, 'urgent')
+        assert_equal(form['ticket_form.custom_fields._category'].value, 'bugs')
         # Test edit ticket form
         self.new_ticket(summary='Test ticket')
         response = self.app.get('/bugs/1/')
-        form = response.forms[1]
+        form = self._find_update_ticket_form(response)
         assert_equal(
             form['ticket_form.custom_fields._priority'].value, 'normal')
         assert_equal(form['ticket_form.custom_fields._category'].value, '')
@@ -1248,29 +1258,29 @@ class TestFunctionalController(TrackerTestController):
         form['ticket_form.custom_fields._priority'] = 'urgent'
         form['ticket_form.custom_fields._category'] = 'bugs'
         error_form = form.submit()
-        assert_equal(error_form.forms[1]['ticket_form.custom_fields._priority'].value,
-                     'urgent')
-        assert_equal(error_form.forms[1]['ticket_form.custom_fields._category'].value,
-                     'bugs')
+        form = self._find_update_ticket_form(error_form)
+        assert_equal(form['ticket_form.custom_fields._priority'].value, 'urgent')
+        assert_equal(form['ticket_form.custom_fields._category'].value, 'bugs')
 
     def test_new_ticket_validation(self):
         summary = 'ticket summary'
         response = self.app.get('/bugs/new/')
         assert not response.html.find('div', {'class': 'error'})
-        form = response.forms[1]
+        form = self._find_new_ticket_form(response)
         form['ticket_form.labels'] = 'foo'
         # try submitting with no summary set and check for error message
         error_form = form.submit()
-        assert error_form.forms[1]['ticket_form.labels'].value == 'foo'
-        error_message = error_form.html.find('div', {'class': 'error'})
+        form = self._find_new_ticket_form(error_form)
+        assert form['ticket_form.labels'].value == 'foo'
+        error_message = BeautifulSoup(form.text).find('div', {'class': 'error'})
         assert error_message
         assert (error_message.string == 'You must provide a Title' or
                 error_message.string == 'Missing value')
         assert error_message.findPreviousSibling('input').get('name') == 'ticket_form.summary'
         # set a summary, submit, and check for success
-        error_form.forms[1]['ticket_form.summary'] = summary
-        success = error_form.forms[1].submit().follow().html
-        assert success.findAll('form')[1].get('action') == '/p/test/bugs/1/update_ticket_from_widget'
+        form['ticket_form.summary'] = summary
+        success = form.submit().follow().html
+        assert success.findAll('form', {'action': '/p/test/bugs/1/update_ticket_from_widget'}) is not None
         assert success.find('input', {'name': 'ticket_form.summary'})['value'] == summary
 
     def test_edit_ticket_validation(self):
@@ -1281,7 +1291,7 @@ class TestFunctionalController(TrackerTestController):
         # check that existing form is valid
         assert response.html.find('input', {'name': 'ticket_form.summary'})['value'] == old_summary
         assert not response.html.find('div', {'class': 'error'})
-        form = response.forms[1]
+        form = self._find_update_ticket_form(response)
         # try submitting with no summary set and check for error message
         form['ticket_form.summary'] = ""
         error_form = form.submit()
@@ -1290,11 +1300,12 @@ class TestFunctionalController(TrackerTestController):
         assert error_message.string == 'You must provide a Title'
         assert error_message.findPreviousSibling('input').get('name') == 'ticket_form.summary'
         # set a summary, submit, and check for success
-        error_form.forms[1]['ticket_form.summary'] = new_summary
-        r = error_form.forms[1].submit()
+        form = self._find_update_ticket_form(error_form)
+        form['ticket_form.summary'] = new_summary
+        r = form.submit()
         assert r.status_int == 302, r.showbrowser()
         success = r.follow().html
-        assert success.findAll('form')[1].get('action') == '/p/test/bugs/1/update_ticket_from_widget'
+        assert success.findAll('form', {'action': '/p/test/bugs/1/update_ticket_from_widget'}) is not None
         assert success.find('input', {'name': 'ticket_form.summary'})['value'] == new_summary
 
     def test_home(self):
@@ -2721,7 +2732,7 @@ class TestCustomUserField(TrackerTestController):
     def test_change_user_field(self):
         kw = {'custom_fields._code_review': ''}
         r = self.new_ticket(summary='test custom fields', **kw).follow()
-        f = r.forms[1]
+        f = self._find_update_ticket_form(r)
         # Populate ProjectUserCombo's select with option we want.
         # This is a workaround for tests,
         # in real enviroment this is populated via ajax.

http://git-wip-us.apache.org/repos/asf/allura/blob/6241e7d3/ForgeWiki/forgewiki/tests/functional/test_rest.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/tests/functional/test_rest.py b/ForgeWiki/forgewiki/tests/functional/test_rest.py
index 6a5de3b..a2b58ae 100644
--- a/ForgeWiki/forgewiki/tests/functional/test_rest.py
+++ b/ForgeWiki/forgewiki/tests/functional/test_rest.py
@@ -42,7 +42,7 @@ class TestWikiApi(TestRestApiBase):
 
     def test_get_page(self):
         r = self.app.get('/p/test/wiki/Home/')
-        discussion_url = r.html.findAll('form')[2]['action'][:-4]
+        discussion_url = r.html.findAll('form')[3]['action'][:-4]
         content = file(__file__).read()
         self.app.post('/wiki/Home/attach',
                       upload_files=[('file_info', 'test_root.py', content)])

http://git-wip-us.apache.org/repos/asf/allura/blob/6241e7d3/ForgeWiki/forgewiki/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/tests/functional/test_root.py b/ForgeWiki/forgewiki/tests/functional/test_root.py
index 3f69d89..276c4b9 100644
--- a/ForgeWiki/forgewiki/tests/functional/test_root.py
+++ b/ForgeWiki/forgewiki/tests/functional/test_root.py
@@ -54,6 +54,10 @@ class TestRootController(TestController):
     def setup_with_tools(self):
         pass
 
+    def _find_edit_form(self, resp):
+        cond = lambda f: f.id == 'page_edit_form'
+        return self.find_form(resp, cond)
+
     def test_root_index(self):
         page_url = h.urlquote(u'/wiki/tést/')
         r = self.app.get(page_url).follow()
@@ -678,8 +682,9 @@ class TestRootController(TestController):
         assert 'The resource was found at http://localhost/p/test/wiki/Home/;' in self.app.get(
             '/p/test/wiki/')
         req = self.app.get('/p/test/wiki/Home/edit')
-        req.forms[1]['title'].value = 'new_title'
-        req.forms[1].submit()
+        form = self._find_edit_form(req)
+        form['title'].value = 'new_title'
+        form.submit()
         assert 'The resource was found at http://localhost/p/test/wiki/new_title/;' in self.app.get(
             '/p/test/wiki/')
 


[4/7] allura git commit: [#7922] ticket:826 Make menu collapsible

Posted by je...@apache.org.
[#7922] ticket:826 Make menu collapsible


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

Branch: refs/heads/ib/7922
Commit: bcafc376dbec2ab07eba87f2dea46edb7f97c12b
Parents: 235907a
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Jul 31 13:33:43 2015 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Fri Jul 31 13:33:43 2015 +0300

----------------------------------------------------------------------
 Allura/allura/app.py                            |  9 +++++++++
 .../templates/jinja_master/sidebar_menu.html    | 20 ++++++++++++++++++++
 2 files changed, 29 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/bcafc376/Allura/allura/app.py
----------------------------------------------------------------------
diff --git a/Allura/allura/app.py b/Allura/allura/app.py
index 3aa8aad..67fff89 100644
--- a/Allura/allura/app.py
+++ b/Allura/allura/app.py
@@ -626,6 +626,15 @@ class Application(object):
         return links
 
     @LazyProperty
+    def admin_menu_collapse_button(self):
+        return SitemapEntry(
+            label='Admin',
+            url='#',
+            extra_html_attrs={
+                'id': 'sidebar-admin-menu-trigger',
+            })
+
+    @LazyProperty
     def admin_menu_delete_button(self):
         anchored_tools = self.project.neighborhood.get_anchored_tools()
         anchored = self.tool_label.lower() in anchored_tools.keys()

http://git-wip-us.apache.org/repos/asf/allura/blob/bcafc376/Allura/allura/templates/jinja_master/sidebar_menu.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/sidebar_menu.html b/Allura/allura/templates/jinja_master/sidebar_menu.html
index 9a81035..752440c 100644
--- a/Allura/allura/templates/jinja_master/sidebar_menu.html
+++ b/Allura/allura/templates/jinja_master/sidebar_menu.html
@@ -55,7 +55,26 @@
     {% endif %}
     {% if c.app %}
       {% if h.has_access(c.app, 'admin')() %}
+        <style>
+          #sidebar-admin-menu.hide ul li:not(:first-child) {
+            display: none;
+          }
+          #sidebar-admin-menu.hide ul li:first-child {
+            border-bottom: medium none;
+          }
+        </style>
+        <div id='sidebar-admin-menu' class='hide'>
         {% for s in c.app.admin_menu() %}
+          {% if loop.first %}
+            {{sidebar_item(c.app.admin_menu_collapse_button)}}
+            <script>
+              $('#sidebar-admin-menu-trigger').click(function(e) {
+                e.preventDefault();
+                $(this).parents('li').toggleClass('active');
+                $('#sidebar-admin-menu').toggleClass('hide');
+              });
+            </script>
+          {% endif %}
           {{sidebar_item(s)}}
         {% endfor %}
         {{sidebar_item(c.app.admin_menu_delete_button)}}
@@ -64,6 +83,7 @@
         {% if c.app.admin_menu_delete_button %}
           {{c.app.admin_tool_delete_modal.display()}}
         {% endif %}
+        </div>
       {% endif %}
       {% for s in c.app.sidebar_menu() %}
         {{sidebar_item(s)}}


[2/7] allura git commit: [#7922] ticket:826 Fix subproject delete

Posted by je...@apache.org.
[#7922] ticket:826 Fix subproject delete


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

Branch: refs/heads/ib/7922
Commit: 9a84fe6356cc4593d9c01018a08d63d2b0dfb2f0
Parents: 071ced0
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Jul 31 12:28:21 2015 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Fri Jul 31 12:28:21 2015 +0300

----------------------------------------------------------------------
 Allura/allura/ext/admin/templates/project_tools.html        | 4 +++-
 .../lib/widgets/resources/js/admin_tool_delete_modal.js     | 9 ++++++++-
 .../allura/templates/widgets/admin_tool_delete_modal.html   | 4 ++--
 3 files changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/9a84fe63/Allura/allura/ext/admin/templates/project_tools.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/templates/project_tools.html b/Allura/allura/ext/admin/templates/project_tools.html
index c9eab4a..90c03d4 100644
--- a/Allura/allura/ext/admin/templates/project_tools.html
+++ b/Allura/allura/ext/admin/templates/project_tools.html
@@ -105,7 +105,9 @@
                         <img src="{{ g.theme.app_icon_url('subproject', 48) }}" alt="">
                     </li>
                     <li>
-                      <a href="#" data-mount-point="{{ mount['sub'].shortname }}" class="admin_tool_delete_modal">
+                      <a href="#" data-mount-point="{{ mount['sub'].shortname }}"
+                                  data-subproject="true"
+                                  class="admin_tool_delete_modal">
                         <span>Delete</span>
                       </a>
                     </li>

http://git-wip-us.apache.org/repos/asf/allura/blob/9a84fe63/Allura/allura/lib/widgets/resources/js/admin_tool_delete_modal.js
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/js/admin_tool_delete_modal.js b/Allura/allura/lib/widgets/resources/js/admin_tool_delete_modal.js
index 3d41261..211f5ed 100644
--- a/Allura/allura/lib/widgets/resources/js/admin_tool_delete_modal.js
+++ b/Allura/allura/lib/widgets/resources/js/admin_tool_delete_modal.js
@@ -20,7 +20,14 @@ $(function() {
   var $form = $('#admin-tool-delete-modal-form');
   $('a.admin_tool_delete_modal').click(function() {
     var mount_point = $(this).data('mount-point');
-    $form.find('.mount_point').val(mount_point);
+    var is_sub = $(this).data('subproject');
+    var prefix = is_sub ? 'subproject-0' : 'tool-0';
+    var mount_point_name = prefix + (is_sub ? '.shortname' : '.mount_point');
+    var delete_name = prefix + '.delete';
+    $form.find('.mount_point')
+         .attr('name', mount_point_name)
+         .val(mount_point);
+    $form.find('.delete-input').attr('name', delete_name);
     var tool_label = 'this';
     if (mount_point) {
       tool_label = 'the "' + mount_point + '"';

http://git-wip-us.apache.org/repos/asf/allura/blob/9a84fe63/Allura/allura/templates/widgets/admin_tool_delete_modal.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/admin_tool_delete_modal.html b/Allura/allura/templates/widgets/admin_tool_delete_modal.html
index dd8aab4..692c582 100644
--- a/Allura/allura/templates/widgets/admin_tool_delete_modal.html
+++ b/Allura/allura/templates/widgets/admin_tool_delete_modal.html
@@ -28,7 +28,7 @@
   <input type="button" value="Delete" class="delete-tool">
   <input type="button" value="Cancel" class="close">
 </p>
-<input type="hidden" class="mount_point" name="tool-0.mount_point"/>
-<input name="tool-0.delete" type="hidden" value="Delete"/>
+<input type="hidden" class="mount_point">
+<input type="hidden" value="Delete" class="delete-input">
 {{lib.csrf_token()}}
 </form>


[3/7] allura git commit: [#7922] ticket:826 Fix tool ordering

Posted by je...@apache.org.
[#7922] ticket:826 Fix tool ordering


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

Branch: refs/heads/ib/7922
Commit: 235907a06e34631b947c9341def141d7f119c0c4
Parents: 9a84fe6
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Jul 31 12:48:43 2015 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Fri Jul 31 12:48:43 2015 +0300

----------------------------------------------------------------------
 Allura/allura/ext/admin/templates/project_tools.html | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/235907a0/Allura/allura/ext/admin/templates/project_tools.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/templates/project_tools.html b/Allura/allura/ext/admin/templates/project_tools.html
index 90c03d4..aa825f1 100644
--- a/Allura/allura/ext/admin/templates/project_tools.html
+++ b/Allura/allura/ext/admin/templates/project_tools.html
@@ -92,9 +92,8 @@
                     {% endfor %}
                     {{sidebar_item(app.admin_menu_delete_button)}}
                 </ul>
-                {% if not app.uninstallable %}
-                  <input type="hidden" class="mount_point" value="{{mount['ac'].options.mount_point}}"/>
-                {% endif %}
+                {# for ordering #}
+                <input type="hidden" class="mount_point" value="{{mount['ac'].options.mount_point}}"/>
             </div>
         {% endif %}
         {% if 'sub' in mount and not mount['sub'].deleted %}