mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-19 21:13:28 -07:00
removed backbone from VS solution,
renamed NzbDrone.Backbone to UI
This commit is contained in:
parent
c7776f74e1
commit
663160c06a
230 changed files with 57 additions and 386 deletions
89
UI/Upcoming/UpcomingCollectionView.js
Normal file
89
UI/Upcoming/UpcomingCollectionView.js
Normal file
|
@ -0,0 +1,89 @@
|
|||
'use strict';
|
||||
|
||||
define(['app', 'Upcoming/UpcomingItemView'], function (app) {
|
||||
NzbDrone.Upcoming.UpcomingCollectionView = Backbone.Marionette.CompositeView.extend({
|
||||
itemView: NzbDrone.Upcoming.UpcomingItemView,
|
||||
template: 'Upcoming/UpcomingCollectionTemplate',
|
||||
itemViewContainer: 'table',
|
||||
|
||||
ui: {
|
||||
yesterday: 'tbody#yesterday',
|
||||
today: 'tbody#today',
|
||||
tomorrow: 'tbody#tomorrow',
|
||||
two_days: 'tbody#two_days',
|
||||
three_days: 'tbody#three_days',
|
||||
four_days: 'tbody#four_days',
|
||||
five_days: 'tbody#five_days',
|
||||
six_days: 'tbody#six_days',
|
||||
later: 'tbody#later'
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
this.collection = new NzbDrone.Upcoming.UpcomingCollection();
|
||||
this.collection.fetch();
|
||||
},
|
||||
|
||||
serializeData: function() {
|
||||
var viewData = {};
|
||||
viewData.two_days = Date.create().addDays(2).format('{Weekday}');
|
||||
viewData.three_days = Date.create().addDays(3).format('{Weekday}');
|
||||
viewData.four_days = Date.create().addDays(4).format('{Weekday}');
|
||||
viewData.five_days = Date.create().addDays(5).format('{Weekday}');
|
||||
viewData.six_days = Date.create().addDays(6).format('{Weekday}');
|
||||
return viewData;
|
||||
},
|
||||
|
||||
appendHtml: function(collectionView, itemView, index){
|
||||
var date = Date.create(itemView.model.get('airTime'));
|
||||
|
||||
if (date.isYesterday()){
|
||||
collectionView.$(this.ui.yesterday).append(itemView.el);
|
||||
return;
|
||||
}
|
||||
|
||||
if (date.isToday()){
|
||||
collectionView.$(this.ui.today).append(itemView.el);
|
||||
return;
|
||||
}
|
||||
|
||||
if (date.isTomorrow()){
|
||||
collectionView.$(this.ui.tomorrow).append(itemView.el);
|
||||
return;
|
||||
}
|
||||
|
||||
if (date.is(Date.create().addDays(2).short())){
|
||||
collectionView.$(this.ui.two_days).append(itemView.el);
|
||||
return;
|
||||
}
|
||||
|
||||
if (date.is(Date.create().addDays(3).short())){
|
||||
collectionView.$(this.ui.three_days).append(itemView.el);
|
||||
return;
|
||||
}
|
||||
|
||||
if (date.is(Date.create().addDays(4).short())){
|
||||
collectionView.$(this.ui.four_days).append(itemView.el);
|
||||
return;
|
||||
}
|
||||
|
||||
if (date.is(Date.create().addDays(5).short())){
|
||||
collectionView.$(this.ui.five_days).append(itemView.el);
|
||||
return;
|
||||
}
|
||||
|
||||
if (date.is(Date.create().addDays(6).short())){
|
||||
collectionView.$(this.ui.six_days).append(itemView.el);
|
||||
return;
|
||||
}
|
||||
|
||||
collectionView.$(this.ui.later).append(itemView.el);
|
||||
|
||||
//if (date.isBefore(Date.create().addDays(7))) return date.format('{Weekday}');
|
||||
},
|
||||
|
||||
onCompositeCollectionRendered: function()
|
||||
{
|
||||
//Might not need this :D
|
||||
}
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue