From 3567bf2e0f43ffe41de438dc52452e0c514a3434 Mon Sep 17 00:00:00 2001 From: wes Date: Mon, 8 Aug 2016 18:01:44 -0400 Subject: [PATCH] loading thingy --- src/scripts/results.tag | 10 +++++++++- src/scripts/search.js | 2 +- src/scripts/search.tag | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) 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) {