allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject [26/50] git commit: [#5494] Refactor mass edit ticket select checkboxes to use multi-value instead of name/join
Date Tue, 16 Apr 2013 12:29:16 GMT
[#5494] Refactor mass edit ticket select checkboxes to use multi-value instead of name/join

Signed-off-by: Cory Johns <cjohns@slashdotmedia.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/5207de0e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/5207de0e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/5207de0e

Branch: refs/heads/acs2/5518
Commit: 5207de0e2d9606fc11d3dd2bd2616941b573cf79
Parents: fa5d7e0
Author: Cory Johns <cjohns@slashdotmedia.com>
Authored: Thu Apr 4 19:11:12 2013 +0000
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Tue Apr 9 16:28:22 2013 +0000

----------------------------------------------------------------------
 .../templates/tracker_widgets/mass_edit.html       |    2 +-
 .../templates/tracker_widgets/mass_edit_form.html  |    1 -
 .../forgetracker/tests/functional/test_root.py     |    6 +++---
 ForgeTracker/forgetracker/tracker_main.py          |   11 ++---------
 .../forgetracker/widgets/resources/js/mass-edit.js |    4 +++-
 5 files changed, 9 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5207de0e/ForgeTracker/forgetracker/templates/tracker_widgets/mass_edit.html
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/templates/tracker_widgets/mass_edit.html b/ForgeTracker/forgetracker/templates/tracker_widgets/mass_edit.html
index 07b3d22..381cf7a 100644
--- a/ForgeTracker/forgetracker/templates/tracker_widgets/mass_edit.html
+++ b/ForgeTracker/forgetracker/templates/tracker_widgets/mass_edit.html
@@ -17,7 +17,7 @@
       <tbody class="ticket-list">
         {% for t in tickets %}
         <tr>
-          <td><input type="checkbox" name="{{t._id}}" value=""/></td>
+          <td><input type="checkbox" name="ticket_ids" value="{{t._id}}"/></td>
           <td><a href="{{t.url()}}">{{t.ticket_num}}</a></td>
           <td><a href="{{t.url()}}">{{t.summary}}</a></td>
           <td>{{t._milestone}}</td>

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5207de0e/ForgeTracker/forgetracker/templates/tracker_widgets/mass_edit_form.html
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/templates/tracker_widgets/mass_edit_form.html b/ForgeTracker/forgetracker/templates/tracker_widgets/mass_edit_form.html
index 7e6e738..1cb215b 100644
--- a/ForgeTracker/forgetracker/templates/tracker_widgets/mass_edit_form.html
+++ b/ForgeTracker/forgetracker/templates/tracker_widgets/mass_edit_form.html
@@ -72,6 +72,5 @@
       <!-- tg.url(c.app.url+'search/', dict(q=query, limit=limit, sort=sort))}}" class="btn
link">Cancel</a>-->
     </div>
     <div class="grid-12" id="result"></div>
-    <input name="__selected" type="hidden" value="" id="id_selected" />
     <input name="__search" type="hidden" value="" id="id_search" />
 </form>

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5207de0e/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 8276692..b2fd554 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -243,7 +243,7 @@ class TestFunctionalController(TrackerTestController):
         r = self.app.get('/p/test/bugs/edit/?q=ticket')
         self.app.post('/p/test/bugs/update_tickets', {
                       '__search': '',
-                      '__selected': first_ticket._id,
+                      '__ticket_ids': [first_ticket._id],
                       '_milestone': '2.0',
                       })
         r = self.app.get('/p/test/bugs/1/')
@@ -252,7 +252,7 @@ class TestFunctionalController(TrackerTestController):
         assert '<li><strong>Milestone</strong>: 1.0 --&gt; 2.0</li>'
not in r
         self.app.post('/p/test/bugs/update_tickets', {
                       '__search': '',
-                      '__selected': '%s,%s' % (
+                      '__ticket_ids': (
                           first_ticket._id,
                           second_ticket._id),
                       '_milestone': '1.0',
@@ -264,7 +264,7 @@ class TestFunctionalController(TrackerTestController):
 
         self.app.post('/p/test/bugs/update_tickets', {
                       '__search': '',
-                      '__selected': '%s,%s' % (
+                      '__ticket_ids': (
                           first_ticket._id,
                           second_ticket._id),
                       'status': 'accepted',

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5207de0e/ForgeTracker/forgetracker/tracker_main.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tracker_main.py b/ForgeTracker/forgetracker/tracker_main.py
index 7cde33e..dc14459 100644
--- a/ForgeTracker/forgetracker/tracker_main.py
+++ b/ForgeTracker/forgetracker/tracker_main.py
@@ -12,6 +12,7 @@ from itertools import ifilter
 import pkg_resources
 from tg import expose, validate, redirect, flash, url, config
 from tg.decorators import with_trailing_slash, without_trailing_slash
+from paste.deploy.converters import aslist
 from pylons import tmpl_context as c, app_globals as g
 from pylons import request, response
 from formencode import validators
@@ -737,7 +738,7 @@ class RootController(BaseController):
     @require_post()
     def update_tickets(self, **post_data):
         tickets = TM.Ticket.query.find(dict(
-                _id={'$in':[ObjectId(id) for id in post_data['__selected'].split(',')]},
+                _id={'$in':[ObjectId(id) for id in aslist(post_data['__ticket_ids'])]},
                 app_config_id=c.app.config._id)).all()
         for ticket in tickets:
             require_access(ticket, 'update')
@@ -802,14 +803,6 @@ class RootController(BaseController):
         flash('Updated {} ticket{}'.format(count, 's' if count != 1 else ''), 'ok')
         redirect('edit/' + post_data['__search'])
 
-# tickets
-# open tickets
-# closed tickets
-# new tickets in the last 7/14/30 days
-# of comments on tickets
-# of new comments on tickets in 7/14/30
-# of ticket changes in the last 7/14/30
-
     def tickets_since(self, when=None):
         count = 0
         if when:

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5207de0e/ForgeTracker/forgetracker/widgets/resources/js/mass-edit.js
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/widgets/resources/js/mass-edit.js b/ForgeTracker/forgetracker/widgets/resources/js/mass-edit.js
index f9ae973..9be18bb 100644
--- a/ForgeTracker/forgetracker/widgets/resources/js/mass-edit.js
+++ b/ForgeTracker/forgetracker/widgets/resources/js/mass-edit.js
@@ -17,6 +17,8 @@ $(function(){
             return false;
         }
 
-        $('#id_selected').val($checked.map(function(){ return this.name; }).get().join(','));
+        $checked.each(function() {
+            $('#update-values').append('<input type="hidden" name="__ticket_ids" value="'+$(this).val()+'"/>');
+        });
     });
 });


Mime
View raw message