-
+
diff --git a/src/UI/AddMovies/AddMoviesView.js b/src/UI/AddMovies/AddMoviesView.js
index 7185d114f..51dda6128 100644
--- a/src/UI/AddMovies/AddMoviesView.js
+++ b/src/UI/AddMovies/AddMoviesView.js
@@ -1,4 +1,5 @@
var _ = require('underscore');
+var $ = require('jquery');
var vent = require('vent');
var Marionette = require('marionette');
var AddMoviesCollection = require('./AddMoviesCollection');
@@ -7,6 +8,7 @@ var EmptyView = require('./EmptyView');
var NotFoundView = require('./NotFoundView');
var ErrorView = require('./ErrorView');
var LoadingView = require('../Shared/LoadingView');
+var FullMovieCollection = require("../Movies/FullMovieCollection");
module.exports = Marionette.Layout.extend({
template : 'AddMovies/AddMoviesViewTemplate',
@@ -18,7 +20,8 @@ module.exports = Marionette.Layout.extend({
ui : {
moviesSearch : '.x-movies-search',
searchBar : '.x-search-bar',
- loadMore : '.x-load-more'
+ loadMore : '.x-load-more',
+ discoverHeader : ".x-discover-header"
},
events : {
@@ -27,7 +30,7 @@ module.exports = Marionette.Layout.extend({
initialize : function(options) {
this.isExisting = options.isExisting;
- this.collection = new AddMoviesCollection();
+ this.collection = options.collection || new AddMoviesCollection();
if (this.isExisting) {
this.collection.unmappedFolderModel = this.model;
@@ -51,6 +54,13 @@ module.exports = Marionette.Layout.extend({
if (options.action === "search") {
this.search({term: options.query});
+ } else if (options.action == "discover") {
+ this.isDiscover = true;
+ if (FullMovieCollection.length > 0) {
+ this._discover();
+ } else {
+ this.listenTo(FullMovieCollection, "sync", this._discover);
+ }
}
},
@@ -58,6 +68,8 @@ module.exports = Marionette.Layout.extend({
onRender : function() {
var self = this;
+
+
this.$el.addClass(this.className);
this.ui.moviesSearch.keyup(function(e) {
@@ -95,10 +107,21 @@ module.exports = Marionette.Layout.extend({
if (this.isExisting) {
this.ui.searchBar.hide();
}
+
+ if (this.isDiscover) {
+ this.ui.searchBar.hide();
+ if (this.collection.length == 0) {
+ this.searchResult.show(new LoadingView());
+ }
+ }
},
onShow : function() {
+ this.ui.discoverHeader.hide();
this.ui.moviesSearch.focus();
+ if (this.isDiscover) {
+ this.ui.discoverHeader.show();
+ }
},
search : function(options) {
@@ -140,7 +163,10 @@ module.exports = Marionette.Layout.extend({
_onLoadMore : function() {
var showingAll = this.resultCollectionView.showMore();
- this.ui.searchBar.show();
+ if (!this.isDiscover) {
+ this.ui.searchBar.show();
+ }
+
if (showingAll) {
this.ui.loadMore.hide();
@@ -185,5 +211,9 @@ module.exports = Marionette.Layout.extend({
this.searchResult.show(new ErrorView({ term : this.collection.term }));
this.collection.term = '';
}
+ },
+
+ _discover : function() {
+ this.collection.fetch()
}
});
diff --git a/src/UI/AddMovies/AddMoviesViewTemplate.hbs b/src/UI/AddMovies/AddMoviesViewTemplate.hbs
index 9f9e0660c..2fc612744 100644
--- a/src/UI/AddMovies/AddMoviesViewTemplate.hbs
+++ b/src/UI/AddMovies/AddMoviesViewTemplate.hbs
@@ -4,6 +4,9 @@
{{folder.path}}
{{/if}}
+
diff --git a/src/UI/AddMovies/DiscoverMoviesCollection.js b/src/UI/AddMovies/DiscoverMoviesCollection.js
new file mode 100644
index 000000000..962d758ba
--- /dev/null
+++ b/src/UI/AddMovies/DiscoverMoviesCollection.js
@@ -0,0 +1,22 @@
+var Backbone = require('backbone');
+var MovieModel = require('../Movies/MovieModel');
+var _ = require('underscore');
+
+module.exports = Backbone.Collection.extend({
+ url : window.NzbDrone.ApiRoot + "/movies/discover",
+ model : MovieModel,
+
+ parse : function(response) {
+ var self = this;
+
+ _.each(response, function(model) {
+ model.id = undefined;
+
+ if (self.unmappedFolderModel) {
+ model.path = self.unmappedFolderModel.get('folder').path;
+ }
+ });
+
+ return response;
+ }
+});
diff --git a/src/UI/AddMovies/SearchResultCollectionView.js b/src/UI/AddMovies/SearchResultCollectionView.js
index 4e68d63e2..bc10395ac 100644
--- a/src/UI/AddMovies/SearchResultCollectionView.js
+++ b/src/UI/AddMovies/SearchResultCollectionView.js
@@ -2,6 +2,7 @@ var Marionette = require('marionette');
var SearchResultView = require('./SearchResultView');
var FullMovieCollection = require('../Movies/FullMovieCollection');
var vent = require('vent');
+var $ = require("jquery");
module.exports = Marionette.CollectionView.extend({
itemView : SearchResultView,
@@ -28,9 +29,10 @@ module.exports = Marionette.CollectionView.extend({
},
showMore : function() {
+ var pos = $(window).scrollTop();
this.showing += 5;
this.render();
-
+ $(window).scrollTop(pos);
return this.showing >= this.collection.length;
},
diff --git a/src/UI/AddMovies/SearchResultViewTemplate.hbs b/src/UI/AddMovies/SearchResultViewTemplate.hbs
index 3329c4709..65a8dab46 100644
--- a/src/UI/AddMovies/SearchResultViewTemplate.hbs
+++ b/src/UI/AddMovies/SearchResultViewTemplate.hbs
@@ -26,7 +26,10 @@
{{#if_eq status compare="inCinemas"}}
In Cinemas
{{/if_eq}}
+ {{ratings.value}}
+
+
diff --git a/src/UI/Content/icons.less b/src/UI/Content/icons.less
index 51f8caab4..cbe72d3a1 100644
--- a/src/UI/Content/icons.less
+++ b/src/UI/Content/icons.less
@@ -307,6 +307,9 @@
.icon-sonarr-deleted {
.fa-icon-content(@fa-var-trash);
}
+.icon-sonarr-star {
+ .fa-icon-content(@fa-var-star);
+}
.icon-sonarr-clear {
.fa-icon-content(@fa-var-trash);