Commit 97d5e372 authored by Leo Iannacone's avatar Leo Iannacone

add reset packages search button

parent 654fe2b0
...@@ -174,8 +174,8 @@ function Page_Distrubion(socket) { ...@@ -174,8 +174,8 @@ function Page_Distrubion(socket) {
$('#packages ul li').on('dblclick', function (event) { $('#packages ul li').on('dblclick', function (event) {
var name = $(this).find('.name').html(); var name = $(this).find('.name').html();
debug(1, 'double click - selecting:', name); debug(1, 'double click - selecting:', name);
$('#packages .search').val(name); $('#packages .search .text').val(name);
$('#packages .search').keyup(); $('#packages .search .text').keyup();
}); });
packages.select(); packages.select();
} else { } else {
...@@ -186,7 +186,7 @@ function Page_Distrubion(socket) { ...@@ -186,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)) {
...@@ -232,7 +232,7 @@ function Page_Distrubion(socket) { ...@@ -232,7 +232,7 @@ 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();
...@@ -736,9 +736,15 @@ function Page_Distrubion(socket) { ...@@ -736,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