Merge branch 'series-grid' into vnext

Conflicts:
	UI/Config.js
pull/23/head
Mark McDowall 12 years ago
parent d81e0885c3
commit 35e2e83595

@ -32,9 +32,9 @@ namespace NzbDrone.Api.Series
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<Core.MediaCover.MediaCover> Images { get; set; }
//View & Edit
public String Path { get; set; }

@ -2,7 +2,6 @@
<FileVersion>1</FileVersion>
<AutoEnableOnStartup>False</AutoEnableOnStartup>
<AllowParallelTestExecution>true</AllowParallelTestExecution>
<AllowTestsToRunInParallelWithThemselves>true</AllowTestsToRunInParallelWithThemselves>
<FrameworkUtilisationTypeForNUnit>UseDynamicAnalysis</FrameworkUtilisationTypeForNUnit>
<FrameworkUtilisationTypeForGallio>Disabled</FrameworkUtilisationTypeForGallio>
<FrameworkUtilisationTypeForMSpec>Disabled</FrameworkUtilisationTypeForMSpec>

@ -69,4 +69,6 @@
.img-polaroid {
min-width: 138px;
min-height: 203px;
max-width: 138px;
max-height: 203px;
}

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

@ -22,6 +22,7 @@
<link href="/content/menu.css" rel='stylesheet' type='text/css'/>
<link href="/content/form.css" rel='stylesheet' type='text/css'/>
<link href="/content/settings.quality.css" rel='stylesheet' type='text/css'/>
<link href="/series/series.css" rel='stylesheet' type='text/css'/>
</head>
<body>
<div id="in-nav">

@ -0,0 +1,41 @@
<div class="series-item">
<div class="row">
<div class="span2">
<a href="/series/details/{{id}}" target="_blank">
<img class="series-poster img-polaroid" src="{{poster}}">
</a>
</div>
<div class="span10">
<div class="row">
<div class="span9">
<h2>{{title}}</h2>
</div>
<div class="span1">
<div class="pull-right">
<i class="icon-cog x-edit" title="Edit Series"></i>
<i class="icon-remove x-remove" title="Delete Series"></i>
</div>
</div>
</div>
<div class="row">
<div class="span10">
{{overview}}
</div>
</div>
<div class="row">&nbsp;</div>
<div class="row">
<div class="span10">
{{#if isContinuing}}
{{#if bestDateString}}
<span class="label">{{bestDateString}}</span>
{{else}}
<span class="label label-inverse">{{status}}</span>
{{/if}}
{{else}}
<span class="label label-important">{{status}}</span>
{{/if}}
</div>
</div>
</div>
</div>
</div>

@ -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('<i class="icon-sort pull-right">');
}
});
},
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();
}
});
});

@ -0,0 +1,18 @@
<div class="row">
<div class="span10"></div>
<div class="span2">
<div class="pull-right">
<div class="btn-toolbar">
<div class="btn-group">
<a class="btn x-series-change-view x-series-show-table" href="#" title="table"><i class="icon-table"></i></a>
<a class="btn x-series-change-view x-series-show-grid active" href="#" title="grid"><i class="icon-list"></i></a>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="span12">
<div id="x-series"></div>
</div>
</div>

@ -1,4 +1,17 @@
<table class="table table-hover x-series-table">
<div class="row">
<div class="span10"></div>
<div class="span2">
<div class="pull-right">
<div class="btn-toolbar">
<div class="btn-group">
<a class="btn x-series-change-view x-series-show-table active" href="#" title="table"><i class="icon-table"></i></a>
<a class="btn x-series-change-view x-series-show-grid" href="#" title="grid"><i class="icon-list"></i></a>
</div>
</div>
</div>
</div>
</div>
<table class="table table-hover x-series-table">
<thead>
<tr>
<th title="Status"></th>
@ -11,5 +24,5 @@
<th></th>
</tr>
</thead>
<tbody></tbody>
<tbody id="x-series"></tbody>
</table>

@ -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 () {

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

@ -0,0 +1,3 @@
.series-item {
padding-bottom: 20px;
}
Loading…
Cancel
Save