mirror of
https://github.com/redlib-org/redlib.git
synced 2025-05-14 05:52:53 +00:00
Rewrite + Searching
This commit is contained in:
parent
c7282520cd
commit
a6dc7ee043
17 changed files with 342 additions and 262 deletions
28
templates/utils.html
Normal file
28
templates/utils.html
Normal file
|
@ -0,0 +1,28 @@
|
|||
{% 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 }}{% endif %}/search/" id="searchbox">
|
||||
<input id="search" type="text" name="q" placeholder="Search" value="{{ search }}">
|
||||
{% if root != "/r/" %}
|
||||
<div id="inside">
|
||||
<input type="checkbox" name="restrict_sr" id="restrict_sr" checked="checked" data-com.bitwarden.browser.user-edited="yes">
|
||||
<label for="restrict_sr">in {{ root }}</label>
|
||||
</div>
|
||||
{% endif %}
|
||||
<input type="submit" value="→">
|
||||
</form>
|
||||
{%- endmacro %}
|
Loading…
Add table
Add a link
Reference in a new issue