mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 19:46:01 +01:00
removed thread state fix bottom bar class
This commit is contained in:
@@ -30,12 +30,7 @@ define('forum/topic', [
|
||||
});
|
||||
|
||||
Topic.init = function() {
|
||||
var tid = ajaxify.variables.get('topic_id'),
|
||||
thread_state = {
|
||||
locked: ajaxify.variables.get('locked'),
|
||||
deleted: ajaxify.variables.get('deleted'),
|
||||
pinned: ajaxify.variables.get('pinned')
|
||||
};
|
||||
var tid = ajaxify.variables.get('topic_id');
|
||||
|
||||
$(window).trigger('action:topic.loading');
|
||||
|
||||
@@ -43,8 +38,8 @@ define('forum/topic', [
|
||||
|
||||
posts.processPage($('.topic'));
|
||||
|
||||
postTools.init(tid, thread_state);
|
||||
threadTools.init(tid, thread_state);
|
||||
postTools.init(tid);
|
||||
threadTools.init(tid);
|
||||
events.init();
|
||||
|
||||
sort.handleSort('topicPostSort', 'user.setTopicSort', 'topic/' + ajaxify.variables.get('topic_slug'));
|
||||
|
||||
@@ -7,10 +7,10 @@ define('forum/topic/postTools', ['share', 'navigator', 'components', 'translator
|
||||
var PostTools = {},
|
||||
topicName;
|
||||
|
||||
PostTools.init = function(tid, threadState) {
|
||||
PostTools.init = function(tid) {
|
||||
topicName = ajaxify.variables.get('topic_name');
|
||||
|
||||
addPostHandlers(tid, threadState);
|
||||
addPostHandlers(tid);
|
||||
|
||||
share.addShareHandlers(topicName);
|
||||
|
||||
@@ -71,29 +71,19 @@ define('forum/topic/postTools', ['share', 'navigator', 'components', 'translator
|
||||
}
|
||||
}
|
||||
|
||||
function addPostHandlers(tid, threadState) {
|
||||
function canPost() {
|
||||
return !threadState.locked || app.user.isAdmin;
|
||||
}
|
||||
|
||||
function addPostHandlers(tid) {
|
||||
var postContainer = components.get('topic');
|
||||
|
||||
postContainer.on('click', '[component="post/quote"]', function() {
|
||||
if (canPost()) {
|
||||
onQuoteClicked($(this), tid, topicName);
|
||||
}
|
||||
});
|
||||
|
||||
postContainer.on('click', '[component="post/reply"]', function() {
|
||||
if (canPost()) {
|
||||
onReplyClicked($(this), tid, topicName);
|
||||
}
|
||||
});
|
||||
|
||||
components.get('topic/reply').on('click', function() {
|
||||
if (canPost()) {
|
||||
onReplyClicked($(this), tid, topicName);
|
||||
}
|
||||
});
|
||||
|
||||
postContainer.on('click', '[component="post/favourite"]', function() {
|
||||
|
||||
@@ -267,7 +267,7 @@ define('forum/topic/posts', [
|
||||
|
||||
function showBottomPostBar() {
|
||||
if(components.get('post').length > 1 || !components.get('post', 'index', 0).length) {
|
||||
$('.bottom-post-bar').removeClass('hide');
|
||||
$('.bottom-post-bar').removeClass('hidden');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,7 @@ define('forum/topic/threadTools', ['forum/topic/fork', 'forum/topic/move', 'comp
|
||||
|
||||
var ThreadTools = {};
|
||||
|
||||
ThreadTools.init = function(tid, threadState) {
|
||||
ThreadTools.threadState = threadState;
|
||||
|
||||
ThreadTools.init = function(tid) {
|
||||
components.get('topic/delete').on('click', function() {
|
||||
topicCommand('delete', tid);
|
||||
return false;
|
||||
@@ -118,7 +116,6 @@ define('forum/topic/threadTools', ['forum/topic/fork', 'forum/topic/move', 'comp
|
||||
|
||||
threadEl.find('[component="post/reply"], [component="post/quote"], [component="post/edit"], [component="post/delete"]').toggleClass('hidden', isLocked);
|
||||
$('[component="post/header"] i.fa-lock').toggleClass('hidden', !data.isLocked);
|
||||
ThreadTools.threadState.locked = data.isLocked;
|
||||
};
|
||||
|
||||
ThreadTools.setDeleteState = function(data) {
|
||||
@@ -133,7 +130,6 @@ define('forum/topic/threadTools', ['forum/topic/fork', 'forum/topic/move', 'comp
|
||||
components.get('topic/deleted/message').toggleClass('hidden', !data.isDelete);
|
||||
|
||||
threadEl.toggleClass('deleted', data.isDelete);
|
||||
ThreadTools.threadState.deleted = data.isDelete;
|
||||
};
|
||||
|
||||
ThreadTools.setPinnedState = function(data) {
|
||||
@@ -142,7 +138,6 @@ define('forum/topic/threadTools', ['forum/topic/fork', 'forum/topic/move', 'comp
|
||||
return;
|
||||
}
|
||||
|
||||
ThreadTools.threadState.pinned = data.isPinned;
|
||||
components.get('topic/pin').toggleClass('hidden', data.isPinned);
|
||||
components.get('topic/unpin').toggleClass('hidden', !data.isPinned);
|
||||
$('[component="post/header"] i.fa-thumb-tack').toggleClass('hidden', !data.isPinned);
|
||||
|
||||
Reference in New Issue
Block a user