0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Merge pull request #648 from jfi/iss545

Notifications are too long
This commit is contained in:
Hannah Wolfe 2013-09-09 04:48:41 -07:00
commit 4c268b8b3b
2 changed files with 15 additions and 7 deletions

View file

@ -131,8 +131,7 @@
deletePost: function (e) { deletePost: function (e) {
e.preventDefault(); e.preventDefault();
var self = this, var self = this;
title = self.model.get('title');
this.addSubview(new Ghost.Views.Modal({ this.addSubview(new Ghost.Views.Modal({
model: { model: {
options: { options: {
@ -145,13 +144,13 @@
}).then(function () { }).then(function () {
Ghost.notifications.addItem({ Ghost.notifications.addItem({
type: 'success', type: 'success',
message: 'Your post: ' + title + ' has been deleted', message: 'Your post has been deleted.',
status: 'passive' status: 'passive'
}); });
}, function () { }, function () {
Ghost.notifications.addItem({ Ghost.notifications.addItem({
type: 'error', type: 'error',
message: 'Your post: ' + title + ' has not been deleted.', message: 'Your post could not be deleted. Please try again.',
status: 'passive' status: 'passive'
}); });
}); });

View file

@ -64,6 +64,14 @@
'publish-on': 'Publish on...' 'publish-on': 'Publish on...'
}, },
notificationMap: {
'draft': 'has been saved as a draft',
'published': 'has been published',
'scheduled': 'has been scheduled',
'queue': 'has been added to the queue',
'publish-on': 'will be published'
},
initialize: function () { initialize: function () {
var self = this; var self = this;
// Toggle publish // Toggle publish
@ -102,7 +110,7 @@
}).then(function () { }).then(function () {
Ghost.notifications.addItem({ Ghost.notifications.addItem({
type: 'success', type: 'success',
message: 'Your post: ' + model.get('title') + ' has been ' + keys[newIndex], message: 'Your post ' + this.notificationMap[newIndex] + '.',
status: 'passive' status: 'passive'
}); });
}, function (xhr) { }, function (xhr) {
@ -148,7 +156,8 @@
updatePost: function (status) { updatePost: function (status) {
var self = this, var self = this,
model = this.model, model = this.model,
prevStatus = model.get('status'); prevStatus = model.get('status'),
notificationMap = this.notificationMap;
// Default to same status if not passed in // Default to same status if not passed in
status = status || prevStatus; status = status || prevStatus;
@ -175,7 +184,7 @@
}).then(function () { }).then(function () {
Ghost.notifications.addItem({ Ghost.notifications.addItem({
type: 'success', type: 'success',
message: ['Your post "', model.get('title'), '" has been ', status, '.'].join(''), message: ['Your post ', notificationMap[status], '.'].join(''),
status: 'passive' status: 'passive'
}); });
}, function (xhr) { }, function (xhr) {