[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [atlas/master] Allow direct linking to the aggregated search form



commit c41cc88afafdda7e831656697cc5e358ca52a68c
Author: Iain R. Learmonth <irl@xxxxxxxx>
Date:   Sun Nov 26 14:16:39 2017 +0000

    Allow direct linking to the aggregated search form
---
 js/router.js               | 14 +++++++++++++-
 templates/search/main.html |  6 +++---
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/js/router.js b/js/router.js
index fed87ba..c22bcf9 100644
--- a/js/router.js
+++ b/js/router.js
@@ -18,7 +18,7 @@ define([
     	'search/': 'doSearch',
         'top10': 'showTopRelays',
         'toprelays': 'showTopRelays',
-        'aggregate(/:aType)(/:query)': 'aggregateSearch',
+        'aggregate/:aType(/:query)': 'aggregateSearch',
         'aggregate(/:aType)/': 'emptyAggregateSearch',
     	// Default
     	'*actions': 'defaultAction'
@@ -200,6 +200,18 @@ define([
 
         mainSearchView.render();
 
+        if (actions == "aggregate") {
+          $('.search').hide();
+          $('#aggregated-search-tab-content').fadeIn();
+          $('.search-tabs').removeClass('active');
+          $('#aggregated-search-tab').addClass('active');
+        } else {
+          $('.search').hide();
+          $('#main-search-tab-content').fadeIn();
+          $('.search-tabs').removeClass('active');
+          $('#main-search-tab').addClass('active');
+        }
+
         $(".progress").hide();
         $("#content").show();
     }
diff --git a/templates/search/main.html b/templates/search/main.html
index 14a4916..9c62548 100644
--- a/templates/search/main.html
+++ b/templates/search/main.html
@@ -1,6 +1,6 @@
 <ul class="nav nav-tabs">
-  <li id="main-search-tab" class="search-tabs active"><a onclick="$('.search').hide();$('#main-search-tab-content').fadeIn();$('.search-tabs').removeClass('active');$('#main-search-tab').addClass('active');">Simple Search</a></li>
-  <li id="aggregated-search-tab" class="search-tabs"><a onclick="$('.search').hide();$('#aggregated-search-tab-content').fadeIn();$('.search-tabs').removeClass('active');$('#aggregated-search-tab').addClass('active');">Aggregated Search</a></li>
+  <li id="main-search-tab" class="search-tabs active"><a href="#simple">Simple Search</a></li>
+  <li id="aggregated-search-tab" class="search-tabs"><a href="#aggregate">Aggregated Search</a></li>
 </ul>
 
 <div class="tab-content" id="search-tab-content">
@@ -27,7 +27,7 @@ do not include bridge data.</p>
   <form id="home-aggregate-search">
     <div class="input-group">
       <input class="search-query form-control" id="aggregated-query" placeholder="Query" type="text" autocorrect="off" autocapitalize="none">
-      <span class="input-group-btn"><button id="do-aggregate" class="btn btn-primary" type="button">Aggregated Search</button><button class="btn btn-secondary" type="button" id="do-full-aggregation">Entire Network</button></span>
+      <span class="input-group-btn"><button id="do-aggregate" class="btn btn-primary" type="button">Aggregate</button><button class="btn btn-secondary" type="button" id="do-full-aggregation">Entire Network</button></span>
     </div>
   </form>
   </div>



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits