mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-28 21:12:43 +02:00
Added: Ability to see TMDB and lists going through the Radarr API on the discovery page.
Added: More lists (specifically presets for IMDB Top 250 and IMDB Popular) Added: Ability to set Radarr API endpoint as list.
This commit is contained in:
@@ -3,7 +3,12 @@ var $ = require('jquery');
|
||||
var vent = require('vent');
|
||||
var Marionette = require('marionette');
|
||||
var AddMoviesCollection = require('./AddMoviesCollection');
|
||||
var AddFromListCollection = require('./List/AddFromListCollection');
|
||||
var SearchResultCollectionView = require('./SearchResultCollectionView');
|
||||
var DiscoverableListDropdownView = require("./DiscoverableListDropdownView");
|
||||
var DiscoverableListCollection = require("./DiscoverableListCollection");
|
||||
var DiscoverableListCollectionView = require("./DiscoverableListCollectionView");
|
||||
var DiscoverMoviesCollection = require("./DiscoverMoviesCollection");
|
||||
var EmptyView = require('./EmptyView');
|
||||
var NotFoundView = require('./NotFoundView');
|
||||
var DiscoverEmptyView = require('./DiscoverEmptyView');
|
||||
@@ -15,7 +20,8 @@ module.exports = Marionette.Layout.extend({
|
||||
template : 'AddMovies/AddMoviesViewTemplate',
|
||||
|
||||
regions : {
|
||||
searchResult : '#search-result'
|
||||
myRegion : '#my-region',
|
||||
searchResult : '#search-result',
|
||||
},
|
||||
|
||||
ui : {
|
||||
@@ -26,14 +32,17 @@ module.exports = Marionette.Layout.extend({
|
||||
discoverBefore : ".x-discover-before",
|
||||
discoverRecos : ".x-recommendations-tab",
|
||||
discoverPopular : ".x-popular-tab" ,
|
||||
discoverUpcoming : ".x-upcoming-tab"
|
||||
discoverUpcoming : ".x-upcoming-tab",
|
||||
discoverLists : ".x-lists-tab"
|
||||
},
|
||||
|
||||
events : {
|
||||
'click .x-load-more' : '_onLoadMore',
|
||||
"click .x-recommendations-tab" : "_discoverRecos",
|
||||
"click .x-popular-tab" : "_discoverPopular",
|
||||
"click .x-upcoming-tab" : "_discoverUpcoming"
|
||||
"click .x-upcoming-tab" : "_discoverUpcoming",
|
||||
"click .x-lists-tab" : "_discoverLists",
|
||||
"click .discoverable-list-item" : "_discoverList"
|
||||
},
|
||||
|
||||
initialize : function(options) {
|
||||
@@ -58,6 +67,15 @@ module.exports = Marionette.Layout.extend({
|
||||
isExisting : this.isExisting
|
||||
});
|
||||
|
||||
/*this.listsDropdown = new DiscoverableListCollectionView({
|
||||
collection : DiscoverableListCollection
|
||||
});*/
|
||||
|
||||
this.listenTo(DiscoverableListCollection, 'sync', this._showListDropdown);
|
||||
this.listsDropdown = new DiscoverableListCollectionView({
|
||||
collection : DiscoverableListCollection
|
||||
})
|
||||
|
||||
this.throttledSearch = _.debounce(this.search, 1000, { trailing : true }).bind(this);
|
||||
|
||||
if (options.action === "search") {
|
||||
@@ -125,6 +143,8 @@ module.exports = Marionette.Layout.extend({
|
||||
this.ui.moviesSearch.focus();
|
||||
this.ui.loadMore.hide();
|
||||
|
||||
this._showListDropdown();
|
||||
|
||||
if (this.isDiscover) {
|
||||
this.ui.discoverBefore.show();
|
||||
}
|
||||
@@ -208,6 +228,14 @@ module.exports = Marionette.Layout.extend({
|
||||
}
|
||||
},
|
||||
|
||||
_showListDropdown : function() {
|
||||
this.listsDropdown = new DiscoverableListDropdownView(DiscoverableListCollection.toJSON());
|
||||
this.listsDropdown.render();
|
||||
$("#list-dropdown").html(this.listsDropdown.$el.html());
|
||||
//debugger;
|
||||
//this.myRegion.show(new DiscoverableListDropdownView(DiscoverableListCollection.toJSON()));
|
||||
},
|
||||
|
||||
_abortExistingSearch : function() {
|
||||
if (this.currentSearchPromise && this.currentSearchPromise.readyState > 0 && this.currentSearchPromise.readyState < 4) {
|
||||
console.log('aborting previous pending search request.');
|
||||
@@ -229,7 +257,14 @@ module.exports = Marionette.Layout.extend({
|
||||
if (this.collection.action === action) {
|
||||
return
|
||||
}
|
||||
this.collection.reset();
|
||||
|
||||
if (this.collection.specialProperty === "special") {
|
||||
this.collection.reset();
|
||||
this.collection = new DiscoverMoviesCollection();
|
||||
this.resultCollectionView.collection = this.collection;
|
||||
}
|
||||
|
||||
this.listenTo(this.collection, 'sync', this._showResults);
|
||||
this.searchResult.show(new LoadingView());
|
||||
this.collection.action = action;
|
||||
this.currentSearchPromise = this.collection.fetch();
|
||||
@@ -253,5 +288,22 @@ module.exports = Marionette.Layout.extend({
|
||||
this._discover("upcoming");
|
||||
},
|
||||
|
||||
_discoverLists : function() {
|
||||
/*this.ui.discoverLists.tab("show");
|
||||
this.ui.discoverHeader.html("");*/
|
||||
},
|
||||
|
||||
_discoverList : function(options) {
|
||||
this.ui.discoverLists.tab("show");
|
||||
this.ui.discoverHeader.html("Showing movies from list: "+options.target.textContent);
|
||||
|
||||
this.collection.reset();
|
||||
this.collection = new AddFromListCollection();
|
||||
this.listenTo(this.collection, 'sync', this._showResults);
|
||||
this.searchResult.show(new LoadingView());
|
||||
this.currentSearchPromise = this.collection.fetch({ data: { listId: options.target.value } });
|
||||
this.resultCollectionView.collection = this.collection;
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
@@ -10,6 +10,13 @@
|
||||
<li><a href="#media-management" class="x-recommendations-tab no-router">Recommendations</a></li>
|
||||
<li><a href="#popular" class="x-popular-tab no-router">Popular</a></li>
|
||||
<li><a href="#upcoming" class="x-upcoming-tab no-router">Upcoming</a></li>
|
||||
<li role="presentation" class="dropdown">
|
||||
<a class="dropdown-toggle x-lists-tab" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
|
||||
Lists <span class="caret"></span>
|
||||
</a>
|
||||
<ul id="list-dropdown" class="dropdown-menu">
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<h2 class="x-discover-header">
|
||||
Recommendations by The Movie Database based on your library:
|
||||
|
13
src/UI/AddMovies/DiscoverableListDropdownView.js
Normal file
13
src/UI/AddMovies/DiscoverableListDropdownView.js
Normal file
@@ -0,0 +1,13 @@
|
||||
var Marionette = require('marionette');
|
||||
|
||||
module.exports = Marionette.CompositeView.extend({
|
||||
template : 'AddMovies/DiscoverableListDropdownViewTemplate',
|
||||
|
||||
initialize : function(lists) {
|
||||
this.lists = lists;
|
||||
},
|
||||
|
||||
templateHelpers : function() {
|
||||
return this.lists;
|
||||
}
|
||||
});
|
@@ -0,0 +1,3 @@
|
||||
{{#each this}}
|
||||
<li value="{{id}}" class="clickable discoverable-list-item">{{name}}</option>
|
||||
{{/each}}
|
@@ -5,6 +5,7 @@ var _ = require('underscore');
|
||||
module.exports = Backbone.Collection.extend({
|
||||
url : window.NzbDrone.ApiRoot + '/netimport/movies',
|
||||
model : MovieModel,
|
||||
specialProperty: "special",
|
||||
|
||||
parse : function(response) {
|
||||
var self = this;
|
||||
|
@@ -6,9 +6,9 @@
|
||||
}
|
||||
|
||||
.page-size {
|
||||
display: inline-block;
|
||||
width: 200px;
|
||||
float: right;
|
||||
display: inline-block;
|
||||
width: 200px;
|
||||
float: right;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
@@ -148,6 +148,22 @@
|
||||
}
|
||||
}
|
||||
|
||||
#list-dropdown {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.discoverable-list-item {
|
||||
font-size: 14px;
|
||||
padding-top: 5px;
|
||||
padding-left: 15px;
|
||||
padding-right: 15px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.discoverable-list-item:hover {
|
||||
background-color: rgb(237, 237, 237);
|
||||
}
|
||||
|
||||
li.add-new {
|
||||
.clickable;
|
||||
|
||||
|
Reference in New Issue
Block a user