accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [24/50] [abbrv] accumulo-website git commit: Fix downloads dropdown
Date Tue, 22 Nov 2016 19:38:42 GMT
Fix downloads dropdown

Worked with @mikewalch to figure out how to fix the dropdown.
Switched from bootstrap dropdown to more traditional form select box.


Project: http://git-wip-us.apache.org/repos/asf/accumulo-website/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo-website/commit/f6ec9891
Tree: http://git-wip-us.apache.org/repos/asf/accumulo-website/tree/f6ec9891
Diff: http://git-wip-us.apache.org/repos/asf/accumulo-website/diff/f6ec9891

Branch: refs/heads/master
Commit: f6ec98917170191becc97f76a2845e50a20497a4
Parents: 506b57c
Author: Christopher Tubbs <ctubbsii@apache.org>
Authored: Thu Oct 27 16:30:25 2016 -0400
Committer: Christopher Tubbs <ctubbsii@apache.org>
Committed: Thu Oct 27 16:30:25 2016 -0400

----------------------------------------------------------------------
 _layouts/skeleton.html |  2 +-
 downloads/index.md     | 61 ++++++++++++++++++++-------------------------
 2 files changed, 28 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo-website/blob/f6ec9891/_layouts/skeleton.html
----------------------------------------------------------------------
diff --git a/_layouts/skeleton.html b/_layouts/skeleton.html
index 209b543..e48db24 100644
--- a/_layouts/skeleton.html
+++ b/_layouts/skeleton.html
@@ -27,7 +27,7 @@
 
 <title>{% if page.title %}{{ page.title | escape }}{% else %}{{ site.title | escape
}}{% endif %}</title>
 
-<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
 <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script>
 <script type="text/javascript" src="https://cdn.datatables.net/v/bs-3.3.6/jqc-1.12.3/dt-1.10.12/datatables.min.js"></script>
 

http://git-wip-us.apache.org/repos/asf/accumulo-website/blob/f6ec9891/downloads/index.md
----------------------------------------------------------------------
diff --git a/downloads/index.md b/downloads/index.md
index 2735170..fb0964c 100644
--- a/downloads/index.md
+++ b/downloads/index.md
@@ -32,19 +32,6 @@ $( document ).ready(function() {
   }
 });
 
-var createSection = function(name, items, divider) {
-  var section = '';
-  if (divider == undefined) { divider = true; }
-  if (divider) {
-    section += '<li class="divider" <="" li=""> </li>';
-  }
-  section += '<li class="dropdown-header">' + name + '</li>';
-  for (var i = 0; i < items.length; i++) {
-    section += '<li><a href="#">' + items[i] + '</a></li>';
-  }
-  return section;
-};
-
 var updateLinks = function(mirror) {
   $('a[link-suffix]').each(function(i, obj) {
     $(obj).attr('href', mirror.replace(/\/+$/, "") + $(obj).attr('link-suffix'));
@@ -52,27 +39,33 @@ var updateLinks = function(mirror) {
 };
 
 var mirrorsCallback = function(json) {
-  var mirrorSelection = $("#mirror_selection");
-  var htmlContent =  '<span class="help-block">Select a mirror:</span>' +
-    '<div class="btn-group">' +
-      '<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">'
+
-        '<span data-bind="label">' + json.preferred + '</span>&nbsp;<span
class="caret">' +
-      '</button>' +
-      '<ul class="dropdown-menu">';
-
-  htmlContent += createSection("Preferred Mirror (based on location)", [ json.preferred ],
false);
-  htmlContent += createSection("HTTP Mirrors", json.http);
-  htmlContent += createSection("FTP Mirrors", json.ftp);
-  htmlContent += createSection("Backup Mirrors", json.backup);
-
-  htmlContent += '</ul></div>';
-  mirrorSelection.html(htmlContent);
-
-  $("#mirror_selection a").click(function(event) {
-      var target=$(event.target);
-      var mirror=target.text();
-      updateLinks(mirror);
-      target.closest('.btn-group').find('[data-bind="label"]').text(mirror).end();
+  var htmlContent = '<div class="row"><div class="col-md-3"><h5>Select
an Apache download mirror:</h5></div>' +
+    '<div class="col-md-5"><select class="form-control" id="apache-mirror-select">';
+  htmlContent += '<optgroup label="Preferred Mirror (based on location)">';
+  htmlContent += '<option selected="selected">' + json.preferred + '</option>';
+  htmlContent += '</optgroup>';
+  htmlContent += '<optgroup label="HTTP Mirrors">';
+  for (var i = 0; i < json.http.length; i++) {
+    htmlContent += '<option>' + json.http[i] + '</option>';
+  }
+  htmlContent += '</optgroup>';
+  htmlContent += '<optgroup label="FTP Mirrors">';
+  for (var i = 0; i < json.ftp.length; i++) {
+    htmlContent += '<option>' + json.ftp[i] + '</option>';
+  }
+  htmlContent += '</optgroup>';
+  htmlContent += '<optgroup label="Backup Mirrors">';
+  for (var i = 0; i < json.backup.length; i++) {
+    htmlContent += '<option>' + json.backup[i] + '</option>';
+  }
+  htmlContent += '</optgroup>';
+  htmlContent += '</select></div></div>';
+
+  $("#mirror_selection").html(htmlContent);
+
+  $( "#apache-mirror-select" ).change(function() {
+    var mirror = $("#apache-mirror-select option:selected").text();
+    updateLinks(mirror);
   });
 
   updateLinks(json.preferred);


Mime
View raw message