Merge branch 'Cqoicebordel-rtl'

This commit is contained in:
Adam Tauber 2015-02-10 15:28:14 +01:00
commit f8a5f7d675
28 changed files with 293 additions and 99 deletions

View File

@ -46,7 +46,9 @@ minimal: bin/buildout minimal.cfg setup.py
styles: styles:
@lessc -x searx/static/themes/default/less/style.less > searx/static/themes/default/css/style.css @lessc -x searx/static/themes/default/less/style.less > searx/static/themes/default/css/style.css
@lessc -x searx/static/themes/default/less/style-rtl.less > searx/static/themes/default/css/style-rtl.css
@lessc -x searx/static/themes/courgette/less/style.less > searx/static/themes/courgette/css/style.css @lessc -x searx/static/themes/courgette/less/style.less > searx/static/themes/courgette/css/style.css
@lessc -x searx/static/themes/courgette/less/style-rtl.less > searx/static/themes/courgette/css/style-rtl.css
@lessc -x searx/static/less/bootstrap/bootstrap.less > searx/static/css/bootstrap.min.css @lessc -x searx/static/less/bootstrap/bootstrap.less > searx/static/css/bootstrap.min.css
@lessc -x searx/static/themes/oscar/less/oscar/oscar.less > searx/static/themes/oscar/css/oscar.min.css @lessc -x searx/static/themes/oscar/less/oscar/oscar.less > searx/static/themes/oscar/css/oscar.min.css

View File

@ -0,0 +1 @@
.q{padding:.5em 1em .5em 3em}#search_submit{left:0;right:auto}.result .favicon{float:right;margin-left:.5em;margin-right:0}#sidebar{right:auto;left:0}#results{padding:0 32px 0 272px}.search.center{padding-right:0;padding-left:17em}.right{right:auto;left:0}#pagination form+form{float:left;margin-top:-2em}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,38 @@
.q {
padding: 0.5em 1em 0.5em 3em;
}
#search_submit {
left: 0;
right:auto;
}
.result .favicon {
float: right;
margin-left: 0.5em;
margin-right: 0;
}
#sidebar {
right: auto;
left: 0;
}
#results {
padding: 0px 32px 0px 272px;
}
.search.center {
padding-right: 0;
padding-left: 17em;
}
.right {
right: auto;
left: 0;
}
#pagination form + form {
float: left;
margin-top: -2em;
}

View File

@ -278,7 +278,7 @@ a {
} }
#preferences { #preferences {
background: url(../img/preference-icon.png) no-repeat right 0 / 12% auto; background: url("../img/preference-icon.png") no-repeat right center / 12% auto;
padding-right: 1.8em; padding-right: 1.8em;
} }

View File

@ -0,0 +1 @@
#search_submit{left:1px;right:auto}.result .favicon{float:right;margin-left:.5em;margin-right:0}

View File

@ -0,0 +1,11 @@
#search_submit {
left: 1px;
right:auto;
}
.result .favicon {
float: right;
margin-left: 0.5em;
margin-right: 0;
}

View File

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"{% if rtl %} dir="rtl"{% endif %}>
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="description" content="Searx - a privacy-respecting, hackable metasearch engine" /> <meta name="description" content="Searx - a privacy-respecting, hackable metasearch engine" />
@ -8,6 +8,9 @@
<meta name="viewport" content="width=device-width, maximum-scale=1.0, user-scalable=1" /> <meta name="viewport" content="width=device-width, maximum-scale=1.0, user-scalable=1" />
<title>{% block title %}{% endblock %}searx</title> <title>{% block title %}{% endblock %}searx</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css" media="screen" /> <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css" media="screen" />
{% if rtl %}
<link rel="stylesheet" href="{{ url_for('static', filename='css/style-rtl.css') }}" type="text/css" media="screen" />
{% endif %}
{% if cookies['courgette-color'] %} {% if cookies['courgette-color'] %}
<style type="text/css"> <style type="text/css">
{% include 'courgette/color.css' %} {% include 'courgette/color.css' %}

View File

@ -5,8 +5,13 @@
<div class="title"><h1>searx</h1></div> <div class="title"><h1>searx</h1></div>
{% include 'courgette/search.html' %} {% include 'courgette/search.html' %}
<p class="top_margin"> <p class="top_margin">
<a href="{{ url_for('about') }}" class="hmarg">{{ _('about') }}</a> {% if rtl %}
<a href="{{ url_for('preferences') }}" class="hmarg">{{ _('preferences') }}</a> <a href="{{ url_for('preferences') }}" class="hmarg">{{ _('preferences') }}</a>
{% endif %}
<a href="{{ url_for('about') }}" class="hmarg">{{ _('about') }}</a>
{% if not rtl %}
<a href="{{ url_for('preferences') }}" class="hmarg">{{ _('preferences') }}</a>
{% endif %}
</p> </p>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -106,7 +106,7 @@
{% if not search_engine.private %} {% if not search_engine.private %}
<tr> <tr>
<td>{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})</td> <td>{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})&lrm;</td>
<td>{{ _(categ) }}</td> <td>{{ _(categ) }}</td>
<td class="engine_checkbox"> <td class="engine_checkbox">
<input type="checkbox" id="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}" name="engine_{{ search_engine.name }}__{{ categ }}"{% if (search_engine.name, categ) in blocked_engines %} checked="checked"{% endif %} /> <input type="checkbox" id="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}" name="engine_{{ search_engine.name }}__{{ categ }}"{% if (search_engine.name, categ) in blocked_engines %} checked="checked"{% endif %} />

View File

@ -8,7 +8,6 @@
</div> </div>
<div id="results"> <div id="results">
<div id="sidebar"> <div id="sidebar">
<div id="search_url"> <div id="search_url">
{{ _('Search URL') }}: {{ _('Search URL') }}:
<input type="text" value="{{ base_url }}?q={{ q|urlencode }}&amp;pageno={{ pageno }}{% if selected_categories %}&amp;category_{{ selected_categories|join("&category_")|replace(' ','+') }}{% endif %}" readonly /> <input type="text" value="{{ base_url }}?q={{ q|urlencode }}&amp;pageno={{ pageno }}{% if selected_categories %}&amp;category_{{ selected_categories|join("&category_")|replace(' ','+') }}{% endif %}" readonly />

View File

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"{% if rtl %} dir="rtl"{% endif %}>
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="description" content="Searx - a privacy-respecting, hackable metasearch engine" /> <meta name="description" content="Searx - a privacy-respecting, hackable metasearch engine" />
@ -8,6 +8,9 @@
<meta name="viewport" content="width=device-width, maximum-scale=1.0, user-scalable=1" /> <meta name="viewport" content="width=device-width, maximum-scale=1.0, user-scalable=1" />
<title>{% block title %}{% endblock %}searx</title> <title>{% block title %}{% endblock %}searx</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css" media="screen" /> <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css" media="screen" />
{% if rtl %}
<link rel="stylesheet" href="{{ url_for('static', filename='css/style-rtl.css') }}" type="text/css" media="screen" />
{% endif %}
<link rel="shortcut icon" href="{{ url_for('static', filename='img/favicon.png') }}?v=2" /> <link rel="shortcut icon" href="{{ url_for('static', filename='img/favicon.png') }}?v=2" />
{% block styles %} {% block styles %}
{% endblock %} {% endblock %}

View File

@ -4,8 +4,13 @@
<div class="title"><h1>searx</h1></div> <div class="title"><h1>searx</h1></div>
{% include 'default/search.html' %} {% include 'default/search.html' %}
<p class="top_margin"> <p class="top_margin">
<a href="{{ url_for('about') }}" class="hmarg">{{ _('about') }}</a> {% if rtl %}
<a href="{{ url_for('preferences') }}" class="hmarg">{{ _('preferences') }}</a> <a href="{{ url_for('preferences') }}" class="hmarg">{{ _('preferences') }}</a>
{% endif %}
<a href="{{ url_for('about') }}" class="hmarg">{{ _('about') }}</a>
{% if not rtl %}
<a href="{{ url_for('preferences') }}" class="hmarg">{{ _('preferences') }}</a>
{% endif %}
</p> </p>
</div> </div>
{% include 'default/github_ribbon.html' %} {% include 'default/github_ribbon.html' %}

View File

@ -94,7 +94,7 @@
{% if not search_engine.private %} {% if not search_engine.private %}
<tr> <tr>
<td>{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})</td> <td>{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})&lrm;</td>
<td>{{ _(categ) }}</td> <td>{{ _(categ) }}</td>
<td class="engine_checkbox"> <td class="engine_checkbox">
<input type="checkbox" id="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}" name="engine_{{ search_engine.name }}__{{ categ }}"{% if (search_engine.name, categ) in blocked_engines %} checked="checked"{% endif %} /> <input type="checkbox" id="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}" name="engine_{{ search_engine.name }}__{{ categ }}"{% if (search_engine.name, categ) in blocked_engines %} checked="checked"{% endif %} />
@ -113,7 +113,7 @@
</p> </p>
<input type="submit" value="{{ _('save') }}" /> <input type="submit" value="{{ _('save') }}" />
<div class="right preferences_back"><a href="{{ url_for('index') }}">{{ _('back') }}</a></div> <div class="{% if rtl %}left{% else %}right{% endif %} preferences_back"><a href="{{ url_for('index') }}">{{ _('back') }}</a></div>
</form> </form>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -72,7 +72,7 @@
<div id="pagination"> <div id="pagination">
{% if pageno > 1 %} {% if pageno > 1 %}
<form method="{{ method or 'POST' }}" action="{{ url_for('index') }}"> <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}">
<div class="left"> <div class="{% if rtl %}right{% else %}left{% endif %}">
<input type="hidden" name="q" value="{{ q }}" /> <input type="hidden" name="q" value="{{ q }}" />
{% for category in selected_categories %} {% for category in selected_categories %}
<input type="hidden" name="category_{{ category }}" value="1"/> <input type="hidden" name="category_{{ category }}" value="1"/>
@ -83,7 +83,7 @@
</form> </form>
{% endif %} {% endif %}
<form method="{{ method or 'POST' }}" action="{{ url_for('index') }}"> <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}">
<div class="right"> <div class="{% if rtl %}left{% else %}right{% endif %}">
{% for category in selected_categories %} {% for category in selected_categories %}
<input type="hidden" name="category_{{ category }}" value="1"/> <input type="hidden" name="category_{{ category }}" value="1"/>
{% endfor %} {% endfor %}

View File

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"{% if rtl %} dir="rtl"{% endif %}>
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="description" content="Searx - a privacy-respecting, hackable metasearch engine" /> <meta name="description" content="Searx - a privacy-respecting, hackable metasearch engine" />

View File

@ -1,6 +1,16 @@
<!-- used if scripts are disabled --> <!-- used if scripts are disabled -->
<noscript> <noscript>
<div id="categories" class="btn-group btn-toggle"> <div id="categories" class="btn-group btn-toggle">
{% if rtl %}
{% for category in categories | reverse %}
<!--<div class="checkbox">-->
<input class="hidden" type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}_nojs" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} />
<label class="btn btn-sm btn-primary active label_hide_if_not_checked" for="checkbox_{{ category|replace(' ', '_') }}_nojs">{{ _(category) }}</label>
<label class="btn btn-sm btn-default label_hide_if_checked" for="checkbox_{{ category|replace(' ', '_') }}_nojs">{{ _(category) }}</label>
<!--</div>-->
{% if category in selected_categories %}<input class="hidden" type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}_dis_activation" name="category_{{ category }}" value="off" checked="checked"/>{% endif %}
{% endfor %}
{% else %}
{% for category in categories %} {% for category in categories %}
<!--<div class="checkbox">--> <!--<div class="checkbox">-->
<input class="hidden" type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}_nojs" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} /> <input class="hidden" type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}_nojs" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} />
@ -9,14 +19,24 @@
<!--</div>--> <!--</div>-->
{% if category in selected_categories %}<input class="hidden" type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}_dis_activation" name="category_{{ category }}" value="off" checked="checked"/>{% endif %} {% if category in selected_categories %}<input class="hidden" type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}_dis_activation" name="category_{{ category }}" value="off" checked="checked"/>{% endif %}
{% endfor %} {% endfor %}
{% endif %}
</div> </div>
</noscript> </noscript>
<div id="categories" class="btn-group btn-toggle hide_if_nojs" data-toggle="buttons"> <div id="categories" class="btn-group btn-toggle hide_if_nojs" data-toggle="buttons">
{% if rtl %}
{% for category in categories | reverse %}
<label class="btn btn-sm {% if category in selected_categories %}btn-primary active{% else %}btn-default{% endif %}" data-btn-class="primary">
<input class="hidden" type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} />{{ _(category) }}
</label>
{% endfor %}
{% else %}
{% for category in categories %} {% for category in categories %}
<label class="btn btn-sm {% if category in selected_categories %}btn-primary active{% else %}btn-default{% endif %}" data-btn-class="primary"> <label class="btn btn-sm {% if category in selected_categories %}btn-primary active{% else %}btn-default{% endif %}" data-btn-class="primary">
<input class="hidden" type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} />{{ _(category) }}</label> <input class="hidden" type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} />{{ _(category) }}
</label>
{% endfor %} {% endfor %}
{% endif %}
</div> </div>

View File

@ -28,3 +28,34 @@
<span class="label label-default pull-right">{{ result.engine }}</span> <span class="label label-default pull-right">{{ result.engine }}</span>
<p class="text-muted">{{ result.pretty_url }}</p> <p class="text-muted">{{ result.pretty_url }}</p>
{%- endmacro %} {%- endmacro %}
<!-- Draw result footer -->
{% macro result_footer_rtl(result) -%}
<div class="clearfix"></div>
<span class="label label-default pull-left">{{ result.engine }}</span>
<p class="text-muted">{{ result.pretty_url }}</p>
{%- endmacro %}
{% macro preferences_item_header(info, label) -%}
{% if not rtl %}
<div class="row form-group">
<label class="col-sm-3 col-md-2">{{ label }}</label>
<div class="col-sm-4 col-md-4">
{% else %}
<div class="row form-group">
<span class="col-sm-5 col-md-6 help-block">{{ info }}</span>
<div class="col-sm-4 col-md-4">
{% endif %}
{%- endmacro %}
{% macro preferences_item_footer(info, label) -%}
{% if not rtl %}
</div>
<span class="col-sm-5 col-md-6 help-block">{{ info }}</span>
</div>
{% else %}
</div>
<label class="col-sm-3 col-md-2">{{ label }}</label>
</div>
{% endif %}
{%- endmacro %}

View File

@ -1,6 +1,24 @@
<!-- Static navbar --> <!-- Static navbar -->
<div class="navbar navbar-default" role="navigation"> <div class="navbar navbar-default" role="navigation">
<div class="container-fluid"> <div class="container-fluid">
{% if rtl %}
<div class="navbar-collapse collapse navbar-left">
<ul class="nav navbar-nav navbar-left"> <!-- results.html -->
<li{% if template_name == 'preferences.html' %} class="active"{% endif %}><a href="{{ url_for('preferences') }}" class="hmarg">{{ _('preferences') }}</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 == 'index.html' %} class="active"{% endif %}><a href="{{ url_for('index') }}" class="hmarg">{{ _('home') }}</a></li>
</ul>
</div>
<div class="navbar-header navbar-right">
<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>
{% else %}
<div class="navbar-header"> <div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">{{ _('Toggle navigation') }}</span> <span class="sr-only">{{ _('Toggle navigation') }}</span>
@ -17,5 +35,6 @@
<li{% if template_name == 'preferences.html' %} class="active"{% endif %}><a href="{{ url_for('preferences') }}" class="hmarg">{{ _('preferences') }}</a></li> <li{% if template_name == 'preferences.html' %} class="active"{% endif %}><a href="{{ url_for('preferences') }}" class="hmarg">{{ _('preferences') }}</a></li>
</ul> </ul>
</div><!--/.nav-collapse --> </div><!--/.nav-collapse -->
{% endif %}
</div><!--/.container-fluid --> </div><!--/.container-fluid -->
</div> </div>

View File

@ -1,3 +1,4 @@
{% from 'oscar/macros.html' import preferences_item_header, preferences_item_header_rtl, preferences_item_footer, preferences_item_footer_rtl %}
{% extends "oscar/base.html" %} {% extends "oscar/base.html" %}
{% block title %}{{ _('preferences') }} - {% endblock %} {% block title %}{{ _('preferences') }} - {% endblock %}
{% block site_alert_warning_nojs %} {% block site_alert_warning_nojs %}
@ -12,7 +13,7 @@
<form method="post" action="{{ url_for('preferences') }}" id="search_form"> <form method="post" action="{{ url_for('preferences') }}" id="search_form">
<!-- Nav tabs --> <!-- Nav tabs -->
<ul class="nav nav-tabs hide_if_nojs" role="tablist" style="margin-bottom:20px;"> <ul class="nav nav-tabs nav-justified hide_if_nojs" role="tablist" style="margin-bottom:20px;">
<li class="active"><a href="#tab_general" role="tab" data-toggle="tab">{{ _('General') }}</a></li> <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> <li><a href="#tab_engine" role="tab" data-toggle="tab">{{ _('Engines') }}</a></li>
</ul> </ul>
@ -26,96 +27,94 @@
<fieldset> <fieldset>
<div class="container-fluid"> <div class="container-fluid">
<div class="row form-group"> <div class="row form-group">
{% if rtl %}
<div class="col-sm-11 col-md-10">
{% include 'oscar/categories.html' %}
</div>
<label class="col-sm-3 col-md-2">{{ _('Default categories') }}</label>
{% else %}
<label class="col-sm-3 col-md-2">{{ _('Default categories') }}</label> <label class="col-sm-3 col-md-2">{{ _('Default categories') }}</label>
<div class="col-sm-11 col-md-10"> <div class="col-sm-11 col-md-10">
{% include 'oscar/categories.html' %} {% include 'oscar/categories.html' %}
</div> </div>
{% endif %}
</div> </div>
<div class="row form-group"> {% set language_label = _('Search language') %}
<label class="col-sm-3 col-md-2">{{ _('Search language') }}</label> {% set language_info = _('What language do you prefer for search?') %}
<div class="col-sm-4 col-md-4"> {{ preferences_item_header(language_info, language_label) }}
<select class="form-control" name='language'> <select class="form-control" name='language'>
<option value="all" {% if current_language == 'all' %}selected="selected"{% endif %}>{{ _('Automatic') }}</option> <option value="all" {% if current_language == 'all' %}selected="selected"{% endif %}>{{ _('Automatic') }}</option>
{% for lang_id,lang_name,country_name in language_codes %} {% 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> <option value="{{ lang_id }}" {% if lang_id == current_language %}selected="selected"{% endif %}>{{ lang_name }} ({{ country_name }}) - {{ lang_id }}</option>
{% endfor %} {% endfor %}
</select> </select>
</div> {{ preferences_item_footer(language_info, language_label) }}
<span class="col-sm-5 col-md-6 help-block">{{ _('What language do you prefer for search?') }}</span>
</div> {% set locale_label = _('Interface language') %}
<div class="row form-group"> {% set locale_info = _('Change the language of the layout') %}
<label class="col-sm-3 col-md-2">{{ _('Interface language') }}</label> {{ preferences_item_header(locale_info, locale_label) }}
<div class="col-sm-4 col-md-4">
<select class="form-control" name='locale'> <select class="form-control" name='locale'>
{% for locale_id,locale_name in locales.items() %} {% for locale_id,locale_name in locales.items() %}
<option value="{{ locale_id }}" {% if locale_id == current_locale %}selected="selected"{% endif %}>{{ locale_name }}</option> <option value="{{ locale_id }}" {% if locale_id == current_locale %}selected="selected"{% endif %}>{{ locale_name }}</option>
{% endfor %} {% endfor %}
</select> </select>
</div> {{ preferences_item_footer(locale_info, locale_label) }}
<span class="col-sm-5 col-md-6 help-block">{{ _('Change the language of the layout') }}</span>
</div>
<div class="row form-group">
<label class="col-sm-3 col-md-2">{{ _('Autocomplete') }}</label>
<div class="col-sm-4 col-md-4">
{% set autocomplete_label = _('Autocomplete') %}
{% set autocomplete_info = _('Find stuff as you type') %}
{{ preferences_item_header(autocomplete_info, autocomplete_label) }}
<select class="form-control" name="autocomplete"> <select class="form-control" name="autocomplete">
<option value=""> - </option> <option value=""> - </option>
{% for backend in autocomplete_backends %} {% for backend in autocomplete_backends %}
<option value="{{ backend }}" {% if backend == autocomplete %}selected="selected"{% endif %}>{{ backend }}</option> <option value="{{ backend }}" {% if backend == autocomplete %}selected="selected"{% endif %}>{{ backend }}</option>
{% endfor %} {% endfor %}
</select> </select>
</div> {{ preferences_item_footer(autocomplete_info, autocomplete_label) }}
<span class="col-sm-5 col-md-6 help-block">{{ _('Find stuff as you type') }}</span>
</div> {% set image_proxy_label = _('Image proxy') %}
<div class="row form-group"> {% set image_proxy_info = _('Proxying image results through searx') %}
<label class="col-sm-3 col-md-2">{{ _('Image proxy') }}</label> {{ preferences_item_header(image_proxy_info, image_proxy_label) }}
<div class="col-sm-4 col-md-4">
<select class="form-control" name='image_proxy'> <select class="form-control" name='image_proxy'>
<option value="1" {% if image_proxy %}selected="selected"{% endif %}>{{ _('Enabled') }}</option> <option value="1" {% if image_proxy %}selected="selected"{% endif %}>{{ _('Enabled') }}</option>
<option value="" {% if not image_proxy %}selected="selected"{% endif %}>{{ _('Disabled')}}</option> <option value="" {% if not image_proxy %}selected="selected"{% endif %}>{{ _('Disabled')}}</option>
</select> </select>
</div> {{ preferences_item_footer(image_proxy_info, image_proxy_label) }}
<span class="col-sm-5 col-md-6 help-block">{{ _('Proxying image results through searx') }}</span>
</div> {% set method_label = _('Method') %}
<div class="row form-group"> {% set method_info = _('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>') %}
<label class="col-sm-3 col-md-2">{{ _('Method') }}</label> {{ preferences_item_header(method_info, method_label) }}
<div class="col-sm-4 col-md-4">
<select class="form-control" name='method'> <select class="form-control" name='method'>
<option value="POST" {% if method == 'POST' %}selected="selected"{% endif %}>POST</option> <option value="POST" {% if method == 'POST' %}selected="selected"{% endif %}>POST</option>
<option value="GET" {% if method == 'GET' %}selected="selected"{% endif %}>GET</option> <option value="GET" {% if method == 'GET' %}selected="selected"{% endif %}>GET</option>
</select> </select>
</div> {{ preferences_item_footer(method_info, method_label) }}
<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> {% set safesearch_label = _('SafeSearch') %}
<div class="row form-group"> {% set safesearch_info = _('Filter content') %}
<label class="col-sm-3 col-md-2">{{ _('SafeSearch') }}</label> {{ preferences_item_header(safesearch_info, safesearch_label) }}
<div class="col-sm-4 col-md-4">
<select class="form-control" name='safesearch'> <select class="form-control" name='safesearch'>
<option value="2" {% if safesearch == '2' %}selected="selected"{% endif %}>{{ _('Strict') }}</option> <option value="2" {% if safesearch == '2' %}selected="selected"{% endif %}>{{ _('Strict') }}</option>
<option value="1" {% if safesearch == '1' %}selected="selected"{% endif %}>{{ _('Moderate') }}</option> <option value="1" {% if safesearch == '1' %}selected="selected"{% endif %}>{{ _('Moderate') }}</option>
<option value="0" {% if safesearch == '0' %}selected="selected"{% endif %}>{{ _('None') }}</option> <option value="0" {% if safesearch == '0' %}selected="selected"{% endif %}>{{ _('None') }}</option>
</select> </select>
</div> {{ preferences_item_footer(safesearch_info, safesearch_label) }}
<span class="col-sm-5 col-md-6 help-block">{{ _('Filter explicite content') }}</span>
</div> {% set theme_label = _('Themes') %}
<div class="row form-group"> {% set theme_info = _('Change searx layout') %}
<label class="col-sm-3 col-md-2">{{ _('Themes') }}</label> {{ preferences_item_header(theme_info, theme_label) }}
<div class="col-sm-4 col-md-4">
<select class="form-control" name="theme"> <select class="form-control" name="theme">
{% for name in themes %} {% for name in themes %}
<option value="{{ name }}" {% if name == theme %}selected="selected"{% endif %}>{{ name }}</option> <option value="{{ name }}" {% if name == theme %}selected="selected"{% endif %}>{{ name }}</option>
{% endfor %} {% endfor %}
</select> </select>
</div> {{ preferences_item_footer(theme_info, theme_label) }}
<span class="col-sm-5 col-md-6 help-block">{{ _('Change searx layout') }}</span>
</div>
</div> </div>
</fieldset> </fieldset>
</div> </div>
<div class="tab-pane active_if_nojs" id="tab_engine"> <div class="tab-pane active_if_nojs" id="tab_engine">
<!-- Nav tabs --> <!-- Nav tabs -->
<ul class="nav nav-tabs hide_if_nojs" role="tablist" style="margin-bottom:20px;"> <ul class="nav nav-tabs nav-justified hide_if_nojs" role="tablist" style="margin-bottom:20px;">
{% for (categ,search_engines) in categs %} {% for (categ,search_engines) in categs %}
<li{% if loop.first %} class="active"{% endif %}><a href="#tab_engine_{{ categ|replace(' ', '_') }}" role="tab" data-toggle="tab">{{ _(categ) }}</a></li> <li{% if loop.first %} class="active"{% endif %}><a href="#tab_engine_{{ categ|replace(' ', '_') }}" role="tab" data-toggle="tab">{{ _(categ) }}</a></li>
{% endfor %} {% endfor %}
@ -136,7 +135,9 @@
{% for search_engine in search_engines %} {% for search_engine in search_engines %}
{% if not search_engine.private %} {% if not search_engine.private %}
<div class="row"> <div class="row">
{% if not rtl %}
<div class="col-xs-6 col-sm-4 col-md-4">{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})</div> <div class="col-xs-6 col-sm-4 col-md-4">{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})</div>
{% endif %}
<div class="col-xs-6 col-sm-4 col-md-4"> <div class="col-xs-6 col-sm-4 col-md-4">
<div class="checkbox"> <div class="checkbox">
<input class="hidden" type="checkbox" id="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}" name="engine_{{ search_engine.name }}__{{ categ }}"{% if (search_engine.name, categ) in blocked_engines %} checked="checked"{% endif %} /> <input class="hidden" type="checkbox" id="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}" name="engine_{{ search_engine.name }}__{{ categ }}"{% if (search_engine.name, categ) in blocked_engines %} checked="checked"{% endif %} />
@ -144,6 +145,9 @@
<label class="btn btn-danger label_hide_if_not_checked" for="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}">{{ _('Allow') }}</label> <label class="btn btn-danger label_hide_if_not_checked" for="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}">{{ _('Allow') }}</label>
</div> </div>
</div> </div>
{% if rtl %}
<div class="col-xs-6 col-sm-4 col-md-4">{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})&lrm;</div>
{% endif %}
</div> </div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
@ -154,7 +158,6 @@
</div> </div>
</div> </div>
</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.') }} <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 /> <br />
{{ _("These cookies serve your sole convenience, we don't use these cookies to track you.") }} {{ _("These cookies serve your sole convenience, we don't use these cookies to track you.") }}

View File

@ -1,4 +1,4 @@
{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, icon %} {% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %}
{{ result_header(result, favicons) }} {{ result_header(result, favicons) }}
{{ result_sub_header(result) }} {{ result_sub_header(result) }}
@ -9,4 +9,8 @@
{{ result.codelines|code_highlighter(result.code_language)|safe }} {{ result.codelines|code_highlighter(result.code_language)|safe }}
{% if rtl %}
{{ result_footer_rtl(result) }}
{% else %}
{{ result_footer(result) }} {{ result_footer(result) }}
{% endif %}

View File

@ -1,4 +1,4 @@
{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, icon %} {% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %}
{{ result_header(result, favicons) }} {{ result_header(result, favicons) }}
{{ result_sub_header(result) }} {{ result_sub_header(result) }}
@ -15,4 +15,8 @@
{% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %} {% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %}
{% if rtl %}
{{ result_footer_rtl(result) }}
{% else %}
{{ result_footer(result) }} {{ result_footer(result) }}
{% endif %}

View File

@ -1,4 +1,4 @@
{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, icon %} {% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %}
{{ result_header(result, favicons) }} {{ result_header(result, favicons) }}
{{ result_sub_header(result) }} {{ result_sub_header(result) }}
@ -65,4 +65,8 @@
</div> </div>
{% endif %} {% endif %}
{% if rtl %}
{{ result_footer_rtl(result) }}
{% else %}
{{ result_footer(result) }} {{ result_footer(result) }}
{% endif %}

View File

@ -1,4 +1,4 @@
{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, icon %} {% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %}
{{ result_header(result, favicons) }} {{ result_header(result, favicons) }}
{{ result_sub_header(result) }} {{ result_sub_header(result) }}
@ -18,4 +18,8 @@
</p> </p>
{% if rtl %}
{{ result_footer_rtl(result) }}
{% else %}
{{ result_footer(result) }} {{ result_footer(result) }}
{% endif %}

View File

@ -20,4 +20,8 @@
</div> </div>
</div> </div>
{% if rtl %}
{{ result_footer_rtl(result) }}
{% else %}
{{ result_footer(result) }} {{ result_footer(result) }}
{% endif %}

View File

@ -33,6 +33,27 @@
<div class="clearfix"></div> <div class="clearfix"></div>
{% if paging %} {% if paging %}
{% if rtl %}
<div id="pagination">
<div class="pull-left">
<form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
<input type="hidden" name="q" value="{{ q }}" />
{% for category in selected_categories %}<input type="hidden" name="category_{{ category }}" value="1"/>{% endfor %}
<input type="hidden" name="q" value="{{ q }}" />
<input type="hidden" name="pageno" value="{{ pageno+1 }}" />
<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-backward"></span> {{ _('next page') }}</button>
</form>
</div>
<div class="pull-right">
<form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
{% for category in selected_categories %}<input type="hidden" name="category_{{ category }}" value="1"/>{% endfor %}
<input type="hidden" name="pageno" value="{{ pageno-1 }}" />
<button type="submit" class="btn btn-default" {% if pageno == 1 %}disabled{% endif %}><span class="glyphicon glyphicon-forward"></span> {{ _('previous page') }}</button>
</form>
</div>
</div><!-- /#pagination -->
<div class="clearfix"></div>
{% else %}
<div id="pagination"> <div id="pagination">
<div class="pull-left"> <div class="pull-left">
<form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left"> <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
@ -53,6 +74,7 @@
</div><!-- /#pagination --> </div><!-- /#pagination -->
<div class="clearfix"></div> <div class="clearfix"></div>
{% endif %} {% endif %}
{% endif %}
</div><!-- /#main_results --> </div><!-- /#main_results -->
<div class="col-sm-4" id="sidebar_results"> <div class="col-sm-4" id="sidebar_results">

View File

@ -1,7 +1,11 @@
{% from 'oscar/macros.html' import icon %} {% from 'oscar/macros.html' import icon %}
<form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" id="search_form" role="search"> <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" id="search_form" role="search">
{% if rtl %}
<div class="input-group">
{% else %}
<div class="input-group col-md-8 col-md-offset-2"> <div class="input-group col-md-8 col-md-offset-2">
{% endif %}
<input type="search" name="q" class="form-control input-lg autofocus" id="q" placeholder="{{ _('Search for...') }}" autocomplete="off" value="{{ q }}"> <input type="search" name="q" class="form-control input-lg autofocus" id="q" placeholder="{{ _('Search for...') }}" autocomplete="off" value="{{ q }}">
<span class="input-group-btn"> <span class="input-group-btn">
<button type="submit" class="btn btn-default input-lg"><span class="hide_if_nojs">{{ icon('search') }}</span><span class="hidden active_if_nojs">{{ _('Start search') }}</span></button> <button type="submit" class="btn btn-default input-lg"><span class="hide_if_nojs">{{ icon('search') }}</span><span class="hidden active_if_nojs">{{ _('Start search') }}</span></button>

View File

@ -85,6 +85,9 @@ app.secret_key = settings['server']['secret_key']
babel = Babel(app) babel = Babel(app)
rtl_locales = ['ar', 'arc', 'bcc', 'bqi', 'ckb', 'dv', 'fa', 'glk', 'he',
'ku', 'mzn', 'pnb'', ''ps', 'sd', 'ug', 'ur', 'yi']
global_favicons = [] global_favicons = []
for indice, theme in enumerate(themes): for indice, theme in enumerate(themes):
global_favicons.append([]) global_favicons.append([])
@ -262,6 +265,9 @@ def render(template_name, override_theme=None, **kwargs):
if 'autocomplete' not in kwargs: if 'autocomplete' not in kwargs:
kwargs['autocomplete'] = autocomplete kwargs['autocomplete'] = autocomplete
if get_locale() in rtl_locales and 'rtl' not in kwargs:
kwargs['rtl'] = True
kwargs['searx_version'] = VERSION_STRING kwargs['searx_version'] = VERSION_STRING
kwargs['method'] = request.cookies.get('method', 'POST') kwargs['method'] = request.cookies.get('method', 'POST')
@ -396,6 +402,7 @@ def about():
"""Render about page""" """Render about page"""
return render( return render(
'about.html', 'about.html',
rtl=False,
) )