added not found placeholder in add series

added path validation to add series
pull/4/head
Keivan Beigi 11 years ago
parent cdb195a44f
commit ac18d6c704

@ -5,8 +5,9 @@ define(
'marionette',
'AddSeries/Collection',
'AddSeries/SearchResultCollectionView',
'Shared/LoadingView'
], function (App, Marionette, AddSeriesCollection, SearchResultCollectionView, LoadingView) {
'AddSeries/NotFoundView',
'Shared/LoadingView',
], function (App, Marionette, AddSeriesCollection, SearchResultCollectionView, NotFoundView, LoadingView) {
return Marionette.Layout.extend({
template: 'AddSeries/AddSeriesTemplate',
@ -44,6 +45,8 @@ define(
else {
this.className = 'new-series';
}
this.listenTo(this.collection, 'sync', this._showResults);
},
_onSeriesAdded: function (options) {
@ -78,8 +81,6 @@ define(
search: function (options) {
var self = this;
this.abortExistingSearch();
this.collection.reset();
@ -89,20 +90,29 @@ define(
}
else {
this.searchResult.show(new LoadingView());
this.collection.term = options.term;
this.currentSearchPromise = this.collection.fetch({
data: { term: options.term }
}).done(function () {
if (!self.isClosed) {
self.searchResult.show(self.resultCollectionView);
if (!self.showingAll && self.isExisting) {
self.ui.loadMore.show();
}
}
});
}
return this.currentSearchPromise;
},
_showResults: function () {
if (!this.isClosed) {
if (this.collection.length === 0) {
this.searchResult.show(new NotFoundView({term: this.collection.term}));
}
else {
this.searchResult.show(this.resultCollectionView);
if (!this.showingAll && this.isExisting) {
this.ui.loadMore.show();
}
}
}
},
abortExistingSearch: function () {
if (this.currentSearchPromise && this.currentSearchPromise.readyState > 0 && this.currentSearchPromise.readyState < 4) {
console.log('aborting previous pending search request.');

@ -0,0 +1,8 @@
<div class="text-center span12">
<h3>
Sorry. We couldn't find any series matching '{{term}}'
</h3>
<a href="https://github.com/NzbDrone/NzbDrone/wiki/FAQ#why-cant-i-add-a-new-show-to-nzbdrone-its-on-thetvdb">Why can't I find my show?</a>
</div>
{{debug}}

@ -0,0 +1,20 @@
'use strict';
define(
[
'marionette'
], function (Marionette) {
return Marionette.CompositeView.extend({
template: 'AddSeries/NotFoundTemplate',
initialize: function (options) {
this.options = options;
},
templateHelpers: function () {
return this.options;
}
});
});

@ -1,4 +1,5 @@
<select class="span4 x-root-folder">
<div>
<select class="span4 x-root-folder" validation-name="RootFolderPath">
{{#if this}}
{{#each this}}
<option value="{{id}}">{{path}}</option>
@ -8,3 +9,4 @@
{{/if}}
<option value="addNew">Add a different path</option>
</select>
</div>

@ -9,10 +9,11 @@ define(
'Series/SeriesCollection',
'Config',
'Shared/Messenger',
'Mixins/AsValidatedView',
'jquery.dotdotdot'
], function (App, Marionette, QualityProfiles, RootFolders, RootFolderLayout, SeriesCollection, Config, Messenger) {
], function (App, Marionette, QualityProfiles, RootFolders, RootFolderLayout, SeriesCollection, Config, Messenger, AsValidatedView) {
return Marionette.ItemView.extend({
var view = Marionette.ItemView.extend({
template: 'AddSeries/SearchResultViewTemplate',
@ -146,4 +147,9 @@ define(
});
}
});
AsValidatedView.apply(view);
return view;
});

@ -2,7 +2,8 @@
<div class="row">
<div class="span2">
<a href="{{traktUrl}}" target="_blank">
<img class="new-series-poster" src="{{remotePoster}}" {{defaultImg}} >
<img class="new-series-poster" src="{{remotePoster}}"
{{defaultImg}} >
</a>
</div>
<div class="span9">
@ -14,6 +15,7 @@
{{overview}}
</div>
<div class="row">
<form class="form-inline">
{{#if existing}}
<div class="btn add-series disabled pull-right">
Already Exists
@ -25,11 +27,11 @@
{{> StartingSeasonSelectionPartial seasons}}
{{> QualityProfileSelectionPartial qualityProfiles}}
<div class="span1 btn btn-success x-add add-series pull-right">
Add <i class="icon-plus"></i>
</div>
<span class="btn btn-success x-add add-series pull-right"> Add
<i class="icon-plus"></i>
</span>
{{/if}}
</form>
</div>
</div>
</div>

@ -46,6 +46,10 @@
margin-bottom : 30px;
}
.page-container {
min-height : 500px;
}
#scroll-up {
.clickable;
@ -161,3 +165,13 @@ footer {
.status-danger {
color : @errorText;
}
.form-inline {
div {
display : inline-block;
}
}
.error {
.formFieldState(@errorText, @errorText, @errorBackground);
}

@ -36,7 +36,8 @@ require.config({
init: function () {
require(
[
'jQuery/ToTheTop'
'jQuery/ToTheTop',
'Instrumentation/ErrorHandler'
]);
}

@ -31,7 +31,13 @@ define(
}
var controlGroup = input.parents('.control-group');
if(controlGroup.length ===0){
controlGroup = input.parent();
}
else{
controlGroup.find('.controls').append('<span class="help-inline error-message">' + error.errorMessage + '</span>');
}
controlGroup.addClass('error');

Loading…
Cancel
Save