From 2b96b3e346a68d086568c8fc57c1df455105c062 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Tue, 14 Jan 2014 12:23:04 +0100 Subject: [PATCH] Filter menu items --- .../templates/catalogue/book_text.html | 2 +- .../templates/catalogue/tag_list_split.html | 16 ++++++-------- apps/wolnelektury_core/static/js/base.js | 21 +++++++++++++++++-- .../static/scss/book_text/body.scss | 6 ++++-- .../static/scss/main/header.scss | 8 +++---- 5 files changed, 33 insertions(+), 20 deletions(-) diff --git a/apps/catalogue/templates/catalogue/book_text.html b/apps/catalogue/templates/catalogue/book_text.html index e4ed91f5a..37a8a1ed2 100644 --- a/apps/catalogue/templates/catalogue/book_text.html +++ b/apps/catalogue/templates/catalogue/book_text.html @@ -9,7 +9,7 @@ {% block menu %}
  • - {{ book.pretty_title }} diff --git a/apps/catalogue/templates/catalogue/tag_list_split.html b/apps/catalogue/templates/catalogue/tag_list_split.html index 5dcf783cd..a26459c98 100644 --- a/apps/catalogue/templates/catalogue/tag_list_split.html +++ b/apps/catalogue/templates/catalogue/tag_list_split.html @@ -1,18 +1,14 @@ {% load i18n %} {% if books %} - +
    {{books|safe}}
    {% endif %} {% if pictures %} - +
    {{pictures|safe}}
    {% endif %} diff --git a/apps/wolnelektury_core/static/js/base.js b/apps/wolnelektury_core/static/js/base.js index 9ba5631fa..4b6c5d34e 100755 --- a/apps/wolnelektury_core/static/js/base.js +++ b/apps/wolnelektury_core/static/js/base.js @@ -77,7 +77,23 @@ dataType: "json", }).done(function(data) { $.each(data, function(index, value) { - $('#menu-' + index).html(value); + var $menuitem = $('#menu-' + index); + $menuitem.html(value); + var $minisearch = $(""); + $minisearch.keyup(function() { + var s = $(this).val().toLowerCase(); + if (s) { + $("li", $menuitem).each(function() { + if ($("a", this).text().toLowerCase().indexOf(s) != -1) + $(this).show(); + else $(this).hide(); + }); + } + else { + $("li", $menuitem).css("display", ""); + } + }); + $menuitem.prepend($minisearch); }); menu_loaded = true; }); @@ -93,7 +109,8 @@ if (p == $current) return; if (p.hasClass('hidden-box-trigger') - || p.hasClass('simple-toggler')) + || p.hasClass('simple-toggler') + || p.hasClass('mini-search')) return; p = p.parent(); } diff --git a/apps/wolnelektury_core/static/scss/book_text/body.scss b/apps/wolnelektury_core/static/scss/book_text/body.scss index 2f1710dbf..912d55b85 100644 --- a/apps/wolnelektury_core/static/scss/book_text/body.scss +++ b/apps/wolnelektury_core/static/scss/book_text/body.scss @@ -3,8 +3,6 @@ * Everything besides the menu. */ #big-pane { - display: flex; - flex-direction: row; justify-content: left; position: relative; @include min-screen($W_BOOK_TEXT_MAX) { @@ -105,6 +103,10 @@ } .with-other-text { + #big-pane { + display: flex; + flex-direction: row; + } #main-text, #other-text { @include right-without-themes; diff --git a/apps/wolnelektury_core/static/scss/main/header.scss b/apps/wolnelektury_core/static/scss/main/header.scss index 770e43bc0..63bd8677c 100755 --- a/apps/wolnelektury_core/static/scss/main/header.scss +++ b/apps/wolnelektury_core/static/scss/main/header.scss @@ -37,6 +37,8 @@ header#main { background-color: $header_bg; color: #bbb; + text-align:center; + @media screen and (min-width: 62.5em) { position: relative; @include size(height, 94px); @@ -51,15 +53,11 @@ header#main { #logo { display: block; @include size(height, 94px); - @include size(width, 94px); @media screen and (min-width: 24em) { + @include size(width, 173px); float: left; } - - img { - display: block; - } } #tagline { -- 2.20.1