removed backbone from VS solution,

renamed NzbDrone.Backbone to UI
This commit is contained in:
kay.one 2013-03-29 12:18:44 -07:00
commit 663160c06a
230 changed files with 57 additions and 386 deletions

View file

@ -0,0 +1 @@
<td colspan="8">No series found</td>

View file

@ -0,0 +1,94 @@
'use strict';
define(['app', 'Quality/QualityProfileCollection', 'Series/Index/SeriesItemView'], function (app, qualityProfileCollection) {
NzbDrone.Series.Index.SeriesIndexCollectionView = Backbone.Marionette.CompositeView.extend({
itemView: NzbDrone.Series.Index.SeriesItemView,
itemViewContainer: 'tbody',
template: 'Series/Index/SeriesIndexTemplate',
qualityProfileCollection: qualityProfileCollection,
//emptyView: NzbDrone.Series.EmptySeriesCollectionView,
initialize: function () {
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'
},
onItemRemoved: function()
{
this.ui.table.trigger('update');
},
onCompositeCollectionRendered: function()
{
this.ui.table.trigger('update');
if(!this.tableSorter && this.collection.length > 0)
{
this.tableSorter = this.ui.table.tablesorter({
textExtraction: function (node) {
return node.innerHTML;
},
sortList: [[1,0]],
headers: {
0: {
sorter: 'title'
},
1: {
sorter: 'innerHtml'
},
5: {
sorter: 'date'
},
6: {
sorter: false
},
7: {
sorter: false
}
}
});
this.applySortIcons();
this.ui.table.bind("sortEnd", function() {
this.applySortIcons();
});
}
else
{
this.ui.table.trigger('update');
}
},
//Todo: Remove this from each view that requires it
applySortIcons: function() {
$(this.ui.table).find('th.tablesorter-header .tablesorter-header-inner i').each(function(){
$(this).remove();
});
$(this.ui.table).find('th.tablesorter-header').each(function () {
if ($(this).hasClass('tablesorter-headerDesc'))
$(this).children('.tablesorter-header-inner').append('<i class="icon-sort-up pull-right">');
else if ($(this).hasClass('tablesorter-headerAsc'))
$(this).children('.tablesorter-header-inner').append('<i class="icon-sort-down pull-right">');
else if (!$(this).hasClass('sorter-false'))
$(this).children('.tablesorter-header-inner').append('<i class="icon-sort pull-right">');
});
}
});
});
NzbDrone.Series.Index.EmptySeriesCollectionView = Backbone.Marionette.CompositeView.extend({
template: 'Series/Index/EmptySeriesCollectionTemplate',
tagName: 'tr'
});

View file

@ -0,0 +1,15 @@
<table class="table table-hover x-series-table">
<thead>
<tr>
<th title="Status"></th>
<th>Title</th>
<th>Seasons</th>
<th>Quality</th>
<th>Network</th>
<th>Next Airing</th>
<th>Episodes</th>
<th></th>
</tr>
</thead>
<tbody></tbody>
</table>

View file

@ -0,0 +1,17 @@
<td>{{{formatStatus status monitored}}}</td>
<td><a href="/series/details/{{id}}">{{title}}</a></td>
<td name="seasonCount"></td>
<td name="qualityProfileName"></td>
<td name="network"></td>
<!-- If only DT could access the backbone model -->
<td><span title="{{formatedDateString}}" data-date="{{nextAiring}}">{{bestDateString}}</span></td>
<td>
<div class="progress">
<span class="progressbar-back-text">{{episodeFileCount}} / {{episodeCount}}</span>
<div class="bar" style="width:{{percentOfEpisodes}}%"><span class="progressbar-front-text">{{episodeFileCount}} / {{episodeCount}}</span></div>
</div>
</td>
<td>
<i class="icon-cog x-edit" title="Edit Series"></i>
<i class="icon-remove x-remove" title="Delete Series"></i>
</td>

View file

@ -0,0 +1,48 @@
'use strict';
define([
'app',
'Quality/QualityProfileCollection',
'Series/SeriesCollection',
'Series/Edit/EditSeriesView',
'Series/Delete/DeleteSeriesView'
], function () {
NzbDrone.Series.Index.SeriesItemView = Backbone.Marionette.ItemView.extend({
template: 'Series/Index/SeriesItemTemplate',
tagName: 'tr',
ui: {
'progressbar': '.progress .bar'
},
events: {
'click .x-edit': 'editSeries',
'click .x-remove': 'removeSeries'
},
initialize: function (options) {
this.qualityProfileCollection = options.qualityProfiles;
},
onRender: function () {
NzbDrone.ModelBinder.bind(this.model, this.el);
},
editSeries: function () {
var view = new NzbDrone.Series.Edit.EditSeriesView({ model: this.model});
NzbDrone.vent.trigger(NzbDrone.Events.OpenModalDialog, {
view: view
});
},
removeSeries: function () {
var view = new NzbDrone.Series.Delete.DeleteSeriesView({ model: this.model });
NzbDrone.vent.trigger(NzbDrone.Events.OpenModalDialog, {
view: view
});
}
});
});