added not found placeholder in add series

added path validation to add series
This commit is contained in:
Keivan Beigi 2013-09-17 17:54:57 -07:00
parent cdb195a44f
commit ac18d6c704
9 changed files with 108 additions and 39 deletions

View File

@ -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.');

View File

@ -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}}

View File

@ -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;
}
});
});

View File

@ -1,10 +1,12 @@
<select class="span4 x-root-folder">
{{#if this}}
{{#each this}}
<option value="{{id}}">{{path}}</option>
{{/each}}
{{else}}
<option value="">Select Path</option>
{{/if}}
<option value="addNew">Add a different path</option>
</select>
<div>
<select class="span4 x-root-folder" validation-name="RootFolderPath">
{{#if this}}
{{#each this}}
<option value="{{id}}">{{path}}</option>
{{/each}}
{{else}}
<option value="">Select Path</option>
{{/if}}
<option value="addNew">Add a different path</option>
</select>
</div>

View File

@ -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;
});

View File

@ -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,22 +15,23 @@
{{overview}}
</div>
<div class="row">
{{#if existing}}
<form class="form-inline">
{{#if existing}}
<div class="btn add-series disabled pull-right">
Already Exists
</div>
{{else}}
{{else}}
{{#unless path}}
{{> RootFolderSelectionPartial rootFolders}}
{{> RootFolderSelectionPartial rootFolders}}
{{/unless}}
{{> StartingSeasonSelectionPartial seasons}}
{{> QualityProfileSelectionPartial qualityProfiles}}
<div class="span1 btn btn-success x-add add-series pull-right">
Add <i class="icon-plus"></i>
</div>
{{/if}}
<span class="btn btn-success x-add add-series pull-right"> Add
<i class="icon-plus"></i>
</span>
{{/if}}
</form>
</div>
</div>
</div>

View File

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

View File

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

View File

@ -31,7 +31,13 @@ define(
}
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');