macros.html 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. </div>
  32. <div class="text-muted"><small>{{ result.pretty_url }}</small></div>
  33. {%- endmacro %}
  34. <!-- Draw result footer -->
  35. {% macro result_footer_rtl(result) -%}
  36. <div class="clearfix"></div>
  37. {% for engine in result.engines %}
  38. <span class="label label-default">{{ engine }}</span>
  39. {% endfor %}
  40. <small>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info") }}</small>
  41. <div class="text-muted"><small>{{ result.pretty_url }}</small></div>
  42. {%- endmacro %}
  43. {% macro preferences_item_header(info, label, rtl) -%}
  44. {% if rtl %}
  45. <div class="row form-group">
  46. <label class="col-sm-3 col-md-2 pull-right">{{ label }}</label>
  47. <span class="col-sm-5 col-md-6 help-block pull-left">{{ info }}</span>
  48. <div class="col-sm-4 col-md-4">
  49. {% else %}
  50. <div class="row form-group">
  51. <label class="col-sm-3 col-md-2">{{ label }}</label>
  52. <div class="col-sm-4 col-md-4">
  53. {% endif %}
  54. {%- endmacro %}
  55. {% macro preferences_item_footer(info, label, rtl) -%}
  56. {% if rtl %}
  57. </div>
  58. </div>
  59. {% else %}
  60. </div>
  61. <span class="col-sm-5 col-md-6 help-block">{{ info }}</span>
  62. </div>
  63. {% endif %}
  64. {%- endmacro %}
  65. {% macro checkbox_toggle(id, blocked) -%}
  66. <div class="onoffswitch">
  67. <input type="checkbox" id="{{ id }}" name="{{ id }}"{% if blocked %} checked="checked"{% endif %} class="onoffswitch-checkbox">
  68. <label class="onoffswitch-label" for="{{ id }}">
  69. <span class="onoffswitch-inner"></span>
  70. <span class="onoffswitch-switch"></span>
  71. </label>
  72. </div>
  73. {%- endmacro %}