瀏覽代碼

Some RTL fixes

- Pull the suggestions to the right in oscar
- Add `‎` to a few places to print good url
- Always LTR code display
- Order pref label and info in pref for mobile view

And add `sort` for ui languages and languages to find them more easily.
Cqoicebordel 10 年之前
父節點
當前提交
77ba28cf50

+ 2
- 2
searx/templates/courgette/preferences.html 查看文件

@@ -14,7 +14,7 @@
14 14
         <p>
15 15
             <select name='language'>
16 16
                 <option value="all" {% if current_language == 'all' %}selected="selected"{% endif %}>{{ _('Automatic') }}</option>
17
-                {% for lang_id,lang_name,country_name in language_codes %}
17
+                {% for lang_id,lang_name,country_name in language_codes | sort(attribute=1) %}
18 18
                 <option value="{{ lang_id }}" {% if lang_id == current_language %}selected="selected"{% endif %}>{{ lang_name }} ({{ country_name }}) - {{ lang_id }}</option>
19 19
                 {% endfor %}
20 20
             </select>
@@ -24,7 +24,7 @@
24 24
         <legend>{{ _('Interface language') }}</legend>
25 25
         <p>
26 26
             <select name='locale'>
27
-                {% for locale_id,locale_name in locales.items() %}
27
+                {% for locale_id,locale_name in locales.items() | sort %}
28 28
                 <option value="{{ locale_id }}" {% if locale_id == current_locale %}selected="selected"{% endif %}>{{ locale_name }}</option>
29 29
                 {% endfor %}
30 30
             </select>

+ 3
- 1
searx/templates/courgette/result_templates/code.html 查看文件

@@ -3,7 +3,9 @@
3 3
     {% if result.publishedDate %}<span class="published_date">{{ result.publishedDate }}</span>{% endif %}
4 4
     <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>
5 5
     {% if result.repository %}<p class="content"><a href="{{ result.repository|safe }}">{{ result.repository }}</a></p>{% endif %}
6
+    <div dir="ltr">
6 7
     {{ result.codelines|code_highlighter(result.code_language)|safe }}
8
+	</div>
7 9
 
8
-    <p class="url">{{ result.pretty_url }}</p>
10
+    <p class="url">{{ result.pretty_url }}&lrm;</p>
9 11
 </div>

+ 1
- 1
searx/templates/courgette/result_templates/default.html 查看文件

@@ -8,6 +8,6 @@
8 8
         <h3 class="result_title"><a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
9 9
         {% if result.publishedDate %}<span class="published_date">{{ result.publishedDate }}</span>{% endif %}
10 10
         <p class="content">{% if result.content %}{{ result.content|safe }}<br />{% endif %}</p>
11
-        <p class="url">{{ result.pretty_url }}</p>
11
+        <p class="url">{{ result.pretty_url }}&lrm;</p>
12 12
     </div>
13 13
 </div>

+ 1
- 1
searx/templates/courgette/result_templates/map.html 查看文件

@@ -8,6 +8,6 @@
8 8
         <h3 class="result_title"><a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
9 9
         {% if result.publishedDate %}<span class="published_date">{{ result.publishedDate }}</span>{% endif %}
10 10
         <p class="content">{% if result.content %}{{ result.content|safe }}<br />{% endif %}</p>
11
-        <p class="url">{{ result.pretty_url }}</p>
11
+        <p class="url">{{ result.pretty_url }}&lrm;</p>
12 12
     </div>
13 13
 </div>

+ 1
- 1
searx/templates/courgette/result_templates/torrent.html 查看文件

@@ -9,5 +9,5 @@
9 9
         {% if result.magnetlink %}<a href="{{ result.magnetlink }}" class="magnetlink">{{ _('magnet link') }}</a>{% endif %} 
10 10
         {% if result.torrentfile %}<a href="{{ result.torrentfile }}" class="torrentfile">{{ _('torrent file') }}</a>{% endif %}
11 11
     </span>
12
-    <p class="url">{{ result.pretty_url }}</p>
12
+    <p class="url">{{ result.pretty_url }}&lrm;</p>
13 13
 </div>

+ 1
- 1
searx/templates/courgette/result_templates/videos.html 查看文件

@@ -6,5 +6,5 @@
6 6
     <h3 class="result_title"><a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
7 7
     {% if result.publishedDate %}<span class="published_date">{{ result.publishedDate }}</span><br />{% endif %}
8 8
     <a href="{{ result.url }}"><img width="400" src="{{ image_proxify(result.thumbnail) }}" title="{{ result.title|striptags }}" alt="{{ result.title|striptags }}"/></a>
9
-    <p class="url">{{ result.pretty_url }}</p>
9
+    <p class="url">{{ result.pretty_url }}&lrm;</p>
10 10
 </div>

+ 1
- 1
searx/templates/courgette/results.html 查看文件

@@ -13,7 +13,7 @@
13 13
             <input type="text" value="{{ base_url }}?q={{ q|urlencode }}&amp;pageno={{ pageno }}{% if selected_categories %}&amp;category_{{ selected_categories|join("&category_")|replace(' ','+') }}{% endif %}" readonly />
14 14
         </div>
15 15
         <div id="apis">
16
-            {{ _('Download results') }}
16
+            {{ _('Download results') }}<br />
17 17
             {% for output_type in ('csv', 'json', 'rss') %}
18 18
             <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}">
19 19
                 <div class="left">

+ 2
- 2
searx/templates/default/preferences.html 查看文件

@@ -15,7 +15,7 @@
15 15
         <p>
16 16
         <select name='language'>
17 17
             <option value="all" {% if current_language == 'all' %}selected="selected"{% endif %}>{{ _('Automatic') }}</option>
18
-            {% for lang_id,lang_name,country_name in language_codes %}
18
+            {% for lang_id,lang_name,country_name in language_codes | sort(attribute=1) %}
19 19
             <option value="{{ lang_id }}" {% if lang_id == current_language %}selected="selected"{% endif %}>{{ lang_name }} ({{ country_name }}) - {{ lang_id }}</option>
20 20
             {% endfor %}
21 21
         </select>
@@ -25,7 +25,7 @@
25 25
         <legend>{{ _('Interface language') }}</legend>
26 26
         <p>
27 27
         <select name='locale'>
28
-            {% for locale_id,locale_name in locales.items() %}
28
+            {% for locale_id,locale_name in locales.items() | sort %}
29 29
             <option value="{{ locale_id }}" {% if locale_id == current_locale %}selected="selected"{% endif %}>{{ locale_name }}</option>
30 30
             {% endfor %}
31 31
         </select>

+ 4
- 2
searx/templates/default/result_templates/code.html 查看文件

@@ -1,9 +1,11 @@
1 1
 <div class="result {{ result.class }}">
2 2
     <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>
3
-    <p class="url">{{ result.pretty_url }} <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}">{{ _('cached') }}</a></p>
3
+    <p class="url">{{ result.pretty_url }}&lrm; <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}">{{ _('cached') }}</a></p>
4 4
     {% if result.publishedDate %}<p class="published_date">{{ result.publishedDate }}</p>{% endif %}
5 5
     <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>
6 6
     {% if result.repository %}<p class="result-content"><a href="{{ result.repository|safe }}">{{ result.repository }}</a></p>{% endif %}
7
-
7
+    
8
+    <div dir="ltr">
8 9
     {{ result.codelines|code_highlighter(result.code_language)|safe }}
10
+	</div>
9 11
 </div>

+ 1
- 1
searx/templates/default/result_templates/default.html 查看文件

@@ -1,6 +1,6 @@
1 1
 <div class="result {{ result.class }}">
2 2
     <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>
3
-    <p class="url">{{ result.pretty_url }} <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}">{{ _('cached') }}</a>
3
+    <p class="url">{{ result.pretty_url }}&lrm; <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}">{{ _('cached') }}</a>
4 4
     {% if result.publishedDate %}<span class="published_date">{{ result.publishedDate }}</span>{% endif %}</p>
5 5
     <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>
6 6
 </div>

+ 1
- 1
searx/templates/default/result_templates/map.html 查看文件

@@ -6,7 +6,7 @@
6 6
 
7 7
     <div>
8 8
         <h3 class="result_title"><a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
9
-        <p class="url">{{ result.pretty_url }} <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}">{{ _('cached') }}</a>
9
+        <p class="url">{{ result.pretty_url }}&lrm; <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}">{{ _('cached') }}</a>
10 10
         {% if result.publishedDate %}<span class="published_date">{{ result.publishedDate }}</span>{% endif %}</p>
11 11
         <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>
12 12
     </div>

+ 1
- 1
searx/templates/default/result_templates/torrent.html 查看文件

@@ -3,7 +3,7 @@
3 3
     <img width="14" height="14" class="favicon" src="{{ url_for('static', filename='img/icons/icon_'+result.engine+'.ico') }}" alt="{{result.engine}}" />
4 4
   {% endif %}
5 5
     <h3 class="result_title"><a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
6
-    <p class="url">{{ result.pretty_url }}</p>
6
+    <p class="url">{{ result.pretty_url }}&lrm;</p>
7 7
     {% if result.content %}<p class="content">{{ result.content|safe }}</p>{% endif %}
8 8
     <p>
9 9
         {% if result.magnetlink %}<a href="{{ result.magnetlink }}" class="magnetlink">{{ _('magnet link') }}</a>{% endif %} 

+ 1
- 1
searx/templates/default/result_templates/videos.html 查看文件

@@ -2,5 +2,5 @@
2 2
     <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>
3 3
     {% if result.publishedDate %}<span class="published_date">{{ result.publishedDate }}</span><br />{% endif %}
4 4
     <a href="{{ result.url }}"><img class="thumbnail" src="{{ image_proxify(result.thumbnail) }}" title="{{ result.title|striptags }}" alt="{{ result.title|striptags }}"/></a>
5
-    <p class="url">{{ result.url }}</p>
5
+    <p class="url">{{ result.url }}&lrm;</p>
6 6
 </div>

+ 3
- 3
searx/templates/oscar/macros.html 查看文件

@@ -33,13 +33,14 @@
33 33
 {% macro result_footer_rtl(result) -%}
34 34
     <div class="clearfix"></div>
35 35
     <span class="label label-default pull-left">{{ result.engine }}</span>
36
-    <p class="text-muted">{{ result.pretty_url }}</p>
36
+    <p class="text-muted">{{ result.pretty_url }}&lrm;</p>
37 37
 {%- endmacro %}
38 38
 
39 39
 {% macro preferences_item_header(info, label, rtl) -%}
40 40
     {% if rtl %}
41 41
     <div class="row form-group">
42
-        <span class="col-sm-5 col-md-6 help-block">{{ info }}</span>
42
+        <label class="col-sm-3 col-md-2 pull-right">{{ label }}</label>
43
+        <span class="col-sm-5 col-md-6 help-block pull-left">{{ info }}</span>
43 44
         <div class="col-sm-4 col-md-4">
44 45
     {% else %}
45 46
     <div class="row form-group">
@@ -51,7 +52,6 @@
51 52
 {% macro preferences_item_footer(info, label, rtl) -%}
52 53
     {% if rtl %}
53 54
         </div>
54
-        <label class="col-sm-3 col-md-2">{{ label }}</label>
55 55
     </div>
56 56
     {% else %}
57 57
         </div>

+ 2
- 2
searx/templates/oscar/preferences.html 查看文件

@@ -44,7 +44,7 @@
44 44
                 {{ preferences_item_header(language_info, language_label, rtl) }}
45 45
                     <select class="form-control" name='language'>
46 46
                         <option value="all" {% if current_language == 'all' %}selected="selected"{% endif %}>{{ _('Automatic') }}</option>
47
-                        {% for lang_id,lang_name,country_name in language_codes %}
47
+                        {% for lang_id,lang_name,country_name in language_codes | sort(attribute=1) %}
48 48
                         <option value="{{ lang_id }}" {% if lang_id == current_language %}selected="selected"{% endif %}>{{ lang_name }} ({{ country_name }}) - {{ lang_id }}</option>
49 49
                         {% endfor %}
50 50
                     </select>
@@ -54,7 +54,7 @@
54 54
                 {% set locale_info = _('Change the language of the layout') %}
55 55
                 {{ preferences_item_header(locale_info, locale_label, rtl) }}
56 56
                     <select class="form-control" name='locale'>
57
-                        {% for locale_id,locale_name in locales.items() %}
57
+                        {% for locale_id,locale_name in locales.items() | sort %}
58 58
                         <option value="{{ locale_id }}" {% if locale_id == current_locale %}selected="selected"{% endif %}>{{ locale_name }}</option>
59 59
                         {% endfor %}
60 60
                     </select>

+ 2
- 0
searx/templates/oscar/result_templates/code.html 查看文件

@@ -7,7 +7,9 @@
7 7
 
8 8
 {% if result.repository %}<p class="result-content">{{ icon('file') }} <a href="{{ result.repository|safe }}">{{ result.repository }}</a></p>{% endif %}
9 9
 
10
+<div dir="ltr">
10 11
 {{ result.codelines|code_highlighter(result.code_language)|safe }}
12
+</div>
11 13
 
12 14
 {% if rtl %}
13 15
 {{ result_footer_rtl(result) }}

+ 2
- 2
searx/templates/oscar/results.html 查看文件

@@ -91,7 +91,7 @@
91 91
                 </div>
92 92
                 <div class="panel-body">
93 93
                     {% for suggestion in suggestions %}
94
-                    <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" role="navigation" class="form-inline pull-left suggestion_item">
94
+                    <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" role="navigation" class="form-inline pull-{% if rtl %}right{% else %}left{% endif %} suggestion_item">
95 95
                         <input type="hidden" name="q" value="{{ suggestion }}">
96 96
                         <button type="submit" class="btn btn-default btn-xs">{{ suggestion }}</button>
97 97
                     </form>
@@ -115,7 +115,7 @@
115 115
                     <label>{{ _('Download results') }}</label>
116 116
                     <div class="clearfix"></div>
117 117
                     {% for output_type in ('csv', 'json', 'rss') %}
118
-                    <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="form-inline pull-left result_download">
118
+                    <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="form-inline pull-{% if rtl %}right{% else %}left{% endif %} result_download">
119 119
                         <input type="hidden" name="q" value="{{ q }}">
120 120
                         <input type="hidden" name="format" value="{{ output_type }}">
121 121
                         {% for category in selected_categories %}<input type="hidden" name="category_{{ category }}" value="1">{% endfor %}