cleaned up all the cells. there is a cell for pretty much everything.

This commit is contained in:
kay.one 2013-06-09 13:51:32 -07:00
commit 70cfa5e685
42 changed files with 432 additions and 261 deletions

View file

@ -1,34 +0,0 @@
"use strict";
define(['app', 'Episode/Layout'], function () {
NzbDrone.Series.Details.EpisodeStatusCell = Backgrid.Cell.extend({
className: 'episode-status-cell',
render: function () {
this.$el.empty();
if (this.model) {
var icon;
if (this.model.get('episodeFile')) {
icon = 'icon-ok';
}
else {
if (this.model.get('hasAired')) {
icon = 'icon-warning-sign';
}
else {
icon = 'icon-time';
}
}
this.$el.html('<i class="{0}"/>'.format(icon));
}
return this;
}
});
});

View file

@ -1,17 +0,0 @@
"use strict";
define(['app', 'Episode/Layout'], function () {
NzbDrone.Series.Details.EpisodeTitleCell = Backgrid.StringCell.extend({
className: 'episode-title-cell',
events: {
'click': 'showDetails'
},
showDetails: function () {
var view = new NzbDrone.Episode.Layout({ model: this.model });
NzbDrone.modalRegion.show(view);
}
});
});

View file

@ -1,64 +1,68 @@
'use strict';
define(['app', 'Series/Details/EpisodeStatusCell', 'Series/Details/EpisodeTitleCell','Shared/Cells/ToggleCell'], function () {
NzbDrone.Series.Details.SeasonLayout = Backbone.Marionette.Layout.extend({
template: 'Series/Details/SeasonLayoutTemplate',
define([
'app',
'Cells/EpisodeStatusCell',
'Cells/EpisodeTitleCell',
'Cells/AirDateCell',
'Cells/ToggleCell'],
function () {
NzbDrone.Series.Details.SeasonLayout = Backbone.Marionette.Layout.extend({
template: 'Series/Details/SeasonLayoutTemplate',
regions: {
episodeGrid: '#x-episode-grid'
},
columns: [
{
name : 'ignored',
label: '',
cell : NzbDrone.Shared.Cells.ToggleCell,
trueClass : 'icon-bookmark-empty',
falseClass :'icon-bookmark'
},
{
name : 'episodeNumber',
label: '#',
cell : Backgrid.IntegerCell.extend({
className: 'episode-number-cell'
})
regions: {
episodeGrid: '#x-episode-grid'
},
{
name : 'title',
label: 'Title',
cell : NzbDrone.Series.Details.EpisodeTitleCell
},
{
name : 'airDate',
label: 'Air Date',
cell : Backgrid.DateCell.extend({
className: 'episode-air-date-cell'
})
} ,
{
name : 'status',
label: 'Status',
cell : NzbDrone.Series.Details.EpisodeStatusCell
}
],
columns: [
initialize: function (options) {
if (!options.episodeCollection) {
throw 'episodeCollection is needed';
}
this.episodeCollection = options.episodeCollection.bySeason(this.model.get('seasonNumber'));
},
onShow: function () {
this.episodeGrid.show(new Backgrid.Grid(
{
columns : this.columns,
collection: this.episodeCollection,
className : 'table table-hover season-grid'
}));
}
name : 'ignored',
label : '',
cell : NzbDrone.Cells.ToggleCell,
trueClass : 'icon-bookmark-empty',
falseClass: 'icon-bookmark'
},
{
name : 'episodeNumber',
label: '#',
cell : Backgrid.IntegerCell.extend({
className: 'episode-number-cell'
})
},
{
name : 'this',
label: 'Title',
cell : NzbDrone.Cells.EpisodeTitleCell
},
{
name : 'airDate',
label: 'Air Date',
cell : NzbDrone.Cells.AirDateCell
} ,
{
name : 'status',
label: 'Status',
cell : NzbDrone.Cells.EpisodeStatusCell
}
],
initialize: function (options) {
if (!options.episodeCollection) {
throw 'episodeCollection is needed';
}
this.episodeCollection = options.episodeCollection.bySeason(this.model.get('seasonNumber'));
},
onShow: function () {
this.episodeGrid.show(new Backgrid.Grid(
{
columns : this.columns,
collection: this.episodeCollection,
className : 'table table-hover season-grid'
}));
}
});
});
});

View file

@ -1,5 +1,5 @@
'use strict';
define(['app', 'Series/SeriesModel', 'Series/Delete/DeleteSeriesView', 'Quality/QualityProfileCollection'], function () {
define(['app', 'Series/SeriesModel', 'Series/Delete/DeleteSeriesView', 'Quality/QualityProfileCollection'], function (app, seriesModel, deleteSeriesView, qualityProfiles) {
NzbDrone.Series.Edit.EditSeriesView = Backbone.Marionette.ItemView.extend({
template : 'Series/Edit/EditSeriesTemplate',
@ -16,6 +16,13 @@ define(['app', 'Series/SeriesModel', 'Series/Delete/DeleteSeriesView', 'Quality/
},
initialize : function(){
this.model.set('qualityProfiles',qualityProfiles);
},
saveSeries: function () {
//Todo: Get qualityProfile + backlog setting from UI
var qualityProfile = this.ui.qualityProfile.val();
@ -35,4 +42,4 @@ define(['app', 'Series/SeriesModel', 'Series/Delete/DeleteSeriesView', 'Quality/
}
});
});
});

View file

@ -1,5 +1,5 @@
"use strict";
define(['app'], function () {
define(['app','Series/SeriesModel'], function () {
NzbDrone.Series.EpisodeModel = Backbone.Model.extend({
mutators: {
@ -55,6 +55,13 @@ define(['app'], function () {
}
},
parse: function (model) {
model.series = new NzbDrone.Series.SeriesModel(model.series);
return model;
},
defaults: {
seasonNumber: 0,
status : 0

View file

@ -4,7 +4,9 @@ define([
'Series/Index/List/CollectionView',
'Series/Index/Posters/CollectionView',
'Series/Index/EmptyView',
'Series/Index/Table/AirDateCell',
'Cells/AirDateCell',
'Cells/SeriesTitleCell',
'Cells/TemplatedCell',
'Series/Index/Table/SeriesStatusCell',
'Shared/Toolbar/ToolbarLayout',
'Config',
@ -21,46 +23,48 @@ define([
columns: [
{
name : 'status',
label : '',
cell : 'seriesStatus'
name : 'status',
label: '',
cell : 'seriesStatus'
},
{
name : 'title',
label : 'Title',
cell : Backgrid.TemplateBackedCell.extend({ template: 'Series/Index/Table/SeriesTitleTemplate' })
name : 'this',
label: 'Title',
cell : NzbDrone.Cells.SeriesTitleCell
},
{
name : 'seasonCount',
label : 'Seasons',
cell : 'integer'
name : 'seasonCount',
label: 'Seasons',
cell : 'integer'
},
{
name : 'quality',
label : 'Quality',
cell : 'integer'
name : 'quality',
label: 'Quality',
cell : 'integer'
},
{
name : 'network',
label : 'Network',
cell : 'string'
name : 'network',
label: 'Network',
cell : 'string'
},
{
name : 'nextAiring',
label : 'Next Airing',
cell : 'airDate'
name : 'nextAiring',
label: 'Next Airing',
cell : NzbDrone.Cells.AirDateCell
},
{
name : 'episodes',
label : 'Episodes',
sortable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'Series/EpisodeProgressTemplate' })
name : 'this',
label : 'Episodes',
sortable: false,
template: 'Series/EpisodeProgressTemplate',
cell : NzbDrone.Cells.TemplatedCell
},
{
name : 'edit',
label : '',
sortable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'Series/Index/Table/ControlsColumnTemplate' })
name : 'this',
label : '',
sortable: false,
template: 'Series/Index/Table/ControlsColumnTemplate',
cell : NzbDrone.Cells.TemplatedCell
}
],
@ -92,12 +96,12 @@ define([
_showTable: function () {
var view = new Backgrid.Grid(
{
row : NzbDrone.Series.Index.Table.Row,
columns : this.columns,
collection: this.seriesCollection,
className : 'table table-hover'
});
{
row : NzbDrone.Series.Index.Table.Row,
columns : this.columns,
collection: this.seriesCollection,
className : 'table table-hover'
});
this._fetchCollection(view);
},
@ -149,10 +153,10 @@ define([
//TODO: Move this outside of the function - 'this' is not available for the call back though (use string like events?)
var viewButtons = {
type : 'radio',
storeState : true,
menuKey : 'seriesViewMode',
defaultAction: 'listView',
items : [
storeState : true,
menuKey : 'seriesViewMode',
defaultAction: 'listView',
items : [
{
key : 'tableView',
title : '',

View file

@ -1,13 +0,0 @@
"use strict";
Backgrid.AirDateCell = Backgrid.Cell.extend({
className: "air-date-cell",
render: function () {
this.$el.empty();
var airDate = this.model.get(this.column.get("name"));
this.$el.html(NzbDrone.Shared.FormatHelpers.DateHelper(airDate));
return this;
}
});