diff --git a/src/scripts/results.tag b/src/scripts/results.tag index 99136aa..5f1d0d6 100644 --- a/src/scripts/results.tag +++ b/src/scripts/results.tag @@ -1,14 +1,22 @@ -
+
this.rows = []; var self = this; + +results_passer.on("loading", + function() { + self.notLoading = false; + self.update(); + }); + results_passer.on("new_results", function(data) { console.log("new search results detected"); console.log(data); self.rows = data; + self.notLoading = true; self.update(); }); diff --git a/src/scripts/search.js b/src/scripts/search.js index c553117..1acb7d4 100644 --- a/src/scripts/search.js +++ b/src/scripts/search.js @@ -49,7 +49,7 @@ function ResultsPasser() { var results_passer = new ResultsPasser(); riot.mount("search", {booksLoading : false}); -riot.mount("results"); +riot.mount("results", {notLoading : true}); function autocomplete(element, endpoint) { // The element should be an input class diff --git a/src/scripts/search.tag b/src/scripts/search.tag index acce2ca..d7cbe97 100644 --- a/src/scripts/search.tag +++ b/src/scripts/search.tag @@ -24,6 +24,7 @@ function submit(ev) { console.log("submitted"); this.booksLoading = true; this.update(); + results_passer.trigger("loading"); var params = $(ev.currentTarget).serialize(); $.getJSON("/search/fc?"+params, (function(courses) {