v1.18.x
barisusakli 11 years ago
parent 207ad4d859
commit 0d0af7ba96

@ -26,6 +26,7 @@
"share": "Share",
"tools": "Tools",
"flag": "Flag",
"locked": "Locked",
"bookmark_instructions" : "Click here to return to your last position or close to discard.",
@ -61,12 +62,6 @@
"thread_tools.purge": "Purge Topic",
"thread_tools.purge_confirm" : "Are you sure you want to purge 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?",

@ -1,7 +1,7 @@
'use strict';
/* globals app, ajaxify, define, socket */
/* globals app, ajaxify, define, socket, translator */
define('forum/topic/events', ['forum/topic/browsing', 'forum/topic/postTools', 'forum/topic/threadTools'], function(browsing, postTools, threadTools) {
@ -17,11 +17,11 @@ define('forum/topic/events', ['forum/topic/browsing', 'forum/topic/postTools', '
'event:topic_restored': toggleTopicDeleteState,
'event:topic_purged': onTopicPurged,
'event:topic_locked': toggleTopicLockedState,
'event:topic_unlocked': toggleTopicLockedState,
'event:topic_locked': threadTools.setLockedState,
'event:topic_unlocked': threadTools.setLockedState,
'event:topic_pinned': toggleTopicPinnedState,
'event:topic_unpinned': toggleTopicPinnedState,
'event:topic_pinned': threadTools.setPinnedState,
'event:topic_unpinned': threadTools.setPinnedState,
'event:topic_moved': onTopicMoved,
@ -78,18 +78,6 @@ define('forum/topic/events', ['forum/topic/browsing', 'forum/topic/postTools', '
ajaxify.go('category/' + ajaxify.variables.get('category_id'));
}
function toggleTopicLockedState(data) {
threadTools.setLockedState(data);
app.alertSuccess(data.isLocked ? '[[topic:topic_lock_success]]' : '[[topic:topic_unlock_success]]');
}
function toggleTopicPinnedState(data) {
threadTools.setPinnedState(data);
app.alertSuccess(data.isPinned ? '[[topic:topic_pin_success]]' : '[[topic:topic_unpin_success]]');
}
function onTopicMoved(data) {
if (data && data.tid > 0) {
ajaxify.go('topic/' + data.tid);

@ -104,14 +104,19 @@ define('forum/topic/threadTools', ['forum/topic/fork', 'forum/topic/move'], func
var threadEl = $('#post-container');
if (parseInt(data.tid, 10) === parseInt(threadEl.attr('data-tid'), 10)) {
var isLocked = data.isLocked && !app.isAdmin;
translator.translate('<i class="fa fa-fw fa-' + (isLocked ? 'un': '') + 'lock"></i> [[topic:thread_tools.' + (isLocked ? 'un': '') + 'lock]]', function(translated) {
translator.translate('<i class="fa fa-fw fa-' + (data.isLocked ? 'un': '') + 'lock"></i> [[topic:thread_tools.' + (data.isLocked ? 'un': '') + 'lock]]', function(translated) {
$('.lock_thread').html(translated);
});
threadEl.find('.post_reply').html(isLocked ? '<i class="fa fa-lock"></i> Locked' : '<i class="fa fa-reply"></i> Reply');
threadEl.find('.quote, .edit, .delete').toggleClass('none', isLocked);
$('.topic-main-buttons .post_reply').attr('disabled', isLocked).html(isLocked ? '<i class="fa fa-lock"></i> Locked' : 'Reply');
translator.translate(isLocked ? '[[topic:locked]]' : '[[topic:reply]]', function(translated) {
var className = isLocked ? 'fa-lock' : 'fa-reply';
threadEl.find('.post_reply').html('<i class="fa ' + className + '"></i> ' + translated);
$('.topic-main-buttons .post_reply').attr('disabled', isLocked).html(isLocked ? '<i class="fa fa-lock"></i> ' + translated : translated);
});
threadEl.find('.quote, .edit, .delete').toggleClass('none', isLocked);
$('.topic-title i.fa-lock').toggleClass('hide', !data.isLocked);
ThreadTools.threadState.locked = data.isLocked;
}
};
@ -144,9 +149,9 @@ define('forum/topic/threadTools', ['forum/topic/fork', 'forum/topic/move'], func
if (parseInt(data.tid, 10) === parseInt(threadEl.attr('data-tid'), 10)) {
translator.translate('<i class="fa fa-fw fa-thumb-tack"></i> [[topic:thread_tools.' + (data.isPinned ? 'unpin' : 'pin') + ']]', function(translated) {
$('.pin_thread').html(translated);
ThreadTools.threadState.pinned = data.isPinned;
});
$('.topic-title i.fa-thumb-tack').toggleClass('hide', !data.isPinned);
}
}

Loading…
Cancel
Save