From 3559d35d927a5f81adbfd68ca00ecff2c412271b Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Thu, 8 Aug 2013 20:58:44 -0700 Subject: [PATCH] Add existing series, load more will only load 5 results at a time --- UI/AddSeries/AddSeriesView.js | 10 ++++++---- UI/AddSeries/SearchResultCollectionView.js | 12 +++++++++--- UI/AddSeries/addSeries.less | 2 +- UI/System/Layout.js | 5 +++++ 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/UI/AddSeries/AddSeriesView.js b/UI/AddSeries/AddSeriesView.js index 5694c3718..7a6fd002b 100644 --- a/UI/AddSeries/AddSeriesView.js +++ b/UI/AddSeries/AddSeriesView.js @@ -25,11 +25,13 @@ define( }, _onLoadMore: function () { - this.ui.loadMore.hide(); - this.ui.searchBar.show(); - this.resultCollectionView.showAll(); - }, + var showingAll = this.resultCollectionView.showMore(); + if (showingAll) { + this.ui.loadMore.hide(); + this.ui.searchBar.show(); + } + }, initialize: function (options) { this.collection = new AddSeriesCollection({unmappedFolderModel: this.model}); diff --git a/UI/AddSeries/SearchResultCollectionView.js b/UI/AddSeries/SearchResultCollectionView.js index 26799c782..e1d912f01 100644 --- a/UI/AddSeries/SearchResultCollectionView.js +++ b/UI/AddSeries/SearchResultCollectionView.js @@ -11,8 +11,8 @@ define( itemView: SearchResultView, initialize: function (options) { - this.isExisting = options.isExisting; + this.showing = 1; }, showAll: function () { @@ -20,11 +20,17 @@ define( this.render(); }, + showMore: function () { + this.showing += 5; + this.render(); + + return this.showing >= this.collection.length; + }, + appendHtml: function (collectionView, itemView, index) { - if (!this.isExisting || this.showingAll || index === 0) { + if (!this.isExisting || index < this.showing || index === 0) { collectionView.$el.append(itemView.el); } } - }); }); diff --git a/UI/AddSeries/addSeries.less b/UI/AddSeries/addSeries.less index 2e9cd7556..6a4d0258d 100644 --- a/UI/AddSeries/addSeries.less +++ b/UI/AddSeries/addSeries.less @@ -10,7 +10,7 @@ .existing-series { .card(); - margin : 20px 0px; + margin : 30px 0px; .add-series-search { width : 970px; diff --git a/UI/System/Layout.js b/UI/System/Layout.js index 1f392a6b8..5c1b06464 100644 --- a/UI/System/Layout.js +++ b/UI/System/Layout.js @@ -34,6 +34,11 @@ define( icon : 'icon-book', route: 'logs' }, + { + title: 'Check for Update', + icon: 'icon-download-alt', + command: 'applicationUpdate' + }, // { // title : 'Restart', // icon : 'icon-repeat',