diff mbox

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

Message ID 1441986924-26689-42-git-send-email-damien.lespiau@intel.com
State Superseded
Headers show

Commit Message

Damien Lespiau Sept. 11, 2015, 3:55 p.m. UTC
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@intel.com>
---
 htdocs/js/patchwork.js | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff mbox

Patch

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: []
             }