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', 'marionette',
'AddSeries/Collection', 'AddSeries/Collection',
'AddSeries/SearchResultCollectionView', 'AddSeries/SearchResultCollectionView',
'Shared/LoadingView' 'AddSeries/NotFoundView',
], function (App, Marionette, AddSeriesCollection, SearchResultCollectionView, LoadingView) { 'Shared/LoadingView',
], function (App, Marionette, AddSeriesCollection, SearchResultCollectionView, NotFoundView, LoadingView) {
return Marionette.Layout.extend({ return Marionette.Layout.extend({
template: 'AddSeries/AddSeriesTemplate', template: 'AddSeries/AddSeriesTemplate',
@ -44,6 +45,8 @@ define(
else { else {
this.className = 'new-series'; this.className = 'new-series';
} }
this.listenTo(this.collection, 'sync', this._showResults);
}, },
_onSeriesAdded: function (options) { _onSeriesAdded: function (options) {
@ -78,8 +81,6 @@ define(
search: function (options) { search: function (options) {
var self = this;
this.abortExistingSearch(); this.abortExistingSearch();
this.collection.reset(); this.collection.reset();
@ -89,20 +90,29 @@ define(
} }
else { else {
this.searchResult.show(new LoadingView()); this.searchResult.show(new LoadingView());
this.collection.term = options.term;
this.currentSearchPromise = this.collection.fetch({ this.currentSearchPromise = this.collection.fetch({
data: { term: options.term } 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; 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 () { abortExistingSearch: function () {
if (this.currentSearchPromise && this.currentSearchPromise.readyState > 0 && this.currentSearchPromise.readyState < 4) { if (this.currentSearchPromise && this.currentSearchPromise.readyState > 0 && this.currentSearchPromise.readyState < 4) {
console.log('aborting previous pending search request.'); 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,10 +1,12 @@
<select class="span4 x-root-folder"> <div>
{{#if this}} <select class="span4 x-root-folder" validation-name="RootFolderPath">
{{#each this}} {{#if this}}
<option value="{{id}}">{{path}}</option> {{#each this}}
{{/each}} <option value="{{id}}">{{path}}</option>
{{else}} {{/each}}
<option value="">Select Path</option> {{else}}
{{/if}} <option value="">Select Path</option>
<option value="addNew">Add a different path</option> {{/if}}
</select> <option value="addNew">Add a different path</option>
</select>
</div>

@ -9,10 +9,11 @@ define(
'Series/SeriesCollection', 'Series/SeriesCollection',
'Config', 'Config',
'Shared/Messenger', 'Shared/Messenger',
'Mixins/AsValidatedView',
'jquery.dotdotdot' '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', template: 'AddSeries/SearchResultViewTemplate',
@ -146,4 +147,9 @@ define(
}); });
} }
}); });
AsValidatedView.apply(view);
return view;
}); });

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

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

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

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

Loading…
Cancel
Save