[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [atlas/master] Go to the details page when there is one result
commit 95acc1b94935374f209d3c9d6b342a476437f6d1
Author: cypherpunks <cypherpunks@xxxxxxxxxxxxxx>
Date: Thu Mar 2 13:38:07 2017 +0000
Go to the details page when there is one result
Closes #15415.
---
js/router.js | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/js/router.js b/js/router.js
index 1253405..2c02dad 100644
--- a/js/router.js
+++ b/js/router.js
@@ -71,8 +71,16 @@ define([
doSearchView.collection.baseurl + this.hashFingerprints(query);
doSearchView.collection.lookup({
success: function(err){
- $("#content").show();
doSearchView.relays = doSearchView.collection.models;
+
+ // Redirect to the details page when there is exactly one
+ // search result.
+ if (doSearchView.relays.length == 1) {
+ document.location = "#details/" +
+ doSearchView.relays[0].fingerprint;
+ return;
+ }
+ $("#content").show();
doSearchView.error = err;
doSearchView.render(query);
$("#search-title").text(query);
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits