initial commit of the new template 'oscar'

* base.html mostly implemented
* stats.html implemented
* about.html implemented
* most of preferences.html implemented
* using bootstrap.js
This commit is contained in:
Thomas Pointhuber 2014-09-22 22:42:29 +02:00
parent 5d7b63223f
commit c21a907cac
28 changed files with 376 additions and 0 deletions

Binary file not shown.

BIN
searx/static/oscar/css/bootstrap.min.css vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,19 @@
/* Sticky footer styles
-------------------------------------------------- */
html {
position: relative;
min-height: 100%;
}
body {
/* Margin bottom by footer height */
margin-bottom: 80px;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
/* Set the fixed height of the footer here */
height: 40px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

BIN
searx/static/oscar/js/bootstrap.min.js vendored Normal file

Binary file not shown.

BIN
searx/static/oscar/js/html5shiv.min.js vendored Normal file

Binary file not shown.

Binary file not shown.

BIN
searx/static/oscar/js/respond.min.js vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,66 @@
{% extends "oscar/base.html" %}
{% block site_alert_warning_nojs %} {% endblock %}
{% block content %}
<div>
<h1>About <a href="{{ url_for('index') }}">searx</a></h1>
<p>Searx is a <a href="https://en.wikipedia.org/wiki/Metasearch_engine">metasearch engine</a>, aggregating the results of other <a href="{{ url_for('preferences') }}">search engines</a> while not storing information about its users.
</p>
<h2>Why use Searx?</h2>
<ul>
<li>Searx may not offer you as personalised results as Google, but it doesn't generate a profile about you</li>
<li>Searx doesn't care about what you search for, never shares anything with a third party, and it can't be used to compromise you</li>
<li>Searx is free software, the code is 100% open and you can help to make it better. See more on <a href="https://github.com/asciimoo/searx">github</a></li>
</ul>
<p>If you do care about privacy, want to be a conscious user, or otherwise believe
in digital freedom, make Searx your default search engine or run it on your own server</p>
<h2>Technical details - How does it work?</h2>
<p>Searx is a <a href="https://en.wikipedia.org/wiki/Metasearch_engine">metasearch engine</a>,
inspired by the <a href="http://seeks-project.info/">seeks project</a>.<br />
It provides basic privacy by mixing your queries with searches on other platforms without storing search data. Queries are made using a POST request on every browser (except chrome*). Therefore they show up in neither our logs, nor your url history. In case of Chrome* users there is an exception, Searx uses the search bar to perform GET requests.<br />
Searx can be added to your browser's search bar; moreover, it can be set as the default search engine.
</p>
<h2>How can I make it my own?</h2>
<p>Searx appreciates your concern regarding logs, so take the <a href="https://github.com/asciimoo/searx">code</a> and run it yourself! <br />Add your Searx to this <a href="https://github.com/asciimoo/searx/wiki/Searx-instances">list</a> to help other people reclaim their privacy and make the Internet freer!
<br />The more decentralized the Internet, is the more freedom we have!</p>
<h2>More about searx</h2>
<ul>
<li><a href="https://github.com/asciimoo/searx">github</a></li>
<li><a href="https://www.ohloh.net/p/searx/">ohloh</a></li>
<li><a href="https://twitter.com/Searx_engine">twitter</a></li>
<li>IRC: #searx @ freenode (<a href="https://kiwiirc.com/client/irc.freenode.com/searx">webclient</a>)</li>
<li><a href="https://www.transifex.com/projects/p/searx/">transifex</a></li>
</ul>
<hr />
<h2 id="faq">FAQ</h2>
<h3>How to add to firefox?</h3>
<p><a href="#" onclick="window.external.AddSearchProvider(window.location.protocol + '//' + window.location.host + '{{ url_for('opensearch') }}');">Install</a> searx as a search engine on any version of Firefox! (javascript required)</p>
<h2 id="dev_faq">Developer FAQ</h2>
<h3>New engines?</h3>
<ul>
<li>Edit your <a href="https://raw.github.com/asciimoo/searx/master/searx/settings.yml">settings.yml</a></li>
<li>Create your custom engine module, check the <a href="https://github.com/asciimoo/searx/blob/master/examples/basic_engine.py">example engine</a></li>
</ul>
<p>Don't forget to restart searx after config edit!</p>
<h3>Installation/WSGI support?</h3>
<p>See the <a href="https://github.com/asciimoo/searx/wiki/Installation">installation and setup</a> wiki page</p>
<h3>How to debug engines?</h3>
<p><a href="{{ url_for('stats') }}">Stats page</a> contains some useful data about the engines used.</p>
</div>
{% endblock %}

View File

@ -0,0 +1,65 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta charset="UTF-8" />
<meta name="description" content="Searx - a privacy-respecting, hackable metasearch engine" />
<meta name="keywords" content="searx, search, search engine, metasearch, meta search" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1 , maximum-scale=1.0, user-scalable=1" />
<title>{% block title %}{% endblock %}searx</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap.min.css') }}" type="text/css" />
<link rel="stylesheet" href="{{ url_for('static', filename='css/oscar.css') }}" type="text/css" />
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="{{ url_for('static', filename='js/html5shiv.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/respond.min.js') }}"></script>
<![endif]-->
<link rel="shortcut icon" href="{{ url_for('static', filename='img/favicon.png') }}" />
{% block styles %}
{% endblock %}
{% block head %}
{% endblock %}
<link title="searx" type="application/opensearchdescription+xml" rel="search" href="{{ url_for('opensearch') }}"/>
<script type="text/javascript">
searx = {};
searx.autocompleter = {% if autocomplete %}true{% else %}false{% endif %};
</script>
</head>
<body>
<div class="container">
{% include 'oscar/navbar.html' %}
{% block site_alert_error %}
{% endblock %}
{% block site_alert_warning %}
{% endblock %}
{% block site_alert_warning_nojs %}
<noscript>
<div class="alert alert-warning" role="alert">
<strong>{{ _('Warning!') }}</strong>
{{ _('Please enable JavaScript to use full functionality of this site.') }}
</div>
</noscript>
{% endblock %}
{% block content %}
{% endblock %}
</div>
<div class="footer">
<div class="container">
{% block footer %}
{% endblock %}
<p class="text-muted">Powered by <a href="https://github.com/asciimoo/searx">Searx</a> - a privacy-respecting, hackable metasearch engine</p>
</div>
</div>
<script src="{{ url_for('static', filename='js/jquery-1.11.1.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
</body>
</html>

View File

@ -0,0 +1,6 @@
{% extends "oscar/base.html" %}
{% block content %}
<div class="center">
<div class="title"><h1>searx</h1></div>
</div>
{% endblock %}

View File

@ -0,0 +1,21 @@
<!-- Static navbar -->
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="{{ url_for('index') }}">searx</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right"> <!-- results.html -->
<li{% if template_name == 'index.html' %} class="active"{% endif %}><a href="{{ url_for('index') }}" class="hmarg">{{ _('home') }}</a></li>
<li{% if template_name == 'about.html' %} class="active"{% endif %}><a href="{{ url_for('about') }}" class="hmarg">{{ _('about') }}</a></li>
<li{% if template_name == 'preferences.html' %} class="active"{% endif %}><a href="{{ url_for('preferences') }}" class="hmarg">{{ _('preferences') }}</a></li>
</ul>
</div><!--/.nav-collapse -->
</div><!--/.container-fluid -->
</div>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>searx</ShortName>
<Description>Search searx</Description>
<InputEncoding>UTF-8</InputEncoding>
<LongName>searx metasearch</LongName>
{% if opensearch_method == 'get' %}
<Url type="text/html" method="get" template="{{ host }}search?q={searchTerms}"/>
{% if autocomplete %}
<Url type="application/x-suggestions+json" method="get" template="{{ host }}autocompleter">
<Param name="format" value="x-suggestions" />
<Param name="q" value="{searchTerms}" />
</Url>
{% endif %}
{% else %}
<Url type="text/html" method="post" template="{{ host }}">
<Param name="q" value="{searchTerms}" />
</Url>
{% if autocomplete %}
<!-- TODO, POST REQUEST doesn't work -->
<Url type="application/x-suggestions+json" method="get" template="{{ host }}autocompleter">
<Param name="format" value="x-suggestions" />
<Param name="q" value="{searchTerms}" />
</Url>
{% endif %}
{% endif %}
</OpenSearchDescription>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Searx search: {{ q }}</title>
<link>{{ base_url }}?q={{ q }}</link>
<description>Search results for "{{ q }}" - searx</description>
<opensearch:totalResults>{{ number_of_results }}</opensearch:totalResults>
<opensearch:startIndex>1</opensearch:startIndex>
<opensearch:itemsPerPage>{{ number_of_results }}</opensearch:itemsPerPage>
<atom:link rel="search" type="application/opensearchdescription+xml" href="{{ base_url }}opensearch.xml"/>
<opensearch:Query role="request" searchTerms="{{ q }}" startPage="1" />
{% for r in results %}
<item>
<title>{{ r.title }}</title>
<link>{{ r.url }}</link>
<description>{{ r.content }}</description>
{% if r.pubdate %}<pubDate>{{ r.pubdate }}</pubDate>{% endif %}
</item>
{% endfor %}
</channel>
</rss>

View File

@ -0,0 +1,120 @@
{% extends "oscar/base.html" %}
{% block content %}
<div>
<h1>{{ _('Preferences') }}</h1>
<form method="post" action="{{ url_for('preferences') }}" id="search_form">
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist" style="margin-bottom:20px;">
<li class="active"><a href="#tab_general" role="tab" data-toggle="tab">{{ _('General') }}</a></li>
<li><a href="#tab_engine" role="tab" data-toggle="tab">{{ _('Engines') }}</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active" id="tab_general">
<fieldset>
<legend>{{ _('Default categories') }}</legend>
<p>
{% include 'default/categories.html' %}
</p>
</fieldset>
<fieldset>
<div class="container-fluid">
<div class="row form-group">
<label class="col-sm-3 col-md-2">{{ _('Search language') }}</label>
<div class="col-sm-4 col-md-4">
<select class="form-control" name='language'>
<option value="all" {% if current_language == 'all' %}selected="selected"{% endif %}>{{ _('Automatic') }}</option>
{% for lang_id,lang_name,country_name in language_codes %}
<option value="{{ lang_id }}" {% if lang_id == current_language %}selected="selected"{% endif %}>{{ lang_name }} ({{ country_name }}) - {{ lang_id }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="row form-group">
<label class="col-sm-3 col-md-2">{{ _('Interface language') }}</label>
<div class="col-sm-4 col-md-4">
<select class="form-control" name='locale'>
{% for locale_id,locale_name in locales.items() %}
<option value="{{ locale_id }}" {% if locale_id == current_locale %}selected="selected"{% endif %}>{{ locale_name }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="row form-group">
<label class="col-sm-3 col-md-2">{{ _('Autocomplete') }}</label>
<div class="col-sm-4 col-md-4">
<select class="form-control" name="autocomplete">
<option value=""> - </option>
{% for backend in autocomplete_backends %}
<option value="{{ backend }}" {% if backend == autocomplete %}selected="selected"{% endif %}>{{ backend }}</option>
{% endfor %}
</select>
</div>
<span class="col-sm-5 col-md-6 help-block">{{ _('Find stuff as you type') }}</span>
</div>
<div class="row form-group">
<label class="col-sm-3 col-md-2">{{ _('Method') }}</label>
<div class="col-sm-4 col-md-4">
<select class="form-control" name='method'>
<option value="POST" {% if method == 'POST' %}selected="selected"{% endif %}>POST</option>
<option value="GET" {% if method == 'GET' %}selected="selected"{% endif %}>GET</option>
</select>
</div>
<span class="col-sm-5 col-md-6 help-block">{{ _('Change how forms are submited, <a href="http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods" rel="external">learn more about request methods</a>') }}</span>
</div>
<div class="row form-group">
<label class="col-sm-3 col-md-2">{{ _('Themes') }}</label>
<div class="col-sm-4 col-md-4">
<select class="form-control" name="theme">
{% for name in themes %}
<option value="{{ name }}" {% if name == theme %}selected="selected"{% endif %}>{{ name }}</option>
{% endfor %}
</select>
</div>
<span class="col-sm-5 col-md-6 help-block">{{ _('Change searx layout') }}</span>
</div>
</div>
</fieldset>
</div>
<div class="tab-pane" id="tab_engine">
<fieldset>
{% for (categ,search_engines) in categs %}
<legend>{{ _(categ) }}</legend>
<div class="container-fluid">
{% for search_engine in search_engines %}
{% if not search_engine.private %}
<div class="row">
<div class="col-sm-4 col-md-4">{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})</div>
<div class="col-sm-4 col-md-4">
<div class="checkbox">
<input type="checkbox" id="engine_{{ categ }}_{{ search_engine.name|replace(' ', '_') }}" name="engine_{{ search_engine.name }}"{% if search_engine.name in blocked_engines %} checked="checked"{% endif %} />
<label class="allow btn btn-success" for="engine_{{ categ }}_{{ search_engine.name|replace(' ', '_') }}">{{ _('Allow') }}</label>
<label class="deny btn btn-danger" for="engine_{{ categ }}_{{ search_engine.name|replace(' ', '_') }}">{{ _('Block') }}</label>
</div>
</div>
</div>
{% endif %}
{% endfor %}
</div>
{% endfor %}
</fieldset>
</div>
</div>
<p class="text-muted" style="margin:20px 0;">{{ _('These settings are stored in your cookies, this allows us not to store this data about you.') }}
<br />
{{ _("These cookies serve your sole convenience, we don't use these cookies to track you.") }}
</p>
<input type="submit" class="btn btn-primary" value="{{ _('save') }}" />
<a href="{{ url_for('index') }}"><div class="btn btn-default">{{ _('back') }}</div></a>
</form>
</div>
{% endblock %}

View File

@ -0,0 +1,27 @@
{% extends "oscar/base.html" %}
{% block content %}
<div class="container-fluid">
<h1>{{ _('Engine stats') }}</h1>
<div class="row">
{% for stat_name,stat_category in stats %}
<div class="col-xs-12 col-sm-12 col-md-6">
<h3>{{ stat_name }}</h3>
<div class="container-fluid">
{% for engine in stat_category %}
<div class="row">
<div class="col-sm-4 col-md-4">{{ engine.name }}</div>
<div class="col-sm-8 col-md-8">
<div class="progress">
<div class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="{{ '%i'|format(engine.avg) }}" aria-valuemin="0" aria-valuemax="100" style="width: {{ engine.percentage }}%;">
{{ '%.02f'|format(engine.avg) }}
</div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
{% endfor %}
</div>
</div>
{% endblock %}

View File

@ -174,6 +174,8 @@ def render(template_name, override_theme=None, **kwargs):
kwargs['url_for'] = url_for_theme
kwargs['theme'] = get_current_theme_name(override=override_theme)
kwargs['template_name'] = template_name
return render_template(
'{}/{}'.format(kwargs['theme'], template_name), **kwargs)