Commit 4a201cf1 authored by Leo Iannacone's avatar Leo Iannacone

on double click set search value to package name, in other words on double...

on double click set search value to package name, in other words on double click show only that package
parent 8ee5d4fb
...@@ -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').val(name);
$('#packages .search').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>');
...@@ -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').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();
} }
}); });
......
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