mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 06:35:49 +03:00
Move notification dismissal events to Backbone
Also removes stray notification alert comments
This commit is contained in:
parent
2e0d2c73d6
commit
3a8b01dbcb
@ -56,11 +56,6 @@
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('animationend', '.js-notification', function () {
|
||||
$(this).hide();
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Example of how to add a persistent notification.
|
||||
*/
|
||||
|
@ -93,23 +93,28 @@
|
||||
template: function (data) {
|
||||
return JST[this.templateName](data);
|
||||
},
|
||||
render: function() {
|
||||
render: function () {
|
||||
var html = this.template(this.model);
|
||||
this.$el.html(html);
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* This handles Notification groups
|
||||
*/
|
||||
Ghost.Views.NotificationCollection = Ghost.View.extend({
|
||||
el: '#flashbar',
|
||||
initialize: function() {
|
||||
initialize: function () {
|
||||
this.render();
|
||||
},
|
||||
render: function() {
|
||||
events: {
|
||||
'animationend .js-notification': 'removeItem',
|
||||
'webkitAnimationEnd .js-notification': 'removeItem',
|
||||
'oanimationend .js-notification': 'removeItem',
|
||||
'MSAnimationEnd .js-notification': 'removeItem'
|
||||
},
|
||||
render: function () {
|
||||
_.each(this.model, function (item) {
|
||||
this.renderItem(item);
|
||||
}, this);
|
||||
@ -117,6 +122,10 @@
|
||||
renderItem: function (item) {
|
||||
var itemView = new Ghost.Views.Notification({ model: item });
|
||||
this.$el.html(itemView.render().el);
|
||||
},
|
||||
removeItem: function (e) {
|
||||
e.preventDefault();
|
||||
$(e.currentTarget).remove();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -125,7 +125,6 @@
|
||||
status: 'passive'
|
||||
}]
|
||||
}));
|
||||
// return window.alert('Scheduled publishing not supported yet.');
|
||||
}
|
||||
if (status === 'queue') {
|
||||
this.addSubview(new Ghost.Views.NotificationCollection({
|
||||
@ -135,7 +134,6 @@
|
||||
status: 'passive'
|
||||
}]
|
||||
}));
|
||||
// return window.alert('Scheduled publishing not supported yet.');
|
||||
}
|
||||
|
||||
this.savePost({
|
||||
@ -148,7 +146,6 @@
|
||||
status: 'passive'
|
||||
}]
|
||||
}));
|
||||
// window.alert('Your post: ' + model.get('title') + ' has been ' + status);
|
||||
}, function () {
|
||||
self.addSubview(new Ghost.Views.NotificationCollection({
|
||||
model: [{
|
||||
@ -174,7 +171,6 @@
|
||||
status: 'passive'
|
||||
}]
|
||||
}));
|
||||
// window.alert('Your post was saved as ' + model.get('status'));
|
||||
}, function () {
|
||||
self.addSubview(new Ghost.Views.NotificationCollection({
|
||||
model: [{
|
||||
@ -183,7 +179,6 @@
|
||||
status: 'passive'
|
||||
}]
|
||||
}));
|
||||
// window.alert(model.validationError);
|
||||
});
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user