From a091e06fe349a684a27cdff97172a70af9637ad9 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Fri, 11 Apr 2014 17:01:27 -0400 Subject: [PATCH] more work for #1368 --- public/language/en_GB/notifications.json | 4 +++- public/language/en_GB/topic.json | 9 +++++++++ public/src/forum/topic.js | 16 ++-------------- public/src/forum/topic/move.js | 4 ++-- public/src/forum/topic/postTools.js | 9 ++++----- public/src/forum/unread.js | 6 +++--- public/src/modules/notifications.js | 4 ++-- 7 files changed, 25 insertions(+), 27 deletions(-) diff --git a/public/language/en_GB/notifications.json b/public/language/en_GB/notifications.json index 1ad15012c1..748c89bfb7 100644 --- a/public/language/en_GB/notifications.json +++ b/public/language/en_GB/notifications.json @@ -7,5 +7,7 @@ "outgoing_link": "Outgoing Link", "outgoing_link_message": "You are now leaving", "continue_to": "Continue to", - "return_to": "Return to " + "return_to": "Return to ", + "new_notification": "New Notification", + "you_have_unread_notifications": "You have unread notifications." } diff --git a/public/language/en_GB/topic.json b/public/language/en_GB/topic.json index a11a3b941a..d7c09cd629 100644 --- a/public/language/en_GB/topic.json +++ b/public/language/en_GB/topic.json @@ -57,6 +57,14 @@ "thread_tools.restore": "Restore Topic", "thread_tools.restore_confirm": "Are you sure you want to restore this thread?", + "topic_lock_success": "Topic has been successfully locked.", + "topic_unlock_success": "Topic has been successfully unlocked.", + + "topic_pin_success": "Topic has been successfully pinned.", + "topic_unpin_success": "Topic has been successfully unpinned.", + + "topic_move_success": "This topic has been successfully moved to %1", + "post_delete_confirm": "Are you sure you want to delete this post?", "post_restore_confirm": "Are you sure you want to restore this post?", "post_delete_error": "Could not delete this post!", @@ -74,6 +82,7 @@ "loading_more_posts": "Loading More Posts", "move_topic": "Move Topic", "move_post": "Move Post", + "post_moved": "Post moved!", "fork_topic": "Fork Topic", "topic_will_be_moved_to": "This topic will be moved to the category", "fork_topic_instruction": "Click the posts you want to fork", diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index ab9eb9d7ad..d752dff4da 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -414,13 +414,7 @@ define(['forum/pagination', 'forum/topic/threadTools', 'forum/topic/postTools', $('.topic-main-buttons .post_reply').attr('disabled', locked).html(locked ? 'Locked ' : 'Reply'); if (alert) { - app.alert({ - 'alert_id': 'thread_lock', - type: 'success', - title: 'Thread ' + (locked ? 'Locked' : 'Unlocked'), - message: 'Thread has been successfully ' + (locked ? 'locked' : 'unlocked'), - timeout: 5000 - }); + app.alertSuccess(locked ? '[[topic:topic_lock_success]]' : '[[topic:topic_unlock_success]]'); } thread_state.locked = locked ? '1' : '0'; @@ -450,13 +444,7 @@ define(['forum/pagination', 'forum/topic/threadTools', 'forum/topic/postTools', $('.pin_thread').html(translated); if (alert) { - app.alert({ - 'alert_id': 'thread_pin', - type: 'success', - title: 'Thread ' + (pinned ? 'Pinned' : 'Unpinned'), - message: 'Thread has been successfully ' + (pinned ? 'pinned' : 'unpinned'), - timeout: 5000 - }); + app.alertSuccess(pinned ? '[[topic:topic_pin_success]]' : '[[topic:topic_unpin_success]]'); } thread_state.pinned = pinned ? '1' : '0'; }); diff --git a/public/src/forum/topic/move.js b/public/src/forum/topic/move.js index 2f92d44ad9..1408e51b8a 100644 --- a/public/src/forum/topic/move.js +++ b/public/src/forum/topic/move.js @@ -71,10 +71,10 @@ define(function() { }, function(err) { modal.modal('hide'); if(err) { - return app.alertError('This topic could not be moved to ' + targetCategoryLabel + '.
Please try again later'); + return app.alertError(err.message); } - app.alertSuccess('This topic has been successfully moved to ' + targetCategoryLabel); + app.alertSuccess('[[topic:topic_move_success, ' + targetCategoryLabel + ']]'); }); } diff --git a/public/src/forum/topic/postTools.js b/public/src/forum/topic/postTools.js index bbe9a109ca..c419539f29 100644 --- a/public/src/forum/topic/postTools.js +++ b/public/src/forum/topic/postTools.js @@ -163,7 +163,7 @@ define(['composer', 'share'], function(composer, share) { tid: tid }, function(err) { if(err) { - return translator.translate('[[topic:post_' + action + '_error]]', app.alertError); + app.alertError('[[topic:post_' + action + '_error]]'); } }); } @@ -218,7 +218,7 @@ define(['composer', 'share'], function(composer, share) { $('#topicId').val(''); - app.alertSuccess('Post moved!'); + app.alertSuccess('[[topic:post_moved]]'); }); } @@ -230,9 +230,8 @@ define(['composer', 'share'], function(composer, share) { if(err) { return app.alertError(err.message); } - translator.translate('[[topic:flag_success]]', function(message) { - app.alertSuccess(message); - }); + + app.alertSuccess('[[topic:flag_success]]'); }); } }); diff --git a/public/src/forum/unread.js b/public/src/forum/unread.js index e944ffde16..0c394243ba 100644 --- a/public/src/forum/unread.js +++ b/public/src/forum/unread.js @@ -29,7 +29,7 @@ define(['forum/recent'], function(recent) { } socket.emit('topics.markTidsRead', tids, function(err) { if(err) { - return app.alertError('There was an error marking topics read!'); + return app.alertError(err.message); } doneRemovingTids(tids); @@ -39,7 +39,7 @@ define(['forum/recent'], function(recent) { $('#markAllRead').on('click', function() { socket.emit('topics.markAllRead', function(err) { if(err) { - return app.alertError('There was an error marking topics read!'); + return app.alertError(err.message); } app.alertSuccess('[[unread:topics_marked_as_read.success]]'); @@ -68,7 +68,7 @@ define(['forum/recent'], function(recent) { socket.emit('topics.markCategoryTopicsRead', cid, function(err) { if(err) { - return app.alertError('There was an error marking topics read!'); + return app.alertError(err.message); } doneRemovingTids(tids); diff --git a/public/src/modules/notifications.js b/public/src/modules/notifications.js index fcb6143f14..cd9a9b7354 100644 --- a/public/src/modules/notifications.js +++ b/public/src/modules/notifications.js @@ -95,8 +95,8 @@ define(['sounds'], function(sound) { app.alert({ alert_id: 'new_notif', - title: 'New notification', - message: 'You have unread notifications.', + title: '[[notifications:new_notification]]', + message: '[[notifications:you_have_unread_notifications]]', type: 'warning', timeout: 2000 });