templates: Normalize media element buttons while adding editing buttons

master
Felix Stupp 3 years ago
parent 4f4ac8ff7b
commit e9e5aef891
Signed by: zocker
GPG Key ID: 93E1BD26F6B02FB7

@ -29,6 +29,7 @@
Next Episode:
{% set link = collection.next_episode %}
{% if link %}
{{ macros.media_element_buttons(link.element) }}
<a href="{{ link.element.info_link }}">{{ link.element.title }}</a>
{%- if link.season != 0 -%}
, Season {{ link.season }}
@ -48,6 +49,7 @@
<ul>
{% for link in media_links %}
<li id="media_element_{{ link.element.id }}">
{{ macros.media_element_buttons(link.element) }}
{{ link.element.release_date.strftime("%d.%m.%Y") }}
<a href="{{ link.element.info_link }}">{{ link.element.title }}</a>
{%- if link.season != 0 -%}

@ -38,3 +38,17 @@
<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 %}

@ -15,7 +15,7 @@
<h2>Properties</h2>
<ul>
<li>
{{ element.uri | as_play_link }}
{{ macros.media_element_buttons(element) }}
</li>
<li>Can be considered: {{ element.can_considered | tenary("Yes", "no") }}</li>
<li>

@ -41,7 +41,7 @@
<td>{{ media.length }}&nbsp;s</td>
<td>{{ media.can_considered | tenary("Yes", "no") }}</td>
<td>
{{ media.uri | as_play_link }}
{{ macros.media_element_buttons(media) }}
</td>
</tr>
{% endfor %}

Loading…
Cancel
Save