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