[PATCH 41/51] js: Make the series API URL a parameter

Damien Lespiau damien.lespiau at intel.com
Sat Sep 12 01:55:14 AEST 2015


This code is fairly generic and we can reuse it to display lists of
series, we just need to provide the location of the list.

Signed-off-by: Damien Lespiau <damien.lespiau at intel.com>
---
 htdocs/js/patchwork.js | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/htdocs/js/patchwork.js b/htdocs/js/patchwork.js
index 023de6a..9a3d5c1 100644
--- a/htdocs/js/patchwork.js
+++ b/htdocs/js/patchwork.js
@@ -85,8 +85,12 @@ var pw = (function() {
         });
     }
 
-    exports.setup_series_list = function(selector) {
+    exports.setup_series_list = function(selector, url) {
         var table = $(selector);
+        var url;
+
+        if (typeof url == 'undefined')
+            url = '/api/1.0/projects/' + ctx.project + '/series/';
 
         table.bind('dynatable:preinit', function(e, dynatable) {
             dynatable.utility.textTransform.PatchworkSeries = function(text) {
@@ -102,7 +106,7 @@ var pw = (function() {
             },
             dataset: {
                 ajax: true,
-                ajaxUrl: '/api/1.0/projects/' + ctx.project + '/series/',
+                ajaxUrl: url,
                 ajaxOnLoad: true,
                 records: []
             }
-- 
2.1.0



More information about the Patchwork mailing list