macros.html 1.6 KB

123456789101112131415161718192021222324252627282930
  1. <!-- Draw glyphicon icon from bootstrap-theme -->
  2. {% macro icon(action) -%}
  3. <span class="glyphicon glyphicon-{{ action }}"></span>
  4. {%- endmacro %}
  5. <!-- Draw favicon -->
  6. <!-- TODO: using url_for methode -->
  7. {% macro draw_favicon(favicon) -%}
  8. <img width="32" height="32" class="favicon" src="static/themes/oscar/img/icons/{{ favicon }}.png" alt="{{ favicon }}" />
  9. {%- endmacro %}
  10. <!-- Draw result header -->
  11. {% macro result_header(result, favicons) -%}
  12. <h4 class="result_header">{% if result.engine~".png" in favicons %}{{ draw_favicon(result.engine) }} {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
  13. {%- endmacro %}
  14. <!-- Draw result sub header -->
  15. {% macro result_sub_header(result) -%}
  16. {% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
  17. <small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
  18. {% if result.magnetlink %}<small> &bull; <a href="{{ result.magnetlink }}" class="magnetlink">{{ icon('magnet') }} {{ _('magnet link') }}</a></small>{% endif %}
  19. {% if result.torrentfile %}<small> &bull; <a href="{{ result.torrentfile }}" class="torrentfile">{{ icon('download-alt') }} {{ _('torrent file') }}</a></small>{% endif %}
  20. {%- endmacro %}
  21. <!-- Draw result footer -->
  22. {% macro result_footer(result) -%}
  23. <div class="clearfix"></div>
  24. <span class="label label-default pull-right">{{ result.engine }}</span>
  25. <p class="text-muted">{{ result.pretty_url }}</p>
  26. {%- endmacro %}