Skip to content

Commit

Permalink
Added server key filter input and buttom on sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmwason committed Apr 17, 2014
1 parent 57bdedc commit d08677a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ text-decoration: underline;

#keys {
position: fixed;
top: 15.5em;
top: 18.5em;
bottom: 0;
width: 24em;
padding-bottom: 1em;
Expand Down
8 changes: 8 additions & 0 deletions includes/common.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@
$server['filter'] = '*';
}

// filter from GET param
if (isset($_GET['filter']) && $_GET['filter'] != '') {
$server['filter'] = $_GET['filter'];
if (strpos($server['filter'], '*') === false) {
$server['filter'].= '*';
}
}

if (!isset($server['seperator'])) {
$server['seperator'] = $config['seperator'];
}
Expand Down
5 changes: 5 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ function print_namespace($item, $name, $fullkey, $islast) {
<a href="?edit&amp;s=<?php echo $server['id']?>" class="add">Add another key</a>
</p>

<p>
<input type="text" id="server_filter" size="14" value="<?php echo format_html($server['filter']); ?>" placeholder="type here to server filter" class="info">
<button id="btn_server_filter">Filter!</button>
</p>

<p>
<input type="text" id="filter" size="24" value="type here to filter" placeholder="type here to filter" class="info">
</p>
Expand Down
12 changes: 11 additions & 1 deletion js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $(function() {
href += '.php';
}
}

if (href.indexOf('flush.php') == 0) {
if (confirm('Are you sure you want to delete this key and all it\'s values?')) {
$.ajax({
Expand Down Expand Up @@ -69,6 +69,16 @@ $(function() {
$(this).parent().addClass('current');
});

$('#btn_server_filter').click(function() {
var filter = $('#server_filter').val();
location.href = top.location.pathname + '?overview&s=' + $('#server').val() + '&filter=' + filter;
});

$('#server_filter').keydown(function(e){
if (e.keyCode == 13) {
$('#btn_server_filter').click();
}
});

$('#filter').focus(function() {
if ($(this).hasClass('info')) {
Expand Down

0 comments on commit d08677a

Please sign in to comment.