diff options
| author | Thomas Pointhuber <thomas.pointhuber@gmx.at> | 2015-01-09 21:25:13 +0100 |
|---|---|---|
| committer | Thomas Pointhuber <thomas.pointhuber@gmx.at> | 2015-01-09 21:30:09 +0100 |
| commit | 400b54191c590663f0cfe91045f70a5d9223aa19 (patch) | |
| tree | 08c71466ac8fbaf69872f114847baec762f5bd81 /searx/templates | |
| parent | af8dac93a8acff5042b7b399c38e348f0bdc32ad (diff) | |
| parent | c8be128e97479ea6c871c4b6fbf014fa8136e708 (diff) | |
Merge branch 'master' of https://github.com/asciimoo/searx into code_results
Conflicts:
searx/engines/searchcode_code.py
searx/engines/searchcode_doc.py
searx/static/oscar/js/searx.min.js
searx/templates/oscar/result_templates/default.html
searx/templates/oscar/result_templates/images.html
searx/templates/oscar/result_templates/map.html
searx/templates/oscar/result_templates/torrent.html
searx/templates/oscar/result_templates/videos.html
Diffstat (limited to 'searx/templates')
17 files changed, 56 insertions, 25 deletions
diff --git a/searx/templates/courgette/result_templates/default.html b/searx/templates/courgette/result_templates/default.html index 5a8a78198..710b0a8e7 100644 --- a/searx/templates/courgette/result_templates/default.html +++ b/searx/templates/courgette/result_templates/default.html @@ -1,7 +1,7 @@ <div class="result {{ result.class }}"> - {% if result['favicon'] %} - <img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result['favicon']}}.ico" alt="{{result['favicon']}}" /> + {% 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 %} <div> diff --git a/searx/templates/courgette/result_templates/map.html b/searx/templates/courgette/result_templates/map.html index 5a8a78198..4919954e0 100644 --- a/searx/templates/courgette/result_templates/map.html +++ b/searx/templates/courgette/result_templates/map.html @@ -1,7 +1,7 @@ <div class="result {{ result.class }}"> - {% if result['favicon'] %} - <img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result['favicon']}}.ico" alt="{{result['favicon']}}" /> + {% 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 %} <div> diff --git a/searx/templates/courgette/result_templates/videos.html b/searx/templates/courgette/result_templates/videos.html index c8d1a39b6..bb711caab 100644 --- a/searx/templates/courgette/result_templates/videos.html +++ b/searx/templates/courgette/result_templates/videos.html @@ -1,6 +1,6 @@ <div class="result"> - {% if result['favicon'] %} - <img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result['favicon']}}.ico" alt="{{result['favicon']}}" /> + {% 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 %} <h3 class="result_title"><a href="{{ result.url }}">{{ result.title|safe }}</a></h3> diff --git a/searx/templates/courgette/results.html b/searx/templates/courgette/results.html index 62bef8c90..8b5135c02 100644 --- a/searx/templates/courgette/results.html +++ b/searx/templates/courgette/results.html @@ -43,7 +43,7 @@ {% for result in results %} {% if result['template'] %} - {% include 'courgette/result_templates/'+result['template'] %} + {% include get_result_template('courgette', result['template']) %} {% else %} {% include 'courgette/result_templates/default.html' %} {% endif %} diff --git a/searx/templates/default/result_templates/default.html b/searx/templates/default/result_templates/default.html index c41c58fa1..85882e56a 100644 --- a/searx/templates/default/result_templates/default.html +++ b/searx/templates/default/result_templates/default.html @@ -1,5 +1,5 @@ <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> + <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> {% if result.publishedDate %}<p class="published_date">{{ result.publishedDate }}</p>{% endif %} <p class="content">{% if result.img_src %}<img src="{{ result.img_src }}" class="image" />{% endif %}{% if result.content %}{{ result.content|safe }}<br class="last"/>{% endif %}</p> diff --git a/searx/templates/default/result_templates/map.html b/searx/templates/default/result_templates/map.html index dccec7a53..d37c2f374 100644 --- a/searx/templates/default/result_templates/map.html +++ b/searx/templates/default/result_templates/map.html @@ -1,7 +1,7 @@ <div class="result {{ result.class }}"> - {% if result['favicon'] %} - <img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result['favicon']}}.ico" alt="{{result['favicon']}}" /> + {% 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 %} <div> diff --git a/searx/templates/default/result_templates/torrent.html b/searx/templates/default/result_templates/torrent.html index 5925f1313..4c79a0a39 100644 --- a/searx/templates/default/result_templates/torrent.html +++ b/searx/templates/default/result_templates/torrent.html @@ -1,4 +1,7 @@ <div class="result torrent_result"> + {% 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 %} <h3 class="result_title"><a href="{{ result.url }}">{{ result.title|safe }}</a></h3> <p class="url">{{ result.pretty_url }}</p> {% if result.content %}<p class="content">{{ result.content|safe }}</p>{% endif %} diff --git a/searx/templates/default/result_templates/videos.html b/searx/templates/default/result_templates/videos.html index 0a89a67aa..75f965c80 100644 --- a/searx/templates/default/result_templates/videos.html +++ b/searx/templates/default/result_templates/videos.html @@ -1,5 +1,5 @@ <div class="result"> - <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> + <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> {% if result.publishedDate %}<p class="published_date">{{ result.publishedDate }}</p>{% endif %} <a href="{{ result.url }}"><img class="thumbnail" src="{{ result.thumbnail }}" title="{{ result.title|striptags }}" alt="{{ result.title|striptags }}"/></a> <p class="url">{{ result.url }}</p> diff --git a/searx/templates/default/results.html b/searx/templates/default/results.html index 199eb1d96..822960593 100644 --- a/searx/templates/default/results.html +++ b/searx/templates/default/results.html @@ -59,7 +59,7 @@ {% for result in results %} {% if result['template'] %} - {% include 'default/result_templates/'+result['template'] %} + {% include get_result_template('default', result['template']) %} {% else %} {% include 'default/result_templates/default.html' %} {% endif %} diff --git a/searx/templates/oscar/macros.html b/searx/templates/oscar/macros.html index 1dc696341..df604707d 100644 --- a/searx/templates/oscar/macros.html +++ b/searx/templates/oscar/macros.html @@ -6,12 +6,12 @@ <!-- Draw favicon -->
<!-- TODO: using url_for methode -->
{% macro draw_favicon(favicon) -%}
- <img width="32" height="32" class="favicon" src="static/oscar/img/icons/{{ favicon }}.png" alt="{{ favicon }}" />
+ <img width="32" height="32" class="favicon" src="static/themes/oscar/img/icons/{{ favicon }}.png" alt="{{ favicon }}" />
{%- endmacro %}
<!-- Draw result header -->
-{% macro result_header(result) -%}
- <h4 class="result_header">{% if result.favicon %}{{ draw_favicon(result.favicon) }} {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
+{% macro result_header(result, favicons) -%}
+ <h4 class="result_header">{% if result.engine~".png" in favicons %}{{ draw_favicon(result.engine) }} {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
{%- endmacro %}
<!-- Draw result sub header -->
diff --git a/searx/templates/oscar/result_templates/code.html b/searx/templates/oscar/result_templates/code.html index 236834d0a..e608bb04f 100644 --- a/searx/templates/oscar/result_templates/code.html +++ b/searx/templates/oscar/result_templates/code.html @@ -1,6 +1,6 @@ {% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, icon %}
-{{ result_header(result) }}
+{{ result_header(result, favicons) }}
{{ result_sub_header(result) }}
{% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %}
diff --git a/searx/templates/oscar/result_templates/default.html b/searx/templates/oscar/result_templates/default.html index bc967f01e..0bba4cec3 100644 --- a/searx/templates/oscar/result_templates/default.html +++ b/searx/templates/oscar/result_templates/default.html @@ -1,8 +1,20 @@ -{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer %}
+{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, icon %}
-{{ result_header(result) }}
+{{ result_header(result, favicons) }}
{{ result_sub_header(result) }}
+{% if result.embedded %}
+ <small> • <a class="text-info btn-collapse collapsed cursor-pointer media-loader" data-toggle="collapse" data-target="#result-media-{{ index }}" data-btn-text-collapsed="{{ _('show media') }}" data-btn-text-not-collapsed="{{ _('hide media') }}">{{ icon('music') }} {{ _('show media') }}</a></small>
+{% endif %}
+
+{% if result.embedded %}
+<div id="result-media-{{ index }}" class="collapse">
+{% autoescape false %}
+ {{ result.embedded }}
+{% endautoescape %}
+</div>
+{% endif %}
+
{% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %}
{{ result_footer(result) }}
diff --git a/searx/templates/oscar/result_templates/images.html b/searx/templates/oscar/result_templates/images.html index 69c2e6fff..7ad4e2435 100644 --- a/searx/templates/oscar/result_templates/images.html +++ b/searx/templates/oscar/result_templates/images.html @@ -9,7 +9,7 @@ <div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
- <h4 class="modal-title">{% if result['favicon'] %}{{ draw_favicon(result['favicon']) }} {% endif %}{{ result.title|striptags }}</h4>
+ <h4 class="modal-title">{% if result.engine~".png" in favicons %}{{ draw_favicon(result.engine) }} {% endif %}{{ result.title|striptags }}</h4>
</div>
<div class="modal-body">
<img class="img-responsive center-block" src="{{ result.img_src }}" alt="{{ result.title }}">
diff --git a/searx/templates/oscar/result_templates/map.html b/searx/templates/oscar/result_templates/map.html index 6dfee52ba..3552d84f8 100644 --- a/searx/templates/oscar/result_templates/map.html +++ b/searx/templates/oscar/result_templates/map.html @@ -1,6 +1,6 @@ {% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, icon %}
-{{ result_header(result) }}
+{{ result_header(result, favicons) }}
{{ result_sub_header(result) }}
{% if (result.latitude and result.longitude) or result.boundingbox %}
diff --git a/searx/templates/oscar/result_templates/torrent.html b/searx/templates/oscar/result_templates/torrent.html index da745c7ab..9fec91f01 100644 --- a/searx/templates/oscar/result_templates/torrent.html +++ b/searx/templates/oscar/result_templates/torrent.html @@ -1,6 +1,6 @@ {% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, icon %}
-{{ result_header(result) }}
+{{ result_header(result, favicons) }}
{{ result_sub_header(result) }}
<p class="result-content">{{ icon('transfer') }} {{ _('Seeder') }} <span class="badge">{{ result.seed }}</span>, {{ _('Leecher') }} <span class="badge">{{ result.leech }}</span>
diff --git a/searx/templates/oscar/result_templates/videos.html b/searx/templates/oscar/result_templates/videos.html index 83d065e4c..709c7563f 100644 --- a/searx/templates/oscar/result_templates/videos.html +++ b/searx/templates/oscar/result_templates/videos.html @@ -1,11 +1,23 @@ -{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer %}
+{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, icon %}
-{{ result_header(result) }}
+{{ result_header(result, favicons) }}
{{ result_sub_header(result) }}
+{% if result.embedded %}
+ <small> • <a class="text-info btn-collapse collapsed cursor-pointer media-loader" data-toggle="collapse" data-target="#result-video-{{ index }}" data-btn-text-collapsed="{{ _('show video') }}" data-btn-text-not-collapsed="{{ _('hide video') }}">{{ icon('film') }} {{ _('show video') }}</a></small>
+{% endif %}
+
+{% if result.embedded %}
+<div id="result-video-{{ index }}" class="collapse">
+{% autoescape false %}
+ {{ result.embedded }}
+{% endautoescape %}
+</div>
+{% endif %}
+
<div class="container-fluid">
<div class="row">
- <img class="thumbnail col-xs-6 col-sm-4 col-md-4 result-content" src="{{ result.thumbnail|safe }}" alt="{{ result.title|urlencode }} {{ result['favicon'] }}" />
+ <a href="{{ result.url }}"><img class="thumbnail col-xs-6 col-sm-4 col-md-4 result-content" src="{{ result.thumbnail|safe }}" alt="{{ result.title|striptags }} {{ result.engine }}" /></a>
{% if result.content %}<p class="col-xs-12 col-sm-8 col-md-8 result-content">{{ result.content|safe }}</p>{% endif %}
</div>
</div>
diff --git a/searx/templates/oscar/results.html b/searx/templates/oscar/results.html index 69f8c9237..380947ca0 100644 --- a/searx/templates/oscar/results.html +++ b/searx/templates/oscar/results.html @@ -17,7 +17,11 @@ {% for result in results %}
<div class="result {% if result['template'] %}result-{{ result.template|replace('.html', '') }}{% else %}result-default{% endif %}">
{% set index = loop.index %}
- {% if result.template %}{% include 'oscar/result_templates/'+result['template'] %}{% else %}{% include 'oscar/result_templates/default.html' %}{% endif %}
+ {% if result.template %}
+ {% include get_result_template('oscar', result['template']) %}
+ {% else %}
+ {% include 'oscar/result_templates/default.html' %}
+ {% endif %}
</div>
{% endfor %}
|