diff --git a/UI/AddSeries/AddSeriesView.js b/UI/AddSeries/AddSeriesView.js index a28433c53..324ac0f90 100644 --- a/UI/AddSeries/AddSeriesView.js +++ b/UI/AddSeries/AddSeriesView.js @@ -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.'); diff --git a/UI/AddSeries/NotFoundTemplate.html b/UI/AddSeries/NotFoundTemplate.html new file mode 100644 index 000000000..fa6c8f5b2 --- /dev/null +++ b/UI/AddSeries/NotFoundTemplate.html @@ -0,0 +1,8 @@ +
+

+ Sorry. We couldn't find any series matching '{{term}}' +

+ Why can't I find my show? + +
+{{debug}} diff --git a/UI/AddSeries/NotFoundView.js b/UI/AddSeries/NotFoundView.js new file mode 100644 index 000000000..e59c3e4f5 --- /dev/null +++ b/UI/AddSeries/NotFoundView.js @@ -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; + } + + }); + }); diff --git a/UI/AddSeries/RootFolders/RootFolderSelectionPartial.html b/UI/AddSeries/RootFolders/RootFolderSelectionPartial.html index 56d547da5..64e1e9358 100644 --- a/UI/AddSeries/RootFolders/RootFolderSelectionPartial.html +++ b/UI/AddSeries/RootFolders/RootFolderSelectionPartial.html @@ -1,10 +1,12 @@ - +
+ +
diff --git a/UI/AddSeries/SearchResultView.js b/UI/AddSeries/SearchResultView.js index 28ba1a774..e19bfecaf 100644 --- a/UI/AddSeries/SearchResultView.js +++ b/UI/AddSeries/SearchResultView.js @@ -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; }); diff --git a/UI/AddSeries/SearchResultViewTemplate.html b/UI/AddSeries/SearchResultViewTemplate.html index 574422b17..091c8bb35 100644 --- a/UI/AddSeries/SearchResultViewTemplate.html +++ b/UI/AddSeries/SearchResultViewTemplate.html @@ -2,7 +2,8 @@
- +
@@ -14,22 +15,23 @@ {{overview}}
- {{#if existing}} +
+ {{#if existing}}
Already Exists
- {{else}} + {{else}} {{#unless path}} - {{> RootFolderSelectionPartial rootFolders}} + {{> RootFolderSelectionPartial rootFolders}} {{/unless}} {{> StartingSeasonSelectionPartial seasons}} {{> QualityProfileSelectionPartial qualityProfiles}} - -
- Add -
- {{/if}} + Add + + + {{/if}} +
diff --git a/UI/Content/theme.less b/UI/Content/theme.less index a11ceb566..debaf887c 100644 --- a/UI/Content/theme.less +++ b/UI/Content/theme.less @@ -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; -} \ No newline at end of file + color : @errorText; +} + +.form-inline { + div { + display : inline-block; + } +} + +.error { + .formFieldState(@errorText, @errorText, @errorBackground); +} diff --git a/UI/app.js b/UI/app.js index 73d8be5e5..280a16d39 100644 --- a/UI/app.js +++ b/UI/app.js @@ -36,7 +36,8 @@ require.config({ init: function () { require( [ - 'jQuery/ToTheTop' + 'jQuery/ToTheTop', + 'Instrumentation/ErrorHandler' ]); } diff --git a/UI/jQuery/jquery.validation.js b/UI/jQuery/jquery.validation.js index ca03d0aa7..6f94a50db 100644 --- a/UI/jQuery/jquery.validation.js +++ b/UI/jQuery/jquery.validation.js @@ -31,7 +31,13 @@ define( } var controlGroup = input.parents('.control-group'); - controlGroup.find('.controls').append('' + error.errorMessage + ''); + + if(controlGroup.length ===0){ + controlGroup = input.parent(); + } + else{ + controlGroup.find('.controls').append('' + error.errorMessage + ''); + } controlGroup.addClass('error');