on master help sign in
oscar template: implement search input, index page,...
commita538bed745a688d17c98372785dd2c0644e6019b authorThomas Pointhuber <thomas.pointhuber@gmx.at> dateSat 27 Sep 2014, 10:23 (12 years ago) parentef1ead9
6 files changed+48−9
searx/static/oscar/img/searx.png searx/static/oscar/img/searx_logo.png searx/static/oscar/js/scripts.js+17−7 searx/templates/oscar/index.html+11−2 searx/templates/oscar/macros.html+3 searx/templates/oscar/search.html+17
searx/static/oscar/img/searx.pngdeleted

Binary file not shown.

searx/static/oscar/img/searx_logo.pngnew file

Binary file not shown.

searx/static/oscar/js/scripts.js+17−7
@@ -12,15 +12,11 @@ $(document).ready(function(){
1212 var btnClass = 'btn-' + $(this).data('btn-class');
1313 var btnLabelDefault = $(this).data('btn-label-default');
1414 var btnLabelToggled = $(this).data('btn-label-toggled');
15− if(btnLabelToggled != '')
16− {
17− if($(this).hasClass('btn-default'))
18− {
15+ if(btnLabelToggled != '') {
16+ if($(this).hasClass('btn-default')) {
1917
2018 var html = $(this).html().replace(btnLabelDefault, btnLabelToggled);
21− }
22− else
23− {
19+ } else {
2420 var html = $(this).html().replace(btnLabelToggled, btnLabelDefault);
2521 }
2622 $(this).html(html);
@@ -28,4 +24,18 @@ $(document).ready(function(){
2824 $(this).toggleClass(btnClass);
2925 $(this).toggleClass('btn-default');
3026 });
27+
28+ $('.btn-collapse').click(function() {
29+ var btnTextCollapsed = $(this).data('btn-text-collapsed');
30+ var btnTextNotCollapsed = $(this).data('btn-text-not-collapsed');
31+
32+ if(btnTextCollapsed != '' && btnTextNotCollapsed != '') {
33+ if($(this).hasClass('collapsed')) {
34+ var html = $(this).html().replace(btnTextCollapsed, btnTextNotCollapsed);
35+ } else {
36+ var html = $(this).html().replace(btnTextNotCollapsed, btnTextCollapsed);
37+ }
38+ $(this).html(html);
39+ }
40+ });
3141});
searx/templates/oscar/index.html+11−2
@@ -1,6 +1,15 @@
11{% extends "oscar/base.html" %}
22{% block content %}
3−<div class="center">
4− <div class="title"><h1>searx</h1></div>
3+<div class="container-fluid">
4+ <div class="row">
5+ <div class="text-center col-sm-12 col-md-12">
6+ <h1 class="text-hide center-block"><img class="center-block img-responsive" src="{{ url_for('static', filename='img/searx_logo.png') }}" alt="searx logo"/>searx</h1>
7+ </div>
8+ </div>
9+ <div class="row">
10+ <div class="text-center col-sm-12 col-md-12">
11+ {% include 'oscar/search.html' %}
12+ </div>
13+ </div>
514</div>
615{% endblock %}
searx/templates/oscar/macros.htmlnew file+3
@@ -0,0 +1,3 @@
1+{% macro icon(action) -%}
2+ <span class="glyphicon glyphicon-{{ action }}"></span>
3+{%- endmacro %}
searx/templates/oscar/search.htmlnew file+17
@@ -0,0 +1,17 @@
1+{% from 'oscar/macros.html' import icon %}
2+
3+<form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" id="search_form" role="search">
4+ <div class="input-group col-md-8 col-md-offset-2">
5+ <input type="search" name="q" class="form-control input-lg" id="q" placeholder="{{ _('Search for...') }}" autocomplete="off" value="{{ q }}">
6+ <span class="input-group-btn">
7+ <button type="submit" class="btn btn-default input-lg">{{ icon('search') }}<span class="sr-only">{{ _('Start search') }}</span></button>
8+ </span>
9+ </div>
10+
11+ <button type="button" class="btn btn-link btn-collapse center-block collapsed" data-toggle="collapse" data-target="#search_categories" data-btn-text-collapsed="{{ _('Show search filters') }}" data-btn-text-not-collapsed="{{ _('Hide search filters') }}">{{ _('Show search filters') }}</button>
12+ <div class="row collapse" id="search_categories">
13+ <div class="col-md-12 text-center">
14+ {% include 'oscar/categories.html' %}
15+ </div>
16+ </div><!-- / #search_categories -->
17+</form><!-- / #search_form_full -->