summaryrefslogtreecommitdiff
path: root/searx/templates/oscar/macros.html
diff options
context:
space:
mode:
authorThomas Pointhuber <thomas.pointhuber@gmx.at>2014-12-22 16:07:02 +0100
committerThomas Pointhuber <thomas.pointhuber@gmx.at>2014-12-22 16:07:02 +0100
commitd810763107733cec017b8688c0350dff527f2ed1 (patch)
treed3c4a785aa4396982482b3ad810a955cc918a748 /searx/templates/oscar/macros.html
parent7b44fd47a72ab0c9a4c586193757a4f195bb5fe4 (diff)
[enh] remove repeating codeparts inside the oscar template
Diffstat (limited to 'searx/templates/oscar/macros.html')
-rw-r--r--searx/templates/oscar/macros.html25
1 files changed, 25 insertions, 0 deletions
diff --git a/searx/templates/oscar/macros.html b/searx/templates/oscar/macros.html
index f61de2015..1dc696341 100644
--- a/searx/templates/oscar/macros.html
+++ b/searx/templates/oscar/macros.html
@@ -1,3 +1,28 @@
+<!-- Draw glyphicon icon from bootstrap-theme -->
{% macro icon(action) -%}
<span class="glyphicon glyphicon-{{ action }}"></span>
{%- endmacro %}
+
+<!-- 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 }}" />
+{%- 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>
+{%- endmacro %}
+
+<!-- Draw result sub header -->
+{% macro result_sub_header(result) -%}
+ {% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
+ <small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
+{%- endmacro %}
+
+<!-- Draw result footer -->
+{% macro result_footer(result) -%}
+ <div class="clearfix"></div>
+ <span class="label label-default pull-right">{{ result.engine }}</span>
+ <p class="text-muted">{{ result.pretty_url }}</p>
+{%- endmacro %}