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