mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-21 13:53:19 -07:00
UI changes to consume actor searching API
This commit is contained in:
parent
9380ba3e45
commit
0aa00fd888
5 changed files with 173 additions and 72 deletions
35
Ombi.UI/Content/requests.js
vendored
35
Ombi.UI/Content/requests.js
vendored
|
@ -95,7 +95,10 @@ $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
|||
//if ($tvl.mixItUp('isLoaded')) $tvl.mixItUp('destroy');
|
||||
//$tvl.mixItUp(mixItUpConfig(activeState)); // init or reinit
|
||||
}
|
||||
if (target === "#MoviesTab") {
|
||||
if (target === "#MoviesTab" || target === "#ActorsTab") {
|
||||
if (target === "#ActorsTab") {
|
||||
actorLoad();
|
||||
}
|
||||
$('#approveMovies,#deleteMovies').show();
|
||||
if ($tvl.mixItUp('isLoaded')) {
|
||||
activeState = $tvl.mixItUp('getState');
|
||||
|
@ -733,6 +736,36 @@ function initLoad() {
|
|||
|
||||
}
|
||||
|
||||
|
||||
function actorLoad() {
|
||||
var $ml = $('#actorMovieList');
|
||||
if ($ml.mixItUp('isLoaded')) {
|
||||
activeState = $ml.mixItUp('getState');
|
||||
$ml.mixItUp('destroy');
|
||||
}
|
||||
$ml.html("");
|
||||
|
||||
var url = createBaseUrl(base, '/requests/actor');
|
||||
$.ajax(url).success(function (results) {
|
||||
if (results.length > 0) {
|
||||
results.forEach(function (result) {
|
||||
var context = buildRequestContext(result, "movie");
|
||||
var html = searchTemplate(context);
|
||||
$ml.append(html);
|
||||
});
|
||||
|
||||
|
||||
$('.customTooltip').tooltipster({
|
||||
contentCloning: true
|
||||
});
|
||||
}
|
||||
else {
|
||||
$ml.html(noResultsHtml.format("movie"));
|
||||
}
|
||||
$ml.mixItUp(mixItUpConfig());
|
||||
});
|
||||
};
|
||||
|
||||
function movieLoad() {
|
||||
var $ml = $('#movieList');
|
||||
if ($ml.mixItUp('isLoaded')) {
|
||||
|
|
38
Ombi.UI/Content/search.js
vendored
38
Ombi.UI/Content/search.js
vendored
|
@ -63,6 +63,17 @@ $(function () {
|
|||
|
||||
});
|
||||
|
||||
// Type in actor search
|
||||
$("#actorSearchContent").on("input", function () {
|
||||
if (searchTimer) {
|
||||
clearTimeout(searchTimer);
|
||||
}
|
||||
searchTimer = setTimeout(function () {
|
||||
moviesFromActor();
|
||||
}.bind(this), 800);
|
||||
|
||||
});
|
||||
|
||||
$('#moviesComingSoon').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
moviesComingSoon();
|
||||
|
@ -300,7 +311,7 @@ $(function () {
|
|||
function movieSearch() {
|
||||
var query = $("#movieSearchContent").val();
|
||||
var url = createBaseUrl(base, '/search/movie/');
|
||||
query ? getMovies(url + query) : resetMovies();
|
||||
query ? getMovies(url + query) : resetMovies("#movieList");
|
||||
}
|
||||
|
||||
function moviesComingSoon() {
|
||||
|
@ -313,6 +324,12 @@ $(function () {
|
|||
getMovies(url);
|
||||
}
|
||||
|
||||
function moviesFromActor() {
|
||||
var query = $("#actorSearchContent").val();
|
||||
var url = createBaseUrl(base, '/search/actor/');
|
||||
query ? getMovies(url + query, "#actorMovieList", "#actorSearchButton") : resetMovies("#actorMovieList");
|
||||
}
|
||||
|
||||
function popularShows() {
|
||||
var url = createBaseUrl(base, '/search/tv/popular');
|
||||
getTvShows(url, true);
|
||||
|
@ -330,30 +347,31 @@ $(function () {
|
|||
getTvShows(url, true);
|
||||
}
|
||||
|
||||
function getMovies(url) {
|
||||
resetMovies();
|
||||
|
||||
$('#movieSearchButton').attr("class", "fa fa-spinner fa-spin");
|
||||
function getMovies(url, target, button) {
|
||||
target = target || "#movieList";
|
||||
button = button || "#movieSearchButton";
|
||||
resetMovies(target);
|
||||
$(button).attr("class", "fa fa-spinner fa-spin");
|
||||
$.ajax(url).success(function (results) {
|
||||
if (results.length > 0) {
|
||||
results.forEach(function (result) {
|
||||
var context = buildMovieContext(result);
|
||||
|
||||
var html = searchTemplate(context);
|
||||
$("#movieList").append(html);
|
||||
$(target).append(html);
|
||||
|
||||
checkNetflix(context.title, context.id);
|
||||
});
|
||||
}
|
||||
else {
|
||||
$("#movieList").html(noResultsHtml);
|
||||
$(target).html(noResultsHtml);
|
||||
}
|
||||
$('#movieSearchButton').attr("class", "fa fa-search");
|
||||
$(button).attr("class", "fa fa-search");
|
||||
});
|
||||
};
|
||||
|
||||
function resetMovies() {
|
||||
$("#movieList").html("");
|
||||
function resetMovies(target) {
|
||||
$(target).html("");
|
||||
}
|
||||
|
||||
function tvSearch() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue