diff --git a/src/UI/AddMovies/AddMoviesLayout.js b/src/UI/AddMovies/AddMoviesLayout.js index 460be57e0..83bd2a673 100644 --- a/src/UI/AddMovies/AddMoviesLayout.js +++ b/src/UI/AddMovies/AddMoviesLayout.js @@ -33,11 +33,15 @@ module.exports = Marionette.Layout.extend({ id : 'add-movies-screen' }, - initialize : function() { + initialize : function(options) { ProfileCollection.fetch(); RootFolderCollection.fetch().done(function() { RootFolderCollection.synced = true; }); + + if (options.action == "search") { + this._addMovies(options); + } }, _toggleExisting : function(e) { @@ -50,7 +54,7 @@ module.exports = Marionette.Layout.extend({ onShow : function() { - this.workspace.show(new AddMoviesView()); + this.workspace.show(new AddMoviesView(this.options)); this.ui.$existing.hide(); }, @@ -72,8 +76,8 @@ module.exports = Marionette.Layout.extend({ AppLayout.modalRegion.show(this.rootFolderLayout); }, - _addMovies : function() { - this.workspace.show(new AddMoviesView()); + _addMovies : function(options) { + this.workspace.show(new AddMoviesView(options)); }, _addFromList : function() { diff --git a/src/UI/AddMovies/AddMoviesView.js b/src/UI/AddMovies/AddMoviesView.js index a871af517..7947a4792 100644 --- a/src/UI/AddMovies/AddMoviesView.js +++ b/src/UI/AddMovies/AddMoviesView.js @@ -26,7 +26,6 @@ module.exports = Marionette.Layout.extend({ }, initialize : function(options) { - this.isExisting = options.isExisting; this.collection = new AddMoviesCollection(); @@ -49,6 +48,11 @@ module.exports = Marionette.Layout.extend({ }); this.throttledSearch = _.debounce(this.search, 1000, { trailing : true }).bind(this); + + if (options.action == "search") { + this.search({term: options.query}); + } + }, onRender : function() { diff --git a/src/UI/Content/navbar.less b/src/UI/Content/navbar.less index 00bee18e5..83dc9cd41 100644 --- a/src/UI/Content/navbar.less +++ b/src/UI/Content/navbar.less @@ -213,6 +213,14 @@ } } + .no-movies-found { + color: #fff; + font-size: 1em; + &:hover { + text-decoration: none; + } + } + ::-webkit-input-placeholder { color: #cccccc; opacity: 0.25; diff --git a/src/UI/Controller.js b/src/UI/Controller.js index 89775a3ba..49d57c7be 100644 --- a/src/UI/Controller.js +++ b/src/UI/Controller.js @@ -19,9 +19,9 @@ module.exports = NzbDroneController.extend({ this.showMainRegion(new AddSeriesLayout({ action : action })); }, - addMovies : function(action) { + addMovies : function(action, query) { this.setTitle("Add Movie"); - this.showMainRegion(new AddMoviesLayout({action : action})); + this.showMainRegion(new AddMoviesLayout({ action : action, query : query })); }, calendar : function() { diff --git a/src/UI/Navbar/Search.js b/src/UI/Navbar/Search.js index 91d1bfaa8..e5a12e8bd 100644 --- a/src/UI/Navbar/Search.js +++ b/src/UI/Navbar/Search.js @@ -14,7 +14,7 @@ var substringMatcher = function() { var matches = _.select(FullMovieCollection.toJSON(), function(series) { return series.title.toLowerCase().indexOf(q.toLowerCase()) > -1; }); - cb(matches); + cb(matches); }; }; @@ -28,6 +28,11 @@ $.fn.bindSearch = function() { displayKey : function(series) { return series.title + ' (' + series.year + ')'; }, + templates : { + empty : function(input) { + return '
' + }, + }, source : substringMatcher() });