Commit 3594c180 authored by Leo Iannacone's avatar Leo Iannacone

Merge remote-tracking branch 'github/master' into portable

parents 22211452 4c623dc1
...@@ -96,7 +96,7 @@ function Page_Distrubion(socket) { ...@@ -96,7 +96,7 @@ function Page_Distrubion(socket) {
debug(2, 'scrolling page down - height', height); debug(2, 'scrolling page down - height', height);
$('html,body').animate({ $('html,body').animate({
scrollTop: height scrollTop: height
}, 0); }, delay);
}, },
up: function (delay) { up: function (delay) {
if (delay === undefined) if (delay === undefined)
...@@ -169,6 +169,14 @@ function Page_Distrubion(socket) { ...@@ -169,6 +169,14 @@ function Page_Distrubion(socket) {
'<span class="version">' + p.version + '</span></a></li>'); '<span class="version">' + p.version + '</span></a></li>');
view.packages[p.orig_name] = Utils.clone(p); view.packages[p.orig_name] = Utils.clone(p);
}); });
// on double click set search value to package name, in other words
// on double click show only that package
$('#packages ul li').on('dblclick', function (event) {
var name = $(this).find('.name').html();
debug(1, 'double click - selecting:', name);
$('#packages .search .text').val(name);
$('#packages .search .text').keyup();
});
packages.select(); packages.select();
} else { } else {
$('#packages ul').append('<li class="text-muted">No packages yet</li>'); $('#packages ul').append('<li class="text-muted">No packages yet</li>');
...@@ -178,7 +186,7 @@ function Page_Distrubion(socket) { ...@@ -178,7 +186,7 @@ function Page_Distrubion(socket) {
}, },
clean: function () { clean: function () {
$('#packages ul').html(''); $('#packages ul').html('');
$('#packages .search').val(''); $('#packages .search .text').val('');
}, },
get: function () { get: function () {
if (Utils.check_view_distribution(view)) { if (Utils.check_view_distribution(view)) {
...@@ -224,18 +232,18 @@ function Page_Distrubion(socket) { ...@@ -224,18 +232,18 @@ function Page_Distrubion(socket) {
}, },
search: function (token) { search: function (token) {
if (!token) if (!token)
token = $("#packages .search").val(); token = $('#packages .search .text').val();
if (!token) { if (!token) {
debug(2, "packages search token empty - showing all"); debug(2, 'packages search token empty - showing all');
$("#packages li").show(); $('#packages li').show();
} else { } else {
$("#packages li").not('.active').each(function (index) { $('#packages li').not('.active').each(function (index) {
var p_name = $(this).find('a span.name').text(); var p_name = $(this).find('a span.name').text();
if (p_name.indexOf(token) < 0) { if (p_name.indexOf(token) < 0) {
debug(2, "packages search token:", token, "hiding:", this); debug(2, 'packages search token:', token, 'hiding:', this);
$(this).hide(); $(this).hide();
} else { } else {
debug(2, "packages search token:", token, "showing:", this); debug(2, 'packages search token:', token, 'showing:', this);
$(this).show(); $(this).show();
} }
}); });
...@@ -728,9 +736,15 @@ function Page_Distrubion(socket) { ...@@ -728,9 +736,15 @@ function Page_Distrubion(socket) {
watch_for_new_lines(); watch_for_new_lines();
// Handle search packages // Handle search packages
$('#packages .search').on('keyup', function (event) { $('#packages .search .text').on('keyup', function (event) {
packages.search($(event.target).val()); packages.search($(event.target).val());
}); });
$('#packages .search .reset').on('click', function (event) {
debug(1, 'packages search reset');
$('#packages .search .text').val('');
$('#packages .search .text').keyup();
});
// Update html according with preferences // Update html according with preferences
preferences(); preferences();
......
...@@ -13,7 +13,12 @@ ...@@ -13,7 +13,12 @@
<aside id="sidebar" class="col-md-3"> <aside id="sidebar" class="col-md-3">
<nav id="packages"> <nav id="packages">
<h2>Packages</h2> <h2>Packages</h2>
<input type="text" class="form-control search" placeholder="Search"> <div class="input-group search">
<input type="text" class="form-control text" placeholder="Search">
<span class="input-group-btn">
<a class="btn btn-default reset"><span class="glyphicon glyphicon-remove-sign"></span></a>
</span>
</div>
<ul class="nav nav-pills nav-stacked"></ul> <ul class="nav nav-pills nav-stacked"></ul>
</nav> </nav>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment