From 072dbd95b14e359b205b6036a27750cb1a4feb73 Mon Sep 17 00:00:00 2001 From: Brad Date: Thu, 5 Jun 2014 16:31:12 -0700 Subject: [PATCH] added some simple search functionality to the repo list --- server/template/html/user_repos.html | 18 +++++++++++++++--- server/template/user_repos.amber | 19 ++++++++++++++++--- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/server/template/html/user_repos.html b/server/template/html/user_repos.html index 305c0fa86..60ea2d7c1 100644 --- a/server/template/html/user_repos.html +++ b/server/template/html/user_repos.html @@ -32,10 +32,10 @@
- +
-
{{range $repo := .Repos}}{{$__amber_5 := __amber_add "/" .Remote}}{{$__amber_6 := __amber_add $__amber_5 "/"}}{{$__amber_7 := __amber_add $__amber_6 .Owner}}{{$__amber_8 := __amber_add $__amber_7 "/"}}{{$__amber_9 := __amber_add $__amber_8 .Name}} - +
{{range $repo := .Repos}}{{$__amber_5 := __amber_add "/" .Host}}{{$__amber_6 := __amber_add $__amber_5 "/"}}{{$__amber_7 := __amber_add $__amber_6 .Owner}}{{$__amber_8 := __amber_add $__amber_7 "/"}}{{$__amber_9 := __amber_add $__amber_8 .Name}}{{$__amber_10 := __amber_add .Owner "/"}}{{$__amber_11 := __amber_add $__amber_10 .Name}} +

{{.Owner}} @@ -55,5 +55,17 @@ + + diff --git a/server/template/user_repos.amber b/server/template/user_repos.amber index 39545c716..5471a1cd4 100644 --- a/server/template/user_repos.amber +++ b/server/template/user_repos.amber @@ -11,10 +11,10 @@ block content i.fa.fa-rss section form.pure-form.search-form - input[type="search"][placeholder="Filter List"].pure-u-1 + input[type="search"][placeholder="Filter List"].pure-u-1#search div.repo-list each $repo in Repos - a.pure-g.repo-item[data-status=Active][href="/"+Remote+"/"+Owner+"/"+Name] + a.pure-g.repo-item.searchable[data-status=Active][href="/"+Host+"/"+Owner+"/"+Name][data-index=Owner+"/"+Name] div.pure-u-11-12 h2 span #{Owner} @@ -24,4 +24,17 @@ block content if Active span.repo-active On else - span.repo-inactive Off \ No newline at end of file + span.repo-inactive Off + +block append scripts + style#search_style + script[type="text/javascript"] + var searchStyle = document.getElementById('search_style'); + document.getElementById('search').addEventListener('input', function() { + if (!this.value) { + searchStyle.innerHTML = ""; + return; + } + // look ma, no indexOf! + searchStyle.innerHTML = ".searchable:not([data-index*=\"" + this.value + "\"]) { display: none; }"; + });