Better Backgrid.Column defaults, much cleaner

pull/2/head
Mark McDowall 12 years ago
parent 16e13e0c24
commit 92d913e4ac

@ -15,73 +15,59 @@ define([
pager : '#x-pager'
},
showTable: function () {
columns: [
{
name : 'indexer',
label : '',
cell : Backgrid.TemplateBackedCell.extend({ template: 'History/IndexerTemplate' })
},
{
name : 'Series.Title',
label : 'Series Title',
cell : Backgrid.TemplateBackedCell.extend({ template: 'Missing/SeriesTitleTemplate' })
},
{
name : 'episode',
label : 'Episode',
sortable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'Missing/EpisodeColumnTemplate' })
},
{
name : 'Episode.Title',
label : 'Episode Title',
sortable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'History/EpisodeTitleTemplate' })
},
{
name : 'quality',
label : 'Quality',
cell : Backgrid.TemplateBackedCell.extend({ template: 'History/QualityTemplate' })
},
{
name : 'date',
label : 'Grabbed',
cell : 'airDate'
},
{
name : 'edit',
label : '',
sortable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'History/ControlsColumnTemplate' })
}
],
var columns = [
{
name : 'indexer',
label : '',
editable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'History/IndexerTemplate' }),
headerCell: 'nzbDrone'
},
{
name : 'Series.Title',
label : 'Series Title',
editable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'Missing/SeriesTitleTemplate' }),
headerCell: 'nzbDrone'
},
{
name : 'episode',
label : 'Episode',
editable : false,
sortable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'Missing/EpisodeColumnTemplate' }),
headerCell: 'nzbDrone'
},
{
name : 'Episode.Title',
label : 'Episode Title',
editable : false,
sortable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'History/EpisodeTitleTemplate' }),
headerCell: 'nzbDrone'
},
{
name : 'quality',
label : 'Quality',
editable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'History/QualityTemplate' }),
headerCell: 'nzbDrone'
},
{
name : 'date',
label : 'Grabbed',
editable : false,
cell : 'airDate',
headerCell: 'nzbDrone'
},
{
name : 'edit',
label : '',
editable : false,
sortable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'History/ControlsColumnTemplate' }),
headerCell: 'nzbDrone'
}
];
showTable: function () {
this.history.show(new Backgrid.Grid(
{
row : NzbDrone.History.Row,
columns : columns,
columns : this.columns,
collection: this.historyCollection,
className : 'table table-hover'
}));
this.pager.show(new Backgrid.NzbDronePaginator({
columns: columns,
columns: this.columns,
collection: this.historyCollection
}));
},

@ -16,59 +16,48 @@ define([
pager : '#x-pager'
},
showTable: function () {
var columns = [
{
name : 'series.Title',
label : 'Series Title',
editable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'Missing/SeriesTitleTemplate' }),
headerCell: 'nzbDrone'
},
{
name : 'episode',
label : 'Episode',
editable : false,
sortable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'Missing/EpisodeColumnTemplate' }),
headerCell: 'nzbDrone'
},
{
name : 'title',
label : 'Episode Title',
editable : false,
sortable : false,
cell : 'string',
headerCell: 'nzbDrone'
},
{
name : 'airDate',
label : 'Air Date',
editable : false,
cell : 'airDate',
headerCell: 'nzbDrone'
},
{
name : 'edit',
label : '',
editable : false,
sortable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'Missing/ControlsColumnTemplate' }),
headerCell: 'nzbDrone'
}
];
columns: [
{
name : 'series.Title',
label : 'Series Title',
cell : Backgrid.TemplateBackedCell.extend({ template: 'Missing/SeriesTitleTemplate' })
},
{
name : 'episode',
label : 'Episode',
sortable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'Missing/EpisodeColumnTemplate' })
},
{
name : 'title',
label : 'Episode Title',
sortable : false,
cell : 'string'
},
{
name : 'airDate',
label : 'Air Date',
cell : 'airDate'
},
{
name : 'edit',
label : '',
sortable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'Missing/ControlsColumnTemplate' })
}
],
showTable: function () {
this.missing.show(new Backgrid.Grid(
{
row : NzbDrone.Missing.Row,
columns : columns,
columns : this.columns,
collection: this.missingCollection,
className : 'table table-hover'
}));
this.pager.show(new Backgrid.NzbDronePaginator({
columns: columns,
columns: this.columns,
collection: this.missingCollection
}));
},

@ -1,5 +1,16 @@
"use strict";
Backgrid.Column.prototype.defaults = {
name: undefined,
label: undefined,
sortable: true,
editable: false,
renderable: true,
formatter: undefined,
cell: undefined,
headerCell: 'nzbDrone'
};
Backgrid.TemplateBackedCell = Backgrid.Cell.extend({
className: '',
template: 'Series/Index/Table/ControlsColumnTemplate',

@ -10,26 +10,23 @@ define(['app', 'Series/Details/EpisodeDetailCell'], function () {
columns: [
{
name : 'details',
editable: false,
label : 'Details',
cell : NzbDrone.Series.Details.EpisodeDetailCell
},
{
name : 'episodeNumber',
label : '#',
editable: false,
cell : 'integer'
},
{
name : 'title',
label : 'Title',
editable: false,
cell : 'string'
},
{
name : 'airDate',
label : 'Air Date',
editable: false,
cell : 'date'
//formatter: new Backgrid.AirDateFormatter()
}

@ -18,73 +18,57 @@ define([
toolbar: '#x-toolbar'
},
showTable: function () {
columns: [
{
name : 'status',
label : '',
cell : 'seriesStatus'
},
{
name : 'title',
label : 'Title',
cell : Backgrid.TemplateBackedCell.extend({ template: 'Series/Index/Table/SeriesTitleTemplate' })
},
{
name : 'seasonCount',
label : 'Seasons',
cell : 'integer'
},
{
name : 'quality',
label : 'Quality',
cell : 'integer'
},
{
name : 'network',
label : 'Network',
cell : 'string'
},
{
name : 'nextAiring',
label : 'Next Airing',
cell : 'airDate'
},
{
name : 'episodes',
label : 'Episodes',
sortable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'Series/EpisodeProgressTemplate' })
},
{
name : 'edit',
label : '',
sortable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'Series/Index/Table/ControlsColumnTemplate' })
}
],
var columns = [
{
name : 'status',
label : '',
editable : false,
cell : 'seriesStatus',
headerCell: 'nzbDrone'
},
{
name : 'title',
label : 'Title',
editable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'Series/Index/Table/SeriesTitleTemplate' }),
headerCell: 'nzbDrone'
},
{
name : 'seasonCount',
label : 'Seasons',
editable : false,
cell : 'integer',
headerCell: 'nzbDrone'
},
{
name : 'quality',
label : 'Quality',
editable : false,
cell : 'integer',
headerCell: 'nzbDrone'
},
{
name : 'network',
label : 'Network',
editable : false,
cell : 'string',
headerCell: 'nzbDrone'
},
{
name : 'nextAiring',
label : 'Next Airing',
editable : false,
cell : 'airDate',
headerCell: 'nzbDrone'
},
{
name : 'episodes',
label : 'Episodes',
editable : false,
sortable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'Series/EpisodeProgressTemplate' }),
headerCell: 'nzbDrone'
},
{
name : 'edit',
label : '',
editable : false,
sortable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'Series/Index/Table/ControlsColumnTemplate' }),
headerCell: 'nzbDrone'
}
];
showTable: function () {
this.series.show(new Backgrid.Grid(
{
row : NzbDrone.Series.Index.Table.Row,
columns : columns,
columns : this.columns,
collection: this.seriesCollection,
className : 'table table-hover'
}));

Loading…
Cancel
Save