macros.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <!-- Draw glyphicon icon from bootstrap-theme -->
  2. {% macro icon(action) -%}
  3. <span class="glyphicon glyphicon-{{ action }}"></span>
  4. {%- endmacro %}
  5. <!-- Draw favicon -->
  6. {% macro draw_favicon(favicon) -%}
  7. <img width="32" height="32" class="favicon" src="{{ url_for('static', filename='themes/oscar/img/icons/' + favicon + '.png') }}" alt="{{ favicon }}" />
  8. {%- endmacro %}
  9. {%- macro result_link(url, title, classes='') -%}
  10. <a href="{{ url }}" {% if classes %}class="{{ classes }}" {% endif %}{% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ title }}</a>
  11. {%- endmacro -%}
  12. <!-- Draw result header -->
  13. {% macro result_header(result, favicons) -%}
  14. <h4 class="result_header">{% if result.engine~".png" in favicons %}{{ draw_favicon(result.engine) }} {% endif %}{% if result.url %}{{ result_link(result.url, result.title|safe) }}{% else %}{{ result.title|safe}}{% endif %}</h4>
  15. {%- endmacro %}
  16. <!-- Draw result sub header -->
  17. {% macro result_sub_header(result) -%}
  18. {% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
  19. {% if result.magnetlink %}<small> &bull; {{ result_link(result.magnetlink, icon('magnet') + _('magnet link'), "magnetlink") }}</small>{% endif %}
  20. {% if result.torrentfile %}<small> &bull; {{ result_link(result.torrentfile, icon('download-alt') + _('torrent file'), "torrentfile") }}</small>{% endif %}
  21. {%- endmacro %}
  22. <!-- Draw result footer -->
  23. {% macro result_footer(result) -%}
  24. <div class="clearfix"></div>
  25. <div class="pull-right">
  26. {% for engine in result.engines %}
  27. <span class="label label-default">{{ engine }}</span>
  28. {% endfor %}
  29. {% if result.url %}
  30. <small>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info") }}</small>
  31. {% endif %}
  32. {% if proxify %}
  33. <small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info") }}</small>
  34. {% endif %}
  35. </div>
  36. {% if result.pretty_url %}
  37. <div class="external-link">{{ result.pretty_url }}</div>
  38. {% endif %}
  39. {%- endmacro %}
  40. <!-- Draw result footer -->
  41. {% macro result_footer_rtl(result) -%}
  42. <div class="clearfix"></div>
  43. {% for engine in result.engines %}
  44. <span class="label label-default">{{ engine }}</span>
  45. {% endfor %}
  46. {% if result.url %}
  47. <small>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info") }}</small>
  48. {% endif %}
  49. {% if proxify %}
  50. <small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info") }}</small>
  51. {% endif %}
  52. {% if result.pretty_url %}
  53. <div class="external-link">{{ result.pretty_url }}</div>
  54. {% endif %}
  55. {%- endmacro %}
  56. {% macro preferences_item_header(info, label, rtl) -%}
  57. {% if rtl %}
  58. <div class="row form-group">
  59. <label class="col-sm-3 col-md-2 pull-right">{{ label }}</label>
  60. <span class="col-sm-5 col-md-6 help-block pull-left">{{ info }}</span>
  61. <div class="col-sm-4 col-md-4">
  62. {% else %}
  63. <div class="row form-group">
  64. <label class="col-sm-3 col-md-2">{{ label }}</label>
  65. <div class="col-sm-4 col-md-4">
  66. {% endif %}
  67. {%- endmacro %}
  68. {% macro preferences_item_footer(info, label, rtl) -%}
  69. {% if rtl %}
  70. </div>
  71. </div>
  72. {% else %}
  73. </div>
  74. <span class="col-sm-5 col-md-6 help-block">{{ info }}</span>
  75. </div>
  76. {% endif %}
  77. {%- endmacro %}
  78. {% macro checkbox_toggle(id, blocked) -%}
  79. <div class="onoffswitch">
  80. <input type="checkbox" id="{{ id }}" name="{{ id }}"{% if blocked %} checked="checked"{% endif %} class="onoffswitch-checkbox">
  81. <label class="onoffswitch-label" for="{{ id }}">
  82. <span class="onoffswitch-inner"></span>
  83. <span class="onoffswitch-switch"></span>
  84. </label>
  85. </div>
  86. {%- endmacro %}
  87. {% macro support_toggle(supports) -%}
  88. {% if supports %}
  89. <span class="label label-success">
  90. {{ _("supported") }}
  91. </span>
  92. {% else %}
  93. <span class="label label-danger">
  94. {{ _("not supported") }}
  95. </span>
  96. {% endif %}
  97. {%- endmacro %}