diff --git a/NzbDrone.Api/Series/SeriesResource.cs b/NzbDrone.Api/Series/SeriesResource.cs index 84eca11ea..b2347bb34 100644 --- a/NzbDrone.Api/Series/SeriesResource.cs +++ b/NzbDrone.Api/Series/SeriesResource.cs @@ -32,9 +32,9 @@ public class SeriesResource public String Network { get; set; } public String AirTime { get; set; } public String Language { get; set; } - public Int32 SeasonCount { get; set; } public Int32 UtcOffset { get; set; } + public List Images { get; set; } //View & Edit public String Path { get; set; } diff --git a/NzbDrone.ncrunchsolution b/NzbDrone.ncrunchsolution index 444b34b1d..6cb47a29a 100644 --- a/NzbDrone.ncrunchsolution +++ b/NzbDrone.ncrunchsolution @@ -2,7 +2,6 @@ 1 False true - true UseDynamicAnalysis Disabled Disabled diff --git a/UI/AddSeries/addSeries.css b/UI/AddSeries/addSeries.css index e34dc7403..0f4b9017f 100644 --- a/UI/AddSeries/addSeries.css +++ b/UI/AddSeries/addSeries.css @@ -69,4 +69,6 @@ .img-polaroid { min-width: 138px; min-height: 203px; + max-width: 138px; + max-height: 203px; } \ No newline at end of file diff --git a/UI/Config.js b/UI/Config.js index 49fa6b045..d3e436e94 100644 --- a/UI/Config.js +++ b/UI/Config.js @@ -3,21 +3,28 @@ define(['app'], function () { $.cookie.json = true; - NzbDrone.Config.SeriesView = function (value) { - if (value) { - NzbDrone.Config.SetValue('seriesView', value); + NzbDrone.Config.SeriesViewStyle = function (value) { + var key = 'seriesViewStyle'; + + if (value !== undefined) { + NzbDrone.Config.SetValue(key, value); } else{ - return NzbDrone.Config.GetValue('seriesView', 0); + return NzbDrone.Config.GetValue(key, 1); } }; NzbDrone.Config.GetValue = function (key, defaultValue) { var cookie = NzbDrone.Config.GetCookie(); - var value = cookie[key]; - if (!value) { + if (!cookie) { + return defaultValue; + } + + var value = cookie[key]; + + if (value === undefined) { return defaultValue; } @@ -28,7 +35,13 @@ define(['app'], function () { NzbDrone.Config.SetValue = function (key, value) { var cookie = NzbDrone.Config.GetCookie(); + + if (!cookie) { + cookie = {}; + } + cookie[key] = value; + NzbDrone.Config.SetCookie(cookie); }; NzbDrone.Config.GetCookie = function () { @@ -36,6 +49,6 @@ define(['app'], function () { }; NzbDrone.Config.SetCookie = function (cookie) { - $.cookie('NzbDroneConfig', cookie, { expires: 7, path: '/' }); + $.cookie('NzbDroneConfig', cookie, { expires: 365, path: '/' }); }; }); diff --git a/UI/Index.html b/UI/Index.html index cb8fc7a2e..fac935e11 100644 --- a/UI/Index.html +++ b/UI/Index.html @@ -22,6 +22,7 @@ +
diff --git a/UI/Series/Index/SeriesGridItemTemplate.html b/UI/Series/Index/SeriesGridItemTemplate.html new file mode 100644 index 000000000..dbf16a5f3 --- /dev/null +++ b/UI/Series/Index/SeriesGridItemTemplate.html @@ -0,0 +1,41 @@ +
+
+
+ + + +
+
+
+
+

{{title}}

+
+
+
+ + +
+
+
+
+
+ {{overview}} +
+
+
 
+
+
+ {{#if isContinuing}} + {{#if bestDateString}} + {{bestDateString}} + {{else}} + {{status}} + {{/if}} + {{else}} + {{status}} + {{/if}} +
+
+
+
+
\ No newline at end of file diff --git a/UI/Series/Index/SeriesIndexCollectionView.js b/UI/Series/Index/SeriesIndexCollectionView.js index b2de2bf9b..662a7606f 100644 --- a/UI/Series/Index/SeriesIndexCollectionView.js +++ b/UI/Series/Index/SeriesIndexCollectionView.js @@ -1,25 +1,40 @@ 'use strict'; -define(['app', 'Quality/QualityProfileCollection', 'Series/Index/SeriesItemView'], function (app, qualityProfileCollection) { +define(['app', 'Quality/QualityProfileCollection', 'Series/Index/SeriesItemView', 'Config'], function (app, qualityProfileCollection) { NzbDrone.Series.Index.SeriesIndexCollectionView = Backbone.Marionette.CompositeView.extend({ itemView : NzbDrone.Series.Index.SeriesItemView, - itemViewContainer : 'tbody', + itemViewContainer : '#x-series', template : 'Series/Index/SeriesIndexTemplate', qualityProfileCollection: qualityProfileCollection, //emptyView: NzbDrone.Series.EmptySeriesCollectionView, + getTemplate: function(){ + if (this.viewStyle === 1){ + return 'Series/Index/SeriesIndexGridTemplate'; + } + else { + return 'Series/Index/SeriesIndexTemplate'; + } + }, + + ui: { + table: '.x-series-table' + }, + + events: { + 'click .x-series-change-view': 'changeViewTemplate' + }, + initialize: function () { + this.viewStyle = NzbDrone.Config.SeriesViewStyle(); + this.collection = new NzbDrone.Series.SeriesCollection(); //Todo: This caused the onRendered event to be trigger twice, which displays two empty collection messages //http://stackoverflow.com/questions/13065176/backbone-marionette-composit-view-onrender-executing-twice this.collection.fetch(); this.qualityProfileCollection.fetch(); - this.itemViewOptions = { qualityProfiles: this.qualityProfileCollection }; - }, - - ui: { - table: '.x-series-table' + this.itemViewOptions = { qualityProfiles: this.qualityProfileCollection, viewStyle: this.viewStyle }; }, onItemRemoved: function () { @@ -85,6 +100,21 @@ define(['app', 'Quality/QualityProfileCollection', 'Series/Index/SeriesItemView' $(this).children('.tablesorter-header-inner').append(''); } }); + }, + + changeViewTemplate: function(event) { + event.preventDefault(); + if ($(event.currentTarget).hasClass('x-series-show-grid')) { + NzbDrone.Config.SeriesViewStyle(1); + } + + else { + NzbDrone.Config.SeriesViewStyle(0); + } + + this.viewStyle = NzbDrone.Config.SeriesViewStyle(); + this.itemViewOptions.viewStyle = this.viewStyle; + this.render(); } }); }); diff --git a/UI/Series/Index/SeriesIndexGridTemplate.html b/UI/Series/Index/SeriesIndexGridTemplate.html new file mode 100644 index 000000000..d9b9fef0b --- /dev/null +++ b/UI/Series/Index/SeriesIndexGridTemplate.html @@ -0,0 +1,18 @@ +
+
+
+
+
+
+ + +
+
+
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/UI/Series/Index/SeriesIndexTemplate.html b/UI/Series/Index/SeriesIndexTemplate.html index f3ab96165..3e6e50c70 100644 --- a/UI/Series/Index/SeriesIndexTemplate.html +++ b/UI/Series/Index/SeriesIndexTemplate.html @@ -1,4 +1,17 @@ - +
+
+
+
+
+
+ + +
+
+
+
+
+
@@ -11,5 +24,5 @@ - +
diff --git a/UI/Series/Index/SeriesItemView.js b/UI/Series/Index/SeriesItemView.js index adea4e223..9593b23ff 100644 --- a/UI/Series/Index/SeriesItemView.js +++ b/UI/Series/Index/SeriesItemView.js @@ -10,8 +10,18 @@ define([ ], function () { NzbDrone.Series.Index.SeriesItemView = Backbone.Marionette.ItemView.extend({ - template: 'Series/Index/SeriesItemTemplate', tagName : 'tr', + template: 'Series/Index/SeriesItemTemplate', + + getTemplate: function(){ + if (this.viewStyle === 1){ + this.tagName = 'div'; + return 'Series/Index/SeriesGridItemTemplate'; + } + else { + return 'Series/Index/SeriesItemTemplate'; + } + }, ui: { 'progressbar': '.progress .bar' @@ -24,6 +34,7 @@ define([ initialize: function (options) { this.qualityProfileCollection = options.qualityProfiles; + this.viewStyle = options.viewStyle; }, onRender: function () { diff --git a/UI/Series/SeriesModel.js b/UI/Series/SeriesModel.js index a761fb9b7..4c79e1e1a 100644 --- a/UI/Series/SeriesModel.js +++ b/UI/Series/SeriesModel.js @@ -33,6 +33,13 @@ }, traktUrl : function () { return "http://trakt.tv/show/" + this.get('titleSlug'); + }, + isContinuing : function () { + if (this.get('status') === 'Continuing'){ + return true; + } + + return false; } }, diff --git a/UI/Series/series.css b/UI/Series/series.css new file mode 100644 index 000000000..25892af09 --- /dev/null +++ b/UI/Series/series.css @@ -0,0 +1,3 @@ +.series-item { + padding-bottom: 20px; +} \ No newline at end of file