macros.html 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. <span class="text-muted"><small>{{ result.pretty_url }}</small></span>
  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>
  39. <span class="text-muted"><small>{{ result.pretty_url }}</small></span>
  40. {%- endmacro %}
  41. {% macro preferences_item_header(info, label, rtl) -%}
  42. {% if rtl %}
  43. <div class="row form-group">
  44. <label class="col-sm-3 col-md-2 pull-right">{{ label }}</label>
  45. <span class="col-sm-5 col-md-6 help-block pull-left">{{ info }}</span>
  46. <div class="col-sm-4 col-md-4">
  47. {% else %}
  48. <div class="row form-group">
  49. <label class="col-sm-3 col-md-2">{{ label }}</label>
  50. <div class="col-sm-4 col-md-4">
  51. {% endif %}
  52. {%- endmacro %}
  53. {% macro preferences_item_footer(info, label, rtl) -%}
  54. {% if rtl %}
  55. </div>
  56. </div>
  57. {% else %}
  58. </div>
  59. <span class="col-sm-5 col-md-6 help-block">{{ info }}</span>
  60. </div>
  61. {% endif %}
  62. {%- endmacro %}
  63. {% macro checkbox_toggle(id, blocked) -%}
  64. <div class="checkbox">
  65. <input class="hidden" type="checkbox" id="{{ id }}" name="{{ id }}"{% if blocked %} checked="checked"{% endif %} />
  66. <label class="btn btn-success label_hide_if_checked" for="{{ id }}">{{ _('Block') }}</label>
  67. <label class="btn btn-danger label_hide_if_not_checked" for="{{ id }}">{{ _('Allow') }}</label>
  68. </div>
  69. {%- endmacro %}