[yocto] [patchwork][PATCH 1/3] series.js: support shift-select range

Jose Lamego jose.a.lamego at linux.intel.com
Tue Feb 28 15:07:32 PST 2017


Selecting multiple patches in a range at the series view must be
performed on one-by-one basis, providing apoor user-experience.

This change allows to select patches in a range by clicking the
first patch, then shift-clicking the last patch in the desired range.

[YOCTO #10819]

Signed-off-by: Jose Lamego <jose.a.lamego at linux.intel.com>
---
 htdocs/js/series.js | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/htdocs/js/series.js b/htdocs/js/series.js
index c4bbb0e..6571b0e 100644
--- a/htdocs/js/series.js
+++ b/htdocs/js/series.js
@@ -82,6 +82,37 @@ $(document).ready(function(){
         })
     })
 
+    var lastChecked = null
+    var $chkboxes = $( "input[name^='patch_id']" )
+
+    $chkboxes.click(function(e){
+        if(!lastChecked) {
+            lastChecked = this;
+            return;
+        }
+
+        if(e.shiftKey) {
+            var start = $chkboxes.index(this);
+            var end = $chkboxes.index(lastChecked);
+            var min_val = Math.min(start,end)
+            var max_val = Math.max(start,end)+1
+
+            $chkboxes.slice(min_val, max_val).prop('checked', lastChecked.checked);
+            for (i=min_val; i<max_val; ++i){
+                p_id=$chkboxes[i].getAttribute("name")
+                p_id=p_id.match(/\d+/)[0]
+                if (lastChecked.checked){
+                    insert_patchId(p_id)
+                }
+                else{
+                   remove_patchId(p_id)
+                }
+            }
+        }
+
+        lastChecked = this;
+    })
+
     $( "input[name^='patch_id']" ).change(function(){
         patchView.style.display="none"
         uncheck_allSel()
-- 
1.9.1




More information about the yocto mailing list