From 25919de6084599c3196622ed1c89648b2c11f78a Mon Sep 17 00:00:00 2001 From: Thomas Pointhuber Date: Fri, 26 Sep 2014 22:43:54 +0200 Subject: [PATCH] oscar template: make the categories clickable --- searx/static/oscar/js/scripts.js | 31 ++++++++++++++++++++++++++ searx/templates/oscar/base.html | 1 + searx/templates/oscar/categories.html | 6 +++++ searx/templates/oscar/preferences.html | 19 +++++++--------- 4 files changed, 46 insertions(+), 11 deletions(-) create mode 100644 searx/static/oscar/js/scripts.js create mode 100644 searx/templates/oscar/categories.html diff --git a/searx/static/oscar/js/scripts.js b/searx/static/oscar/js/scripts.js new file mode 100644 index 000000000..1cef58896 --- /dev/null +++ b/searx/static/oscar/js/scripts.js @@ -0,0 +1,31 @@ +/** + _ _ _ +| |__ ___ ___ | |_ ___| |_ _ __ __ ___ __ +| '_ \ / _ \ / _ \| __/ __| __| '__/ _` \ \/ / +| |_) | (_) | (_) | |_\__ | |_| | | (_| |> < +|_.__/ \___/ \___/ \__|___/\__|_| \__,_/_/\_\.js + +*/ + +$(document).ready(function(){ + $('.btn-toggle .btn').click(function() { + var btnClass = 'btn-' + $(this).data('btn-class'); + var btnLabelDefault = $(this).data('btn-label-default'); + var btnLabelToggled = $(this).data('btn-label-toggled'); + if(btnLabelToggled != '') + { + if($(this).hasClass('btn-default')) + { + + var html = $(this).html().replace(btnLabelDefault, btnLabelToggled); + } + else + { + var html = $(this).html().replace(btnLabelToggled, btnLabelDefault); + } + $(this).html(html); + } + $(this).toggleClass(btnClass); + $(this).toggleClass('btn-default'); + }); +}); diff --git a/searx/templates/oscar/base.html b/searx/templates/oscar/base.html index c15d8f83c..22df11f00 100644 --- a/searx/templates/oscar/base.html +++ b/searx/templates/oscar/base.html @@ -61,5 +61,6 @@ + diff --git a/searx/templates/oscar/categories.html b/searx/templates/oscar/categories.html new file mode 100644 index 000000000..82ddcf686 --- /dev/null +++ b/searx/templates/oscar/categories.html @@ -0,0 +1,6 @@ +
+{% for category in categories %} + +{% endfor %} +
diff --git a/searx/templates/oscar/preferences.html b/searx/templates/oscar/preferences.html index 6803a02e5..3d66d1963 100644 --- a/searx/templates/oscar/preferences.html +++ b/searx/templates/oscar/preferences.html @@ -15,15 +15,14 @@
-
- {{ _('Default categories') }} -

- {% include 'default/categories.html' %} -

-
-
+
+ +
+ {% include 'oscar/categories.html' %} +
+
@@ -36,8 +35,6 @@
{{ _('What language do you prefer for search?') }}
- -
@@ -91,7 +88,7 @@ @@ -99,7 +96,7 @@
{% for (categ,search_engines) in categs %} -
+
{% for search_engine in search_engines %}