allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [02/50] [abbrv] allura git commit: [#7919] don't support subproject deletion from parent project, only regular tools; provide link to subproject admin
Date Fri, 08 Jan 2016 19:30:07 GMT
[#7919] don't support subproject deletion from parent project, only regular tools; provide
link to subproject admin


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

Branch: refs/heads/master
Commit: 9d3adeda10ac6db2d6c5ca5325061f1edc9d9b2e
Parents: 36b5e6e
Author: Dave Brondsema <dave@brondsema.net>
Authored: Thu Dec 3 10:18:47 2015 -0500
Committer: Dave Brondsema <dave@brondsema.net>
Committed: Fri Jan 8 14:06:14 2016 -0500

----------------------------------------------------------------------
 .../ext/admin/templates/project_tools.html      |  8 -----
 Allura/allura/model/project.py                  |  2 ++
 Allura/allura/templates/app_admin_delete.html   | 35 +++-----------------
 .../tests/functional/test_neighborhood.py       |  6 ++--
 Allura/allura/tests/test_webhooks.py            |  4 +--
 5 files changed, 11 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/9d3adeda/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 a78a916..4b22bbe 100644
--- a/Allura/allura/ext/admin/templates/project_tools.html
+++ b/Allura/allura/ext/admin/templates/project_tools.html
@@ -103,14 +103,6 @@
                         <span class="tool_name">{{ mount['sub'].name }}</span><br
/>
                         <img src="{{ g.theme.app_icon_url('subproject', 48) }}" alt="">
                     </li>
-                    <li>
-                        <!-- FIXME -->
-                      <a href="#" data-mount-point="{{ mount['sub'].shortname }}"
-                                  data-subproject="true"
-                                  class="admin_tool_delete_modal">
-                        <span>Delete</span>
-                      </a>
-                    </li>
                 </ul>
             </div>
         {% endif %}

http://git-wip-us.apache.org/repos/asf/allura/blob/9d3adeda/Allura/allura/model/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index 0e4a78a..cafa8ad 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -627,6 +627,8 @@ class Project(SearchIndexable, MappedClass, ActivityNode, ActivityObject):
                     entry['admin_options'] = ProjectAdminRestController().admin_options(mount_point)['options']
                 except exc.HTTPNotFound:
                     log.debug('Could not get admin_options mount_point for tool: %s', s.url)
+            if admin_options and not s.tool_name:
+                entry['admin_options'] = [dict(text='Subproject Admin', href=s.url + 'admin',
className=None)]
             return entry
 
         for s in self.grouped_navbar_entries():

http://git-wip-us.apache.org/repos/asf/allura/blob/9d3adeda/Allura/allura/templates/app_admin_delete.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/app_admin_delete.html b/Allura/allura/templates/app_admin_delete.html
index fe71b56..953a35d 100644
--- a/Allura/allura/templates/app_admin_delete.html
+++ b/Allura/allura/templates/app_admin_delete.html
@@ -18,41 +18,14 @@
 -#}
 {% import 'allura:templates/jinja_master/lib.html' as lib with context %}
 
-<form method="POST"
-      action="{{c.project.url()}}admin/update_mounts"
-      id="admin-tool-delete-modal-form">
+<form method="POST" action="{{c.project.url()}}admin/update_mounts">
 <p>Warning: This will destroy all data in the '{{ app.config.options.mount_point }}'
tool and is irreversible!</p>
 <hr>
 <p>
-  <input type="button" value="Delete" class="delete-tool">
+  <input type="submit" value="Delete" class="delete-tool">
   <input type="button" value="Cancel" class="close">
 </p>
-<input type="hidden" class="mount_point">
-<input type="hidden" value="Delete" class="delete-input">
+<input type="hidden" name="tool-0.mount_point" value="{{ app.config.options.mount_point
}}">
+<input type="hidden" name="tool-0.delete" value="Delete">
 {{lib.csrf_token()}}
 </form>
-
-
-<script type="text/javascript">
-$(function() {
-    var $form = $('#admin-tool-delete-modal-form');
-    var mount_point = '{{ app.config.options.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);
-
-    $form.find('.delete-tool').click(function() {
-        if ($form.find('.mount_point').val()) {
-            $form.submit();
-        } else {
-            console.log('Do not know which tool to delete!');
-        }
-    });
-});
-</script>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/allura/blob/9d3adeda/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 a218b68..b97a7c8 100644
--- a/Allura/allura/tests/functional/test_neighborhood.py
+++ b/Allura/allura/tests/functional/test_neighborhood.py
@@ -173,9 +173,9 @@ class TestNeighborhood(TestController):
 
         r = self.app.get('/p/test/admin/tools')
         assert '<div class="fleft isnt_sorted">' in r
-        # FIXME
-        delete_tool = r.html.findAll('a', {'class': 'admin_tool_delete_modal'})
-        assert_equal(len(delete_tool), 1)
+        delete_tool = [link for link in r.html.findAll('a', {'class': 'admin_modal'})
+                       if link['href'].endswith('/delete')]
+        assert_equal(len(delete_tool), 0)  # wiki not deletable
 
     def test_show_title(self):
         r = self.app.get('/adobe/_admin/overview',

http://git-wip-us.apache.org/repos/asf/allura/blob/9d3adeda/Allura/allura/tests/test_webhooks.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_webhooks.py b/Allura/allura/tests/test_webhooks.py
index 93da118..d7fb75c 100644
--- a/Allura/allura/tests/test_webhooks.py
+++ b/Allura/allura/tests/test_webhooks.py
@@ -261,7 +261,7 @@ class TestWebhookController(TestController):
         assert_equal(M.Webhook.query.find().count(), 2)
         wh1 = M.Webhook.query.get(hook_url=data1['url'])
         r = self.app.get(self.url + '/repo-push/%s' % wh1._id)
-        form = r.forms[1]
+        form = r.forms[0]
         assert_equal(form['url'].value, data1['url'])
         assert_equal(form['secret'].value, data1['secret'])
         assert_equal(form['webhook'].value, unicode(wh1._id))
@@ -283,7 +283,7 @@ class TestWebhookController(TestController):
 
         # Duplicates
         r = self.app.get(self.url + '/repo-push/%s' % wh1._id)
-        form = r.forms[1]
+        form = r.forms[0]
         form['url'] = data2['url']
         r = form.submit()
         self.find_error(r, '_the_form',


Mime
View raw message