New movie search (#1212)

* add movie search empty template (#1149)

* hooked up new route in controller (#1149)
pull/2/head
thejacer87 8 years ago committed by Devin Buhl
parent c593f4250d
commit 1b29b89bf1

@ -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() {

@ -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() {

@ -213,6 +213,14 @@
}
}
.no-movies-found {
color: #fff;
font-size: 1em;
&:hover {
text-decoration: none;
}
}
::-webkit-input-placeholder {
color: #cccccc;
opacity: 0.25;

@ -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() {

@ -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 '<div class="tt-dataset-series"><span class="tt-suggestions" style="display: block;"><div class="tt-suggestion"><p style="white-space: normal;"><a class="no-movies-found" href="/addmovies/search/' + input.query + '">Search for "' + input.query + '"</a></p></div></span></div>'
},
},
source : substringMatcher()
});

Loading…
Cancel
Save