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

[tor-commits] [atlas/master] Makes numbers in Guard and Exit column clickable (Fixes: #24402)



commit e50d28c45c8f6a3018dd6c1e802e511e34dcd28e
Author: Iain R. Learmonth <irl@xxxxxxxx>
Date:   Sun Nov 26 14:36:29 2017 +0000

    Makes numbers in Guard and Exit column clickable (Fixes: #24402)
---
 js/views/aggregate/search.js    |  4 ++--
 templates/aggregate/search.html | 20 +++++++++++++++++---
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/js/views/aggregate/search.js b/js/views/aggregate/search.js
index d189908..b3eeaeb 100644
--- a/js/views/aggregate/search.js
+++ b/js/views/aggregate/search.js
@@ -11,7 +11,7 @@ define([
   'bootstrap',
   'datatablesbs'
 ], function($, _, Backbone, aggregatesCollection, aggregateSearchTemplate){
-  var doCountriesView = Backbone.View.extend({
+  var aggregateSearchView = Backbone.View.extend({
     el: "#content",
     initialize: function() {
       this.collection = new aggregatesCollection;
@@ -42,6 +42,6 @@ define([
       this.$el.html(compiledTemplate({aggregates: null, error: this.error, countries: null}));
     }
   });
-  return new doCountriesView;
+  return new aggregateSearchView;
 });
 
diff --git a/templates/aggregate/search.html b/templates/aggregate/search.html
index 34db02c..5c3973c 100644
--- a/templates/aggregate/search.html
+++ b/templates/aggregate/search.html
@@ -83,9 +83,23 @@
     <td data-order="<%= aggregate.guard_probability %>"><%= (aggregate.guard_probability * 100).toFixed(4) %>%</td>
     <td data-order="<%= aggregate.middle_probability %>"><%= (aggregate.middle_probability * 100).toFixed(4) %>%</td>
     <td data-order="<%= aggregate.exit_probability %>"><%= (aggregate.exit_probability * 100).toFixed(4) %>%</td>
-    <td><%= aggregate.relays %></td>
-    <td><%= aggregate.guards %></td>
-    <td><%= aggregate.exits %></td>
+    <td>
+      <a href="#search/<% if ((typeof aggregate.as) == "string" && query.indexOf("as:") == -1) { %>as:<%= aggregate.as %> <% } if ((typeof aggregate.country) == "string" && query.indexOf("country:") == -1) { %>country:<%= aggregate.country  %> <% } %><%= (query) ? query + " " : "" %>"><%= aggregate.relays %></a></td>
+    </td>
+    <td>
+      <% if (aggregate.guards > 0) { %>
+        <a href="#search/<% if ((typeof aggregate.as) == "string" && query.indexOf("as:") == -1) { %>as:<%= aggregate.as %> <% } if ((typeof aggregate.country) == "string" && query.indexOf("country:") == -1) { %>country:<%= aggregate.country  %> <% } %><%= (query) ? query + " " : "" %><% if (query.indexOf("flag:") == -1) { %>flag:guard<% } %>"><%= aggregate.guards %></a></td>
+      <% } else { %>
+        0
+      <% } %>
+    </td>
+    <td>
+      <% if (aggregate.exits > 0) { %>
+        <a href="#search/<% if ((typeof aggregate.as) == "string" && query.indexOf("as:") == -1) { %>as:<%= aggregate.as %> <% } if ((typeof aggregate.country) == "string" && query.indexOf("country:") == -1) { %>country:<%= aggregate.country  %> <% } %><%= (query) ? query + " " : "" %><% if (query.indexOf("flag:") == -1) { %>flag:exit<% } %>"><%= aggregate.exits %></a></td>
+      <% } else { %>
+        0
+      <% } %>
+    </td>
   </tr>
 <% }); %>
 </tbody>



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