54 lines
1.9 KiB
HTML
54 lines
1.9 KiB
HTML
{% macro options(current, values, default) -%}
|
|
{% for value in values %}
|
|
<option value="{{ value }}" {% if current == value || (current == "" && value == default) %}selected{% endif %}>
|
|
{{ format!("{}{}", value.get(0..1).unwrap().to_uppercase(), value.get(1..).unwrap()) }}
|
|
</option>
|
|
{% endfor %}
|
|
{%- endmacro %}
|
|
|
|
{% macro sort(root, methods, selected) -%}
|
|
{% for method in methods %}
|
|
<a {% if method == selected %}class="selected"{% endif %} href="{{ root }}/{{ method }}">
|
|
{{ format!("{}{}", method.get(0..1).unwrap().to_uppercase(), method.get(1..).unwrap()) }}
|
|
</a>
|
|
{% endfor %}
|
|
{%- endmacro %}
|
|
|
|
{% macro search(root, search) -%}
|
|
<form action="{% if root != "/r/" && !root.is_empty() %}{{ root }}{% endif %}/search/" id="searchbox">
|
|
<input id="search" type="text" name="q" placeholder="Search" title="Search libreddit" value="{{ search }}">
|
|
{% if root != "/r/" && !root.is_empty() %}
|
|
<div id="inside">
|
|
<input type="checkbox" name="restrict_sr" id="restrict_sr">
|
|
<label for="restrict_sr" class="search_label">in {{ root }}</label>
|
|
</div>
|
|
{% endif %}
|
|
<button class="submit">
|
|
<svg width="15" viewBox="0 0 110 100" fill="none" stroke-width="10" stroke-linecap="round">
|
|
<path d="M20 50 H100" />
|
|
<path d="M75 15 L100 50 L75 85" />
|
|
→
|
|
</svg>
|
|
</button>
|
|
</form>
|
|
{%- endmacro %}
|
|
|
|
{% macro render_flair(flair) -%}
|
|
{% for flair_part in flair %}
|
|
{% if flair_part.flair_part_type == "emoji" %}<span class="emoji" style="background-image:url('{{ flair_part.value }}');"></span>
|
|
{% else if flair_part.flair_part_type == "text" %}<span>{{ flair_part.value }}</span>{% endif %}
|
|
{% endfor %}
|
|
{%- endmacro %}
|
|
|
|
{% macro sub_list(current) -%}
|
|
{% if prefs.subs.len() > 0 %}
|
|
<details id="subscriptions">
|
|
<summary>Subscriptions</summary>
|
|
<div id="sub_list">
|
|
{% for sub in prefs.subs %}
|
|
<a href="/r/{{ sub }}" {% if sub == current %}class="selected"{% endif %}>{{ sub }}</a>
|
|
{% endfor %}
|
|
</div>
|
|
</details>
|
|
{% endif %}
|
|
{%- endmacro %}
|