macros.html 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 }}" rel="noreferrer">{{ 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. {% if result.magnetlink %}<small> &bull; <a href="{{ result.magnetlink }}" class="magnetlink">{{ icon('magnet') }} {{ _('magnet link') }}</a></small>{% endif %}
  18. {% if result.torrentfile %}<small> &bull; <a href="{{ result.torrentfile }}" class="torrentfile" rel="noreferrer">{{ icon('download-alt') }} {{ _('torrent file') }}</a></small>{% endif %}
  19. {%- endmacro %}
  20. <!-- Draw result footer -->
  21. {% macro result_footer(result) -%}
  22. <div class="clearfix"></div>
  23. <div class="pull-right">
  24. {% for engine in result.engines %}
  25. <span class="label label-default">{{ engine }}</span>
  26. {% endfor %}
  27. <small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}" rel="noreferrer">{{ icon('link') }} {{ _('cached') }}</a></small>
  28. </div>
  29. <div class="text-muted"><small>{{ result.pretty_url }}</small></div>
  30. {%- endmacro %}
  31. <!-- Draw result footer -->
  32. {% macro result_footer_rtl(result) -%}
  33. <div class="clearfix"></div>
  34. {% for engine in result.engines %}
  35. <span class="label label-default">{{ engine }}</span>
  36. {% endfor %}
  37. <small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}" rel="noreferrer">{{ icon('link') }} {{ _('cached') }}</a></small>
  38. <div class="text-muted"><small>{{ result.pretty_url }}</small></div>
  39. {%- endmacro %}
  40. {% macro preferences_item_header(info, label, rtl) -%}
  41. {% if rtl %}
  42. <div class="row form-group">
  43. <label class="col-sm-3 col-md-2 pull-right">{{ label }}</label>
  44. <span class="col-sm-5 col-md-6 help-block pull-left">{{ info }}</span>
  45. <div class="col-sm-4 col-md-4">
  46. {% else %}
  47. <div class="row form-group">
  48. <label class="col-sm-3 col-md-2">{{ label }}</label>
  49. <div class="col-sm-4 col-md-4">
  50. {% endif %}
  51. {%- endmacro %}
  52. {% macro preferences_item_footer(info, label, rtl) -%}
  53. {% if rtl %}
  54. </div>
  55. </div>
  56. {% else %}
  57. </div>
  58. <span class="col-sm-5 col-md-6 help-block">{{ info }}</span>
  59. </div>
  60. {% endif %}
  61. {%- endmacro %}
  62. {% macro checkbox_toggle(id, blocked) -%}
  63. <div class="onoffswitch">
  64. <input type="checkbox" id="{{ id }}" name="{{ id }}"{% if blocked %} checked="checked"{% endif %} class="onoffswitch-checkbox">
  65. <label class="onoffswitch-label" for="{{ id }}">
  66. <span class="onoffswitch-inner"></span>
  67. <span class="onoffswitch-switch"></span>
  68. </label>
  69. </div>
  70. {%- endmacro %}