removed NzbDrone. namespace, everything is done using require.

This commit is contained in:
Keivan Beigi
2013-06-24 16:41:59 -07:00
parent ef62af75df
commit b0bd3f34f1
121 changed files with 2570 additions and 2587 deletions
+11 -11
View File
@@ -1,12 +1,12 @@
'use strict';
define([
'app',
'Calendar/UpcomingCollectionView',
'Calendar/CalendarView',
'Shared/Toolbar/ToolbarLayout'
],
function () {
NzbDrone.Calendar.CalendarLayout = Backbone.Marionette.Layout.extend({
define(
[
'marionette',
'Calendar/UpcomingCollection',
'Calendar/UpcomingCollectionView',
'Calendar/CalendarView',
], function (Marionette, UpcomingCollection, UpcomingCollectionView, CalendarView) {
return Marionette.Layout.extend({
template: 'Calendar/CalendarLayoutTemplate',
regions: {
@@ -15,7 +15,7 @@ define([
},
initialize: function () {
this.upcomingCollection = new NzbDrone.Calendar.UpcomingCollection();
this.upcomingCollection = new UpcomingCollection();
this.upcomingCollection.fetch();
},
@@ -25,13 +25,13 @@ define([
},
_showUpcoming: function () {
this.upcoming.show(new NzbDrone.Calendar.UpcomingCollectionView({
this.upcoming.show(new UpcomingCollectionView({
collection: this.upcomingCollection
}));
},
_showCalendar: function () {
this.calendar.show(new NzbDrone.Calendar.CalendarView());
this.calendar.show(new CalendarView());
}
});
});
+77 -71
View File
@@ -1,81 +1,87 @@
'use strict';
'use strict';
define(['app', 'Calendar/Collection','fullcalendar'], function () {
NzbDrone.Calendar.CalendarView = Backbone.Marionette.ItemView.extend({
initialize : function () {
this.collection = new NzbDrone.Calendar.Collection();
},
render: function () {
$(this.$el).empty().fullCalendar({
defaultView : 'basicWeek',
allDayDefault : false,
ignoreTimezone: false,
weekMode : 'variable',
timeFormat : 'h(:mm)tt',
header : {
left : 'prev,next today',
center: 'title',
right : 'month,basicWeek'
},
buttonText : {
prev: '<i class="icon-arrow-left"></i>',
next: '<i class="icon-arrow-right"></i>'
},
events : this.getEvents,
eventRender : function (event, element) {
$(element).addClass(event.statusLevel);
$(element).children('.fc-event-inner').addClass(event.statusLevel);
define(
[
'marionette',
'Calendar/Collection',
'fullcalendar'
], function (Marionette, CalendarCollection) {
element.popover({
title : '{seriesTitle} - {season}x{episode} - {episodeTitle}'.assign({
seriesTitle : event.title,
season : event.seasonNumber,
episode : event.episodeNumber.pad(2),
episodeTitle: event.episodeTitle
}),
content : event.overview,
placement: 'bottom',
trigger : 'manual'
});
},
eventMouseover: function () {
$(this).popover('show');
},
eventMouseout : function () {
$(this).popover('hide');
}
});
var _instance;
NzbDrone.Calendar.CalendarView.Instance = this;
},
return Marionette.ItemView.extend({
initialize: function () {
this.collection = new CalendarCollection();
},
render : function () {
$(this.$el).empty().fullCalendar({
defaultView : 'basicWeek',
allDayDefault : false,
ignoreTimezone: false,
weekMode : 'variable',
timeFormat : 'h(:mm)tt',
header : {
left : 'prev,next today',
center: 'title',
right : 'month,basicWeek'
},
buttonText : {
prev: '<i class="icon-arrow-left"></i>',
next: '<i class="icon-arrow-right"></i>'
},
events : this.getEvents,
eventRender : function (event, element) {
$(element).addClass(event.statusLevel);
$(element).children('.fc-event-inner').addClass(event.statusLevel);
onShow: function () {
this.$('.fc-button-today').click();
},
element.popover({
title : '{seriesTitle} - {season}x{episode} - {episodeTitle}'.assign({
seriesTitle : event.title,
season : event.seasonNumber,
episode : event.episodeNumber.pad(2),
episodeTitle: event.episodeTitle
}),
content : event.overview,
placement: 'bottom',
trigger : 'manual'
});
},
eventMouseover: function () {
$(this).popover('show');
},
eventMouseout : function () {
$(this).popover('hide');
}
});
getEvents: function (start, end, callback) {
var bbView = NzbDrone.Calendar.CalendarView.Instance;
_instance = this;
},
var startDate = Date.create(start).format(Date.ISO8601_DATETIME);
var endDate = Date.create(end).format(Date.ISO8601_DATETIME);
onShow: function () {
this.$('.fc-button-today').click();
},
bbView.collection.fetch({
data : { start: startDate, end: endDate },
success: function (calendarCollection) {
_.each(calendarCollection.models, function (element) {
var episodeTitle = element.get('title');
var seriesTitle = element.get('series').get('title');
var start = element.get('airDate');
getEvents: function (start, end, callback) {
var startDate = Date.create(start).format(Date.ISO8601_DATETIME);
var endDate = Date.create(end).format(Date.ISO8601_DATETIME);
element.set('title', seriesTitle);
element.set('episodeTitle', episodeTitle);
element.set('start', start);
element.set('allDay', false);
});
_instance.collection.fetch({
data : { start: startDate, end: endDate },
success: function (calendarCollection) {
_.each(calendarCollection.models, function (element) {
var episodeTitle = element.get('title');
var seriesTitle = element.get('series').get('title');
var start = element.get('airDate');
callback(calendarCollection.toJSON());
}
});
}
element.set('title', seriesTitle);
element.set('episodeTitle', episodeTitle);
element.set('start', start);
element.set('allDay', false);
});
callback(calendarCollection.toJSON());
}
});
}
});
});
});
+15 -11
View File
@@ -1,13 +1,17 @@
'use strict';
define(['app', 'Series/EpisodeModel'], function () {
NzbDrone.Calendar.Collection = Backbone.Collection.extend({
url : NzbDrone.Constants.ApiRoot + '/calendar',
model : NzbDrone.Series.EpisodeModel,
'use strict';
define(
[
'backbone',
'Series/EpisodeModel'
], function (Backbone, EpisodeModel) {
return Backbone.Collection.extend({
url : window.ApiRoot + '/calendar',
model: EpisodeModel,
comparator: function(model) {
var date = new Date(model.get('airDate'));
var time = date.getTime();
return time;
}
comparator: function (model) {
var date = new Date(model.get('airDate'));
var time = date.getTime();
return time;
}
});
});
});
+15 -11
View File
@@ -1,13 +1,17 @@
'use strict';
define(['app', 'Series/EpisodeModel'], function () {
NzbDrone.Calendar.UpcomingCollection = Backbone.Collection.extend({
url : NzbDrone.Constants.ApiRoot + '/calendar',
model : NzbDrone.Series.EpisodeModel,
'use strict';
define(
[
'backbone',
'Series/EpisodeModel'
], function (Backbone, EpisodeModel) {
return Backbone.Collection.extend({
url : window.ApiRoot + '/calendar',
model: EpisodeModel,
comparator: function(model) {
var date = new Date(model.get('airDate'));
var time = date.getTime();
return time;
}
comparator: function (model) {
var date = new Date(model.get('airDate'));
var time = date.getTime();
return time;
}
});
});
});
+9 -5
View File
@@ -1,7 +1,11 @@
'use strict';
'use strict';
define(['app', 'Calendar/UpcomingItemView'], function () {
NzbDrone.Calendar.UpcomingCollectionView = Backbone.Marionette.CollectionView.extend({
itemView: NzbDrone.Calendar.UpcomingItemView
define(
[
'marionette',
'Calendar/UpcomingItemView'
], function (Marionette, UpcomingItemView) {
return Marionette.CollectionView.extend({
itemView: UpcomingItemView
});
});
});
+8 -9
View File
@@ -1,12 +1,11 @@
'use strict';
define([
'app',
'Calendar/UpcomingCollection'
], function () {
NzbDrone.Calendar.UpcomingItemView = Backbone.Marionette.ItemView.extend({
template : 'Calendar/UpcomingItemTemplate',
tagName : 'div'
define(
[
'marionette'
], function (Marionette) {
return Marionette.ItemView.extend({
template: 'Calendar/UpcomingItemTemplate',
tagName : 'div'
});
});
});
+50 -50
View File
@@ -1,121 +1,121 @@
.calendar {
th, td {
border-color: #eeeeee;
border-color : #eeeeee;
}
.primary {
border-color: #007ccd;
background-color: #007ccd;
border-color : #007ccd;
background-color : #007ccd;
}
.fc-event-skin {
background-color: #007ccd;
border: 1px solid #007ccd;
border-radius: 4px;
text-align: center;
background-color : #007ccd;
border : 1px solid #007ccd;
border-radius : 4px;
text-align : center;
}
.info {
border-color: #14b8d4;
background-color: #14b8d4;
border-color : #14b8d4;
background-color : #14b8d4;
}
.inverse {
border-color: #333333;
background-color: #333333;
border-color : #333333;
background-color : #333333;
}
.warning {
border-color: #ffa93c;
background-color: #ffa93c;
border-color : #ffa93c;
background-color : #ffa93c;
}
.danger {
border-color: #ea494a;
background-color: #ea494a;
border-color : #ea494a;
background-color : #ea494a;
}
th {
background-color: #eeeeee;
background-color : #eeeeee;
}
.purple {
border-color: #7932ea;
background-color: #7932ea;
border-color : #7932ea;
background-color : #7932ea;
}
.success {
border-color: #4cb158;
background-color: #4cb158;
border-color : #4cb158;
background-color : #4cb158;
}
h2 {
font-size: 17.5px;
font-size : 17.5px;
}
}
.event {
display: inline-block;
width: 100%;
margin-bottom: 10px;
border-top: 1px solid #eeeeee;
padding-top: 10px;
display : inline-block;
width : 100%;
margin-bottom : 10px;
border-top : 1px solid #eeeeee;
padding-top : 10px;
.primary {
border-color: #007ccd;
border-color : #007ccd;
}
.info {
border-color: #14b8d4;
border-color : #14b8d4;
}
h4 {
text-transform: none !important;
font-weight: 500;
color: #008dcd;
margin: 5px 0px;
text-transform : none !important;
font-weight : 500;
color : #008dcd;
margin : 5px 0px;
}
.inverse {
border-color: #333333;
border-color : #333333;
}
.warning {
border-color: #ffa93c;
border-color : #ffa93c;
}
p {
color: #999999;
color : #999999;
}
.danger {
border-color: #ea494a;
border-color : #ea494a;
}
.date {
text-align: center;
display: inline-block;
border-left: 4px solid #eeeeee;
padding-left: 16px;
float: left;
margin-right: 20px;
text-align : center;
display : inline-block;
border-left : 4px solid #eeeeee;
padding-left : 16px;
float : left;
margin-right : 20px;
h4 {
line-height: 1em;
color: #555555;
font-weight: 300;
line-height : 1em;
color : #555555;
font-weight : 300;
}
h1 {
font-weight: 500;
line-height: 0.8em;
font-weight : 500;
line-height : 0.8em;
}
}
.purple {
border-color: #7932ea;
border-color : #7932ea;
}
.success {
border-color: #4cb158;
border-color : #4cb158;
}
}
}