2021-01-01 12:54:13 +13:00
|
|
|
{% 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) -%}
|
2021-01-01 17:21:56 +13:00
|
|
|
<form action="{% if root != "/r/" && !root.is_empty() %}{{ root }}{% endif %}/search/" id="searchbox">
|
2021-01-18 11:49:36 +13:00
|
|
|
<input id="search" type="text" name="q" placeholder="Search" title="Search libreddit" value="{{ search }}">
|
2021-01-01 17:21:56 +13:00
|
|
|
{% if root != "/r/" && !root.is_empty() %}
|
2021-01-01 12:54:13 +13:00
|
|
|
<div id="inside">
|
2021-01-03 17:50:23 +13:00
|
|
|
<input type="checkbox" name="restrict_sr" id="restrict_sr">
|
2021-01-13 04:47:39 +13:00
|
|
|
<label for="restrict_sr" class="search_label">in {{ root }}</label>
|
2021-01-01 12:54:13 +13:00
|
|
|
</div>
|
|
|
|
{% endif %}
|
2021-01-18 12:51:03 +13:00
|
|
|
<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>
|
2021-01-01 12:54:13 +13:00
|
|
|
</form>
|
2021-01-13 10:43:03 +13:00
|
|
|
{%- endmacro %}
|
|
|
|
|
|
|
|
{% macro render_flair(flair) -%}
|
2021-01-15 11:56:28 +13:00
|
|
|
{% for flair_part in flair %}
|
2021-01-17 16:21:47 +13:00
|
|
|
{% if flair_part.flair_part_type == "emoji" %}<span class="emoji" style="background-image:url('{{ flair_part.value }}');"></span>
|
2021-01-15 11:56:28 +13:00
|
|
|
{% else if flair_part.flair_part_type == "text" %}<span>{{ flair_part.value }}</span>{% endif %}
|
|
|
|
{% endfor %}
|
2021-01-13 10:43:03 +13:00
|
|
|
{%- endmacro %}
|
2021-01-30 18:00:55 +13:00
|
|
|
|
2021-01-31 11:52:18 +13:00
|
|
|
{% macro sub_list(current) -%}
|
2021-01-30 18:00:55 +13:00
|
|
|
{% if prefs.subs.len() > 0 %}
|
2021-02-02 14:50:00 +13:00
|
|
|
<details id="feeds">
|
|
|
|
<summary>Feeds</summary>
|
|
|
|
<div id="feed_list">
|
|
|
|
<p>MAIN FEEDS</p>
|
|
|
|
<a href="/">Home</a>
|
|
|
|
<a href="/r/popular">Popular</a>
|
|
|
|
<a href="/r/all">All</a>
|
|
|
|
<p>REDDIT FEEDS</p>
|
2021-01-31 15:16:42 +13:00
|
|
|
{% for sub in prefs.subs %}
|
|
|
|
<a href="/r/{{ sub }}" {% if sub == current %}class="selected"{% endif %}>{{ sub }}</a>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
</details>
|
2021-01-30 18:00:55 +13:00
|
|
|
{% endif %}
|
|
|
|
{%- endmacro %}
|