UI changes to add checkbox and support searching for only new matches via new API.

pull/1178/head
smcpeck 8 years ago
parent 0d3ff966d6
commit 39871802b5

@ -745,7 +745,8 @@ function actorLoad() {
} }
$ml.html(""); $ml.html("");
var url = createBaseUrl(base, '/requests/actor'); var $newOnly = $('#searchNewOnly').val();
var url = createBaseUrl(base, '/requests/actor' + (!!$newOnly ? '/new' : ''));
$.ajax(url).success(function (results) { $.ajax(url).success(function (results) {
if (results.length > 0) { if (results.length > 0) {
results.forEach(function (result) { results.forEach(function (result) {

@ -65,14 +65,23 @@ $(function () {
// Type in actor search // Type in actor search
$("#actorSearchContent").on("input", function () { $("#actorSearchContent").on("input", function () {
triggerActorSearch();
});
// if they toggle the checkbox, we want to refresh our search
$("#actorsSearchNew").click(function () {
triggerActorSearch();
});
function triggerActorSearch()
{
if (searchTimer) { if (searchTimer) {
clearTimeout(searchTimer); clearTimeout(searchTimer);
} }
searchTimer = setTimeout(function () { searchTimer = setTimeout(function () {
moviesFromActor(); moviesFromActor();
}.bind(this), 800); }.bind(this), 800);
}
});
$('#moviesComingSoon').on('click', function (e) { $('#moviesComingSoon').on('click', function (e) {
e.preventDefault(); e.preventDefault();
@ -326,7 +335,8 @@ $(function () {
function moviesFromActor() { function moviesFromActor() {
var query = $("#actorSearchContent").val(); var query = $("#actorSearchContent").val();
var url = createBaseUrl(base, '/search/actor/'); var $newOnly = $('#actorsSearchNew')[0].checked;
var url = createBaseUrl(base, '/search/actor/' + (!!$newOnly ? 'new/' : ''));
query ? getMovies(url + query, "#actorMovieList", "#actorSearchButton") : resetMovies("#actorMovieList"); query ? getMovies(url + query, "#actorMovieList", "#actorSearchButton") : resetMovies("#actorMovieList");
} }

@ -211,6 +211,9 @@
<data name="Search_Albums" xml:space="preserve"> <data name="Search_Albums" xml:space="preserve">
<value>Albums</value> <value>Albums</value>
</data> </data>
<data name="Search_NewOnly" xml:space="preserve">
<value>Don't include titles that are already requested/available</value>
</data>
<data name="Search_Paragraph" xml:space="preserve"> <data name="Search_Paragraph" xml:space="preserve">
<value>Want to watch something that is not currently on Plex?! No problem! Just search for it below and request it!</value> <value>Want to watch something that is not currently on Plex?! No problem! Just search for it below and request it!</value>
</data> </data>

@ -897,6 +897,15 @@ namespace Ombi.UI.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Don&apos;t include titles that are already requested/available.
/// </summary>
public static string Search_NewOnly {
get {
return ResourceManager.GetString("Search_NewOnly", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Not Requested yet. /// Looks up a localized string similar to Not Requested yet.
/// </summary> /// </summary>

@ -60,6 +60,7 @@
@Html.Checkbox(Model.SearchForMovies,"SearchForMovies","Search for Movies") @Html.Checkbox(Model.SearchForMovies,"SearchForMovies","Search for Movies")
@Html.Checkbox(Model.SearchForActors,"SearchForActors","Search for Movies by Actor")
<div class="form-group"> <div class="form-group">
<div class="checkbox"> <div class="checkbox">

@ -25,10 +25,13 @@
<a id="movieTabButton" href="#MoviesTab" aria-controls="home" role="tab" data-toggle="tab"><i class="fa fa-film"></i> @UI.Search_Movies</a> <a id="movieTabButton" href="#MoviesTab" aria-controls="home" role="tab" data-toggle="tab"><i class="fa fa-film"></i> @UI.Search_Movies</a>
</li> </li>
<li role="presentation"> @if (Model.Settings.SearchForActors)
<a id="actorTabButton" href="#ActorsTab" aria-controls="profile" role="tab" data-toggle="tab"><i class="fa fa-users"></i> @UI.Search_Actors</a> {
<li role="presentation">
<a id="actorTabButton" href="#ActorsTab" aria-controls="profile" role="tab" data-toggle="tab"><i class="fa fa-users"></i> @UI.Search_Actors</a>
</li> </li>
}
} }
@if (Model.Settings.SearchForTvShows) @if (Model.Settings.SearchForTvShows)
{ {
@ -74,21 +77,27 @@
<div id="movieList"> <div id="movieList">
</div> </div>
</div> </div>
@if (Model.Settings.SearchForActors)
{
<!-- Actors tab --> <!-- Actors tab -->
<div role="tabpanel" class="tab-pane" id="ActorsTab"> <div role="tabpanel" class="tab-pane" id="ActorsTab">
<div class="input-group"> <div class="input-group">
<input id="actorSearchContent" type="text" class="form-control form-control-custom form-control-search form-control-withbuttons"> <input id="actorSearchContent" type="text" class="form-control form-control-custom form-control-search form-control-withbuttons">
<div class="input-group-addon"> <div class="input-group-addon">
<i id="actorSearchButton" class="fa fa-search"></i> <i id="actorSearchButton" class="fa fa-search"></i>
</div>
</div>
<div class="checkbox">
<input type="checkbox" class="newMoviesOnly" id="actorsSearchNew" name="actorsSearchNew"><label for="actorsSearchNew">@UI.Search_NewOnly</label>
</div> </div>
</div>
<br />
<br />
<!-- Movie content -->
<div id="actorMovieList">
</div>
</div>
<br />
<br />
<!-- Movie content -->
<div id="actorMovieList">
</div>
</div>
}
} }
@if (Model.Settings.SearchForTvShows) @if (Model.Settings.SearchForTvShows)
@ -139,7 +148,7 @@
} }
<script id="search-templateNew" type="text/x-handlebars-template"> <script id="search-templateNew" type="text/x-handlebars-template">
<div class="row"> <div class="row">
<div id="{{id}}imgDiv" class="col-sm-2"> <div id="{{id}}imgDiv" class="col-sm-2">
@ -301,7 +310,7 @@
</script> </script>
<!-- Movie and TV Results template --> <!-- Movie and TV Results template -->
<script id="search-template" type="text/x-handlebars-template"> <script id="search-template" type="text/x-handlebars-template">
<div class="row"> <div class="row">
<div id="{{id}}imgDiv" class="col-sm-2"> <div id="{{id}}imgDiv" class="col-sm-2">

Loading…
Cancel
Save