macros.html 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. {%- macro result_link(url, title, classes='') -%}
  11. <a href="{{ url }}" {% if classes %}class="{{ classes }}" {% endif %}{% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ title }}</a>
  12. {%- endmacro -%}
  13. <!-- Draw result header -->
  14. {% macro result_header(result, favicons) -%}
  15. <h4 class="result_header">{% if result.engine~".png" in favicons %}{{ draw_favicon(result.engine) }} {% endif %}{{ result_link(result.url, result.title|safe) }}</h4>
  16. {%- endmacro %}
  17. <!-- Draw result sub header -->
  18. {% macro result_sub_header(result) -%}
  19. {% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
  20. {% if result.magnetlink %}<small> &bull; {{ result_link(result.magnetlink, icon('magnet') + _('magnet link'), "magnetlink") }}</small>{% endif %}
  21. {% if result.torrentfile %}<small> &bull; {{ result_link(result.torrentfile, icon('download-alt') + _('torrent file'), "torrentfile") }}</small>{% endif %}
  22. {%- endmacro %}
  23. <!-- Draw result footer -->
  24. {% macro result_footer(result) -%}
  25. <div class="clearfix"></div>
  26. <div class="pull-right">
  27. {% for engine in result.engines %}
  28. <span class="label label-default">{{ engine }}</span>
  29. {% endfor %}
  30. <small>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info") }}</small>
  31. {% if proxify %}
  32. <small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info") }}</small>
  33. {% endif %}
  34. </div>
  35. <div class="external-link">{{ result.pretty_url }}</div>
  36. {%- endmacro %}
  37. <!-- Draw result footer -->
  38. {% macro result_footer_rtl(result) -%}
  39. <div class="clearfix"></div>
  40. {% for engine in result.engines %}
  41. <span class="label label-default">{{ engine }}</span>
  42. {% endfor %}
  43. <small>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info") }}</small>
  44. {% if proxify %}
  45. <small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info") }}</small>
  46. {% endif %}
  47. <div class="external-link">{{ result.pretty_url }}</div>
  48. {%- endmacro %}
  49. {% macro preferences_item_header(info, label, rtl) -%}
  50. {% if rtl %}
  51. <div class="row form-group">
  52. <label class="col-sm-3 col-md-2 pull-right">{{ label }}</label>
  53. <span class="col-sm-5 col-md-6 help-block pull-left">{{ info }}</span>
  54. <div class="col-sm-4 col-md-4">
  55. {% else %}
  56. <div class="row form-group">
  57. <label class="col-sm-3 col-md-2">{{ label }}</label>
  58. <div class="col-sm-4 col-md-4">
  59. {% endif %}
  60. {%- endmacro %}
  61. {% macro preferences_item_footer(info, label, rtl) -%}
  62. {% if rtl %}
  63. </div>
  64. </div>
  65. {% else %}
  66. </div>
  67. <span class="col-sm-5 col-md-6 help-block">{{ info }}</span>
  68. </div>
  69. {% endif %}
  70. {%- endmacro %}
  71. {% macro checkbox_toggle(id, blocked) -%}
  72. <div class="onoffswitch">
  73. <input type="checkbox" id="{{ id }}" name="{{ id }}"{% if blocked %} checked="checked"{% endif %} class="onoffswitch-checkbox">
  74. <label class="onoffswitch-label" for="{{ id }}">
  75. <span class="onoffswitch-inner"></span>
  76. <span class="onoffswitch-switch"></span>
  77. </label>
  78. </div>
  79. {%- endmacro %}