You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bazarr/views/blacklistmovies.html

114 lines
4.3 KiB

{% extends '_main.html' %}
{% block title %}Blacklist (Movies) - Bazarr{% endblock %}
{% block bcleft %}
<button class="btn btn-outline" id="remove_all_button">
<div><i class="fas fa-trash-alt align-top text-themecolor text-center font-20" aria-hidden="true"></i></div>
<div class="align-bottom text-themecolor small text-center">Remove All</div>
</button>
{% endblock bcleft %}
{% block bcright %}
{% endblock bcright %}
{% block body %}
<table id="blacklist_movies" class="table table-striped" style="width:100%">
<thead>
<tr>
<th>Title</th>
<th>Language</th>
<th>Provider</th>
<th>Date</th>
<th>Actions</th>
</tr>
</thead>
</table>
{% endblock body %}
{% block tail %}
<script>
$(document).ready(function () {
var table = $('#blacklist_movies').DataTable({
processing: true,
serverSide: true,
language: {
zeroRecords: 'No Blacklisted Movies Subtitles',
processing: "Loading Blacklisted Movies Subtitles..."
},
searching: false,
ordering: false,
lengthChange: false,
responsive: true,
pageLength: {{ settings.general.page_size }},
ajax: "{{ url_for('api.blacklistmovies') }}",
columns: [
{
data: null,
render: function (data) {
return '<a href="' + "{{ url_for( 'movie', no='tempvalue' ) }}".replace("tempvalue", data.radarrId) + '">' + data.title + '</a>';
}
},
{
data: 'language',
render: function (value) {
var language_string = '';
if (value.hi) {
language_string = ' HI';
} else if (value.forced) {
language_string = ' forced';
}
return value.name + language_string;
}
},
{data: "provider"},
{data: "timestamp"},
{data: null,
render: function (data) {
return '<a href="" class="blacklist_delete badge badge-secondary" data-toggle="tooltip" data-placement="right" title="Remove this subtitles from blacklist" data-provider="' + data.provider + '" data-subs_id=' + data.subs_id + '><i class="fas fa-trash-alt"></i></a>';
}
}
]
});
$('#remove_all_button').on('click', function (e) {
e.preventDefault();
$.ajax({
url: "{{ url_for('api.blacklistmoviesubtitlesremoveall') }}",
type: 'DELETE',
beforeSend: function () {
$('#remove_all_button').find("i").addClass('fa-spin');
},
complete: function () {
$('#remove_all_button').find("i").removeClass('fa-spin');
}
});
});
$('#blacklist_movies').on('click', '.blacklist_delete', function (e) {
$(this).tooltip('dispose');
e.preventDefault();
const values = {
provider: $(this).attr('data-provider'),
subs_id: $(this).attr('data-subs_id')
};
$.ajax({
url: "{{ url_for('api.blacklistmoviesubtitlesremove') }}",
type: "DELETE",
dataType: "json",
data: values
});
});
events.on('event', function (event) {
var event_json = JSON.parse(event);
if (event_json.type === 'movieBlacklist') {
$('#blacklist_movies').DataTable().ajax.reload(null, false);
$('[data-toggle="tooltip"]').tooltip({html: true});
}
});
});
</script>
{% endblock tail %}