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