Fix filter-list behavior with a class flag

This commit is contained in:
redref
2017-01-31 16:19:30 +01:00
parent 347749c0e1
commit 17f902c18f
4 changed files with 31 additions and 42 deletions

View File

@@ -1,11 +1,9 @@
$ = jQuery
$ ->
$('input.filter-list').parent('div').removeClass('hide')
$("input.filter-list").on "keyup", (e) ->
rex = new RegExp($(this).val(), "i")
$(".searchable li").hide()
$(".searchable li").parent().parent().hide()
$(".searchable li").parent().parent('.list_hide_segment').hide()
$(".searchable li").filter( ->
rex.test $(this).text()
).show()

View File

@@ -4,15 +4,11 @@
$ = jQuery;
$(function() {});
$('input.filter-list').parent('div').removeClass('hide');
$("input.filter-list").on("keyup", function(e) {
var ev, rex;
rex = new RegExp($(this).val(), "i");
$(".searchable li").hide();
$(".searchable li").parent().parent().hide();
$(".searchable li").parent().parent('.list_hide_segment').hide();
$(".searchable li").filter(function() {
return rex.test($(this).text());
}).show();

View File

@@ -1,29 +1,29 @@
{% extends 'layout.html' %}
{% block content %}
<div class="ui fluid icon input hide" style="margin-bottom:20px">
<div class="ui fluid icon input" style="margin-bottom:20px">
<input autofocus="autofocus" class="filter-list" placeholder="Type here to filter...">
</div>
<div class="ui searchable stackable doubling four column grid factlist">
<div class="column">
{%- set facts_count = 0 -%}
{%- set break = facts_len//4 + 1 -%}
{%- for key,facts_list in facts_dict %}
<div class="ui segment">
<a class="ui darkblue ribbon label">{{key}}</a>
<ul>
{%- for fact in facts_list %}
<li><a href="{{url_for('fact', env=current_env, fact=fact)}}">{{fact}}</a></li>
{%- endfor %}
</ul>
</div>
{%- set facts_count = facts_count + facts_list|length -%}
{%- if facts_count >= break -%}
</div>
<div class="column">
{%- set break = facts_len//4 + 1 + break -%}
{%- endif -%}
{%- set facts_count = facts_count + 5 -%}
{% endfor %}
</div>
<div class="column">
{%- set facts_count = 0 -%}
{%- set break = facts_len//4 + 1 -%}
{%- for key,facts_list in facts_dict %}
<div class="ui list_hide_segment segment">
<a class="ui darkblue ribbon label">{{key}}</a>
<ul>
{%- for fact in facts_list %}
<li><a href="{{url_for('fact', env=current_env, fact=fact)}}">{{fact}}</a></li>
{%- endfor %}
</ul>
</div>
{%- set facts_count = facts_count + facts_list|length -%}
{%- if facts_count >= break -%}
</div>
<div class="column">
{%- set break = facts_len//4 + 1 + break -%}
{%- endif -%}
{%- set facts_count = facts_count + 5 -%}
{% endfor %}
</div>
</div>
{% endblock content %}

View File

@@ -1,19 +1,14 @@
{% extends 'layout.html' %}
{% block content %}
<h1>Metrics</h1>
<div class="ui fluid icon input hide" style="margin-bottom:20px">
<input autofocus="autofocus" class="filter-table" placeholder="Type here to filter...">
<div class="ui fluid icon input" style="margin-bottom:20px">
<input autofocus="autofocus" class="filter-list" placeholder="Type here to filter...">
</div>
<table class='ui very compact very basic sortable table'>
<thead>
<tr>Metric</tr>
</thead>
<tbody class="searchable">
<ul class="ui list searchable">
{% for metric in metrics %}
<tr>
<td><a href="{{url_for('metric', env=current_env, metric=metric)}}">{{metric}}</a></td>
</tr>
<li>
<a href="{{url_for('metric', env=current_env, metric=metric)}}">{{metric}}</a>
</li>
{% endfor %}
</tbody>
</table>
</ul>
{% endblock content %}