Browse Source

Merge pull request #227 from Cqoicebordel/rtl-fix

RTL-fixes
Adam Tauber 10 years ago
parent
commit
516105c570

+ 1 - 1
searx/static/themes/courgette/css/style-rtl.css

@@ -1 +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}
+.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}.engine-table{text-align:right}

+ 4 - 0
searx/static/themes/courgette/less/style-rtl.less

@@ -35,4 +35,8 @@
 #pagination form + form {
 	float: left;
 	margin-top: -2em;
+}
+
+.engine-table {
+	text-align:right;
 }

+ 1 - 1
searx/templates/courgette/about.html

@@ -1,7 +1,7 @@
 {% extends 'courgette/base.html' %}
 {% block content %}
 {% include 'courgette/github_ribbon.html' %}
-<div class="row">
+<div class="row"{% if rtl %} dir="ltr"{% endif %}>
     <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.

+ 1 - 1
searx/templates/courgette/preferences.html

@@ -95,7 +95,7 @@
     <fieldset>
         <legend>{{ _('Currently used search engines') }}</legend>
 
-        <table>
+        <table class="engine-table">
             <tr>
                 <th>{{ _('Engine name') }}</th>
                 <th>{{ _('Category') }}</th>

+ 1 - 1
searx/templates/default/about.html

@@ -1,7 +1,7 @@
 {% extends 'default/base.html' %}
 {% block content %}
 {% include 'default/github_ribbon.html' %}
-<div class="row">
+<div class="row"{% if rtl %} dir="ltr"{% endif %}>
     <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.

+ 1 - 1
searx/templates/default/result_templates/code.html

@@ -1,6 +1,6 @@
 <div class="result {{ result.class }}">
     <h3 class="result_title"> {% if result['favicon'] %}<img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result['favicon']}}.ico" alt="{{result['favicon']}}" />{% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
-    <p class="url">{{ result.pretty_url }} <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}">cached</a></p>
+    <p class="url">{{ result.pretty_url }} <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}">{{ _('cached') }}</a></p>
     {% if result.publishedDate %}<p class="published_date">{{ result.publishedDate }}</p>{% endif %}
     <p class="content">{% if result.img_src %}<img src="{{ image_proxify(result.img_src) }}" class="image" />{% endif %}{% if result.content %}{{ result.content|safe }}<br class="last"/>{% endif %}</p>
     {% if result.repository %}<p class="result-content"><a href="{{ result.repository|safe }}">{{ result.repository }}</a></p>{% endif %}

+ 1 - 1
searx/templates/default/result_templates/default.html

@@ -1,6 +1,6 @@
 <div class="result {{ result.class }}">
     <h3 class="result_title">{% if "icon_"~result.engine~".ico" in favicons %}<img width="14" height="14" class="favicon" src="{{ url_for('static', filename='img/icons/icon_'+result.engine+'.ico') }}" alt="{{result.engine}}" />{% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
-    <p class="url">{{ result.pretty_url }} <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}">cached</a>
+    <p class="url">{{ result.pretty_url }} <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}">{{ _('cached') }}</a>
     {% if result.publishedDate %}<span class="published_date">{{ result.publishedDate }}</span>{% endif %}</p>
     <p class="content">{% if result.img_src %}<img src="{{ image_proxify(result.img_src) }}" class="image" />{% endif %}{% if result.content %}{{ result.content|safe }}<br class="last"/>{% endif %}</p>
 </div>

+ 1 - 1
searx/templates/default/result_templates/map.html

@@ -6,7 +6,7 @@
 
     <div>
         <h3 class="result_title"><a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
-        <p class="url">{{ result.pretty_url }} <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}">cached</a>
+        <p class="url">{{ result.pretty_url }} <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}">{{ _('cached') }}</a>
         {% if result.publishedDate %}<span class="published_date">{{ result.publishedDate }}</span>{% endif %}</p>
         <p class="content">{% if result.img_src %}<img src="{{ image_proxify(result.img_src) }}" class="image" />{% endif %}{% if result.content %}{{ result.content|safe }}<br class="last"/>{% endif %}</p>
     </div>

+ 1 - 1
searx/templates/oscar/about.html

@@ -2,7 +2,7 @@
 {% block site_alert_warning_nojs %} {% endblock %}
 {% block title %}{{ _('about') }} - {% endblock %}
 {% block content %}
-<div>
+<div{% if rtl %} dir="ltr"{% endif %}>
     <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.

+ 8 - 8
searx/templates/oscar/macros.html

@@ -36,26 +36,26 @@
     <p class="text-muted">{{ result.pretty_url }}</p>
 {%- endmacro %}
 
-{% macro preferences_item_header(info, label) -%}
-    {% if not rtl %}
+{% macro preferences_item_header(info, label, rtl) -%}
+    {% if rtl %}
     <div class="row form-group">
-        <label class="col-sm-3 col-md-2">{{ label }}</label>
+        <span class="col-sm-5 col-md-6 help-block">{{ info }}</span>
         <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>
+        <label class="col-sm-3 col-md-2">{{ label }}</label>
         <div class="col-sm-4 col-md-4">
     {% endif %}
 {%- endmacro %}
 
-{% macro preferences_item_footer(info, label) -%}
-    {% if not rtl %}
+{% macro preferences_item_footer(info, label, rtl) -%}
+    {% if rtl %}
         </div>
-        <span class="col-sm-5 col-md-6 help-block">{{ info }}</span>
+        <label class="col-sm-3 col-md-2">{{ label }}</label>
     </div>
     {% else %}
         </div>
-        <label class="col-sm-3 col-md-2">{{ label }}</label>
+        <span class="col-sm-5 col-md-6 help-block">{{ info }}</span>
     </div>
     {% endif %}
 {%- endmacro %}

+ 14 - 14
searx/templates/oscar/preferences.html

@@ -41,73 +41,73 @@
                 </div>
                 {% set language_label = _('Search language') %}
                 {% set language_info = _('What language do you prefer for search?') %}
-                {{ preferences_item_header(language_info, language_label) }}
+                {{ preferences_item_header(language_info, language_label, rtl) }}
                     <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>
-                {{ preferences_item_footer(language_info, language_label) }}
+                {{ preferences_item_footer(language_info, language_label, rtl) }}
 
                 {% set locale_label = _('Interface language') %}
                 {% set locale_info = _('Change the language of the layout') %}
-                {{ preferences_item_header(locale_info, locale_label) }}
+                {{ preferences_item_header(locale_info, locale_label, rtl) }}
                     <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>
-                {{ preferences_item_footer(locale_info, locale_label) }}
+                {{ preferences_item_footer(locale_info, locale_label, rtl) }}
 
                 {% set autocomplete_label = _('Autocomplete') %}
                 {% set autocomplete_info = _('Find stuff as you type') %}
-                {{ preferences_item_header(autocomplete_info, autocomplete_label) }}
+                {{ preferences_item_header(autocomplete_info, autocomplete_label, rtl) }}
                     <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>
-                {{ preferences_item_footer(autocomplete_info, autocomplete_label) }}
+                {{ preferences_item_footer(autocomplete_info, autocomplete_label, rtl) }}
 
                 {% set image_proxy_label = _('Image proxy') %}
                 {% set image_proxy_info = _('Proxying image results through searx') %}
-                {{ preferences_item_header(image_proxy_info, image_proxy_label) }}
+                {{ preferences_item_header(image_proxy_info, image_proxy_label, rtl) }}
                     <select class="form-control" name='image_proxy'>
                         <option value="1" {% if image_proxy  %}selected="selected"{% endif %}>{{ _('Enabled') }}</option>
                         <option value="" {% if not image_proxy %}selected="selected"{% endif %}>{{ _('Disabled')}}</option>
                     </select>
-                {{ preferences_item_footer(image_proxy_info, image_proxy_label) }}
+                {{ preferences_item_footer(image_proxy_info, image_proxy_label, rtl) }}
 
                 {% set method_label = _('Method') %}
                 {% 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>') %}
-                {{ preferences_item_header(method_info, method_label) }}
+                {{ preferences_item_header(method_info, method_label, rtl) }}
                     <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>
-                {{ preferences_item_footer(method_info, method_label) }}
+                {{ preferences_item_footer(method_info, method_label, rtl) }}
 
                 {% set safesearch_label = _('SafeSearch') %}
                 {% set safesearch_info = _('Filter content') %}
-                {{ preferences_item_header(safesearch_info, safesearch_label) }}
+                {{ preferences_item_header(safesearch_info, safesearch_label, rtl) }}
                     <select class="form-control" name='safesearch'>
                         <option value="2" {% if safesearch == '2' %}selected="selected"{% endif %}>{{ _('Strict') }}</option>
                         <option value="1" {% if safesearch == '1' %}selected="selected"{% endif %}>{{ _('Moderate') }}</option>
                         <option value="0" {% if safesearch == '0' %}selected="selected"{% endif %}>{{ _('None') }}</option>
                     </select>
-                {{ preferences_item_footer(safesearch_info, safesearch_label) }}
+                {{ preferences_item_footer(safesearch_info, safesearch_label, rtl) }}
 
                 {% set theme_label = _('Themes') %}
                 {% set theme_info = _('Change searx layout') %}
-                {{ preferences_item_header(theme_info, theme_label) }}
+                {{ preferences_item_header(theme_info, theme_label, rtl) }}
                     <select class="form-control" name="theme">
                         {% for name in themes %}
                         <option value="{{ name }}" {% if name == theme %}selected="selected"{% endif %}>{{ name }}</option>
                         {% endfor %}
                     </select>
-                {{ preferences_item_footer(theme_info, theme_label) }}
+                {{ preferences_item_footer(theme_info, theme_label, rtl) }}
             </div>
             </fieldset>
         </div>

+ 1 - 1
searx/templates/oscar/result_templates/map.html

@@ -40,7 +40,7 @@
 {% endif %}
 
 {% if result.osm and (result.osm.type and result.osm.id) %}
-    <div class="row result-content collapse col-xs-12 col-sm-7 col-md-8" id="result-overpass-{{ index }}">
+    <div class="row result-content collapse col-xs-12 col-sm-7 col-md-8" id="result-overpass-{{ index }}"{% if rtl %} dir="ltr"{% endif %}>
         <div class="text-center" id="result-overpass-table-loading-{{ index }}"><img src="{{ url_for('static', filename='img/loader.gif') }}" alt="Loading ..."/></div>
         <table class="table table-striped table-condensed hidden" id="result-overpass-table-{{ index }}">
             <tr><th>key</th><th>value</th></tr>

+ 0 - 1
searx/webapp.py

@@ -412,7 +412,6 @@ def about():
     """Render about page"""
     return render(
         'about.html',
-        rtl=False,
     )