You've already forked snikket-web-portal
26 lines
1.2 KiB
Django/Jinja
26 lines
1.2 KiB
Django/Jinja
{% macro box(type, title, slim=False, caller=None) %}
|
|
<aside class="box{% if slim %} slim{% endif %} {{ type }}"><header>{{ title }}</header> {{ caller() }}</aside>
|
|
{% endmacro %}
|
|
|
|
{% macro avatar(from_, hash, char=None, caller=None) -%}
|
|
{%- if hash -%}
|
|
<div class="avatar" style="background-image: url('{{ url_for_avatar(from_, hash) }}');"></div>
|
|
{%- else -%}
|
|
<div class="avatar shim" style="background-color: {{ text_to_css(from_) }}"><span data-avatar-char="{{ char or from_[0] }}"></span></div>
|
|
{%- endif -%}
|
|
{%- endmacro %}
|
|
|
|
{% macro clipboard_button(label=_("Copy link"), caller=None) -%}
|
|
{%- set text = caller() -%}
|
|
<a title="{% trans content=text %}Copy "{{ content }}" to clipboard{% endtrans %}" aria-label="{% trans content=text %}Copy "{{ content }}" to clipboard{% endtrans %}" class="copy-to-clipboard" onclick="copy_to_clipboard(this); return false;" data-cliptext="{{ text }}" href="#">{{ label }}</a>
|
|
{%- endmacro %}
|
|
|
|
{% macro showuri(uri, caller=None) %}
|
|
{%- if uri is none -%}
|
|
<em>—</em>
|
|
{%- else -%}
|
|
<div><input type="text" readonly="readonly" value="{{ uri }}"></div>
|
|
<div>{% call clipboard_button() %}{{ uri }}{% endcall %}</div>
|
|
{%- endif -%}
|
|
{% endmacro %}
|