2013-03-30 00:00:38 +01:00
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
define(['app', 'Shared/NotificationCollection'], function (app, notificationCollection) {
|
2013-01-29 02:59:18 +01:00
|
|
|
|
|
2013-02-14 18:18:29 +01:00
|
|
|
|
var notificationItemView = Backbone.Marionette.ItemView.extend({
|
2013-03-30 00:00:38 +01:00
|
|
|
|
template: 'Shared/NotificationTemplate',
|
2013-01-29 02:59:18 +01:00
|
|
|
|
|
2013-02-14 18:18:29 +01:00
|
|
|
|
events: {
|
|
|
|
|
'click .x-close': 'kill'
|
|
|
|
|
},
|
2013-01-29 02:59:18 +01:00
|
|
|
|
|
2013-02-14 18:18:29 +01:00
|
|
|
|
kill: function () {
|
2013-01-29 02:59:18 +01:00
|
|
|
|
|
2013-02-14 18:18:29 +01:00
|
|
|
|
var self = this;
|
2013-01-29 02:59:18 +01:00
|
|
|
|
|
2013-02-14 18:18:29 +01:00
|
|
|
|
$.Deferred(function () {
|
|
|
|
|
self.$el.slideUp('slow');
|
|
|
|
|
}).done(function () {
|
2013-03-30 00:28:58 +01:00
|
|
|
|
self.model.destroy();
|
|
|
|
|
});
|
2013-02-14 18:18:29 +01:00
|
|
|
|
}
|
|
|
|
|
});
|
2013-01-29 02:59:18 +01:00
|
|
|
|
|
2013-02-14 18:18:29 +01:00
|
|
|
|
var collectionView = Backbone.Marionette.CollectionView.extend({
|
2013-01-29 02:59:18 +01:00
|
|
|
|
|
2013-02-14 18:18:29 +01:00
|
|
|
|
itemView: notificationItemView,
|
2013-01-29 02:59:18 +01:00
|
|
|
|
|
2013-02-14 18:18:29 +01:00
|
|
|
|
initialize: function () {
|
|
|
|
|
this.collection = notificationCollection;
|
2013-02-15 09:18:42 +01:00
|
|
|
|
}
|
2013-02-14 18:18:29 +01:00
|
|
|
|
});
|
2013-01-29 02:59:18 +01:00
|
|
|
|
|
2013-02-15 09:18:42 +01:00
|
|
|
|
NzbDrone.addInitializer(function () {
|
2013-02-16 01:49:25 +01:00
|
|
|
|
console.log('initializing notification view');
|
2013-02-14 18:18:29 +01:00
|
|
|
|
NzbDrone.notificationRegion.show(new collectionView());
|
|
|
|
|
});
|
2013-03-30 00:28:58 +01:00
|
|
|
|
|
2013-01-29 02:59:18 +01:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
2013-02-01 04:15:19 +01:00
|
|
|
|
|
2013-01-29 02:59:18 +01:00
|
|
|
|
|