You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
91 lines
2.7 KiB
HTML
91 lines
2.7 KiB
HTML
{% macro shared_style() %}
|
|
<style>
|
|
table tr th, table tr td {
|
|
margin: 0;
|
|
padding: .2em;
|
|
border: solid black 1px;
|
|
}
|
|
table tr:nth-child(even) {
|
|
background-color: #eeeeee;
|
|
}
|
|
a:link {
|
|
text-decoration: none;
|
|
color: darkblue;
|
|
}
|
|
a:visited {
|
|
text-decoration: none;
|
|
color: darkblue;
|
|
}
|
|
a:hover {
|
|
text-decoration: none;
|
|
}
|
|
a:active {
|
|
text-decoration: none;
|
|
}
|
|
form.form-single-button {
|
|
display: inline-block;
|
|
}
|
|
form.form-single-button button,
|
|
.button {
|
|
padding: .1rem .2rem;
|
|
margin: 0 .1rem;
|
|
background-color: lightcoral;
|
|
border-radius: .3rem;
|
|
}
|
|
</style>
|
|
{% endmacro %}
|
|
|
|
{% macro hidden_redirect_back() %}
|
|
<input type="hidden" name="redirect" value="{{ url_for(request.endpoint, **request.view_args) }}{{ ('#' + fragment) if fragment else '' }}"/>
|
|
{% endmacro %}
|
|
|
|
{% macro post_form(uri, key, val, text, fragment="") %}
|
|
<form class="form-single-button" method="POST" action="{{ uri }}">
|
|
{{ hidden_redirect_back() }}
|
|
<button name="{{ key }}" value="{{ val }}">{{ text }}</button>
|
|
</form>
|
|
{% endmacro %}
|
|
|
|
{% macro media_element_buttons(element) %}
|
|
{% set api_uri = "/api/media/" + element.id|string %}
|
|
{% set fragment = "media_element_" + element.id|string %}
|
|
{{ element.uri | as_play_link }}
|
|
{% if element.watched %}
|
|
{{ post_form(api_uri, "watched", "false", "Unmark as Watched", fragment) }}
|
|
{% elif element.ignored %}
|
|
{{ post_form(api_uri, "ignored", "false", "Unmark as Ignored", fragment) }}
|
|
{% else %}
|
|
{{ post_form(api_uri, "watched", "true", "Watched", fragment) }}
|
|
{{ post_form(api_uri, "ignored", "true", "Ignore", fragment) }}
|
|
{% endif %}
|
|
{% endmacro %}
|
|
|
|
{% macro media_entry_content(element) %}
|
|
{{ media_element_buttons(element) }}
|
|
{{ element.release_date.strftime("%d.%m.%Y") }}
|
|
{{ element.length | timedelta }}
|
|
<a href="{{ element.info_link }}">{{ element.title }}</a>
|
|
{%- endmacro %}
|
|
|
|
{% macro link_entry_content(link) %}
|
|
{{ media_entry_content(link.element) -}}
|
|
{%- if link.season != 0 -%}
|
|
, Season {{ link.season }}
|
|
{%- endif -%}
|
|
{%- if link.episode != 0 -%}
|
|
, Episode {{ link.episode }}
|
|
{%- endif -%}
|
|
{%- endmacro %}
|
|
|
|
{% macro media_entry(element) %}
|
|
<li id="media_element_{{ element.id }}">
|
|
{{ media_entry_content(element) }}
|
|
</li>
|
|
{%- endmacro %}
|
|
|
|
{% macro link_entry(link) %}
|
|
<li id="media_element_{{ link.element.id }}">
|
|
{{ link_entry_content(link) }}
|
|
</li>
|
|
{%- endmacro %}
|