2013-06-07 08:33:01 +03:00
|
|
|
'use strict';
|
|
|
|
|
2013-06-25 02:41:59 +03:00
|
|
|
define(
|
|
|
|
[
|
2013-06-28 18:43:37 +03:00
|
|
|
'app',
|
2013-08-22 03:24:38 +03:00
|
|
|
'marionette',
|
|
|
|
'moment'
|
|
|
|
], function (App, Marionette, Moment) {
|
2013-06-25 02:41:59 +03:00
|
|
|
return Marionette.ItemView.extend({
|
2013-08-22 03:24:38 +03:00
|
|
|
template: 'Calendar/UpcomingItemViewTemplate',
|
2013-06-28 18:43:37 +03:00
|
|
|
tagName : 'div',
|
|
|
|
|
2013-07-24 07:16:52 +03:00
|
|
|
events: {
|
|
|
|
'click .x-episode-title': '_showEpisodeDetails'
|
2013-06-28 18:43:37 +03:00
|
|
|
},
|
|
|
|
|
2013-08-22 03:24:38 +03:00
|
|
|
initialize: function () {
|
|
|
|
var start = this.model.get('airDateUtc');
|
|
|
|
var runtime = this.model.get('series').runtime;
|
|
|
|
var end = Moment(start).add('minutes', runtime);
|
|
|
|
|
|
|
|
this.model.set({
|
2013-08-22 07:30:26 +03:00
|
|
|
end: end.toISOString()
|
2013-08-22 03:24:38 +03:00
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2013-07-24 07:16:52 +03:00
|
|
|
_showEpisodeDetails: function () {
|
|
|
|
App.vent.trigger(App.Commands.ShowEpisodeDetails, {episode: this.model});
|
2013-06-28 18:43:37 +03:00
|
|
|
}
|
2013-06-25 02:41:59 +03:00
|
|
|
});
|
2013-06-07 08:33:01 +03:00
|
|
|
});
|