mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-22 08:20:36 +01:00
if a thread is locked, the reply buttons all now say "locked", and the
post reply window will not pop up
This commit is contained in:
@@ -37,11 +37,16 @@
|
|||||||
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
(function() {
|
||||||
|
var locked = '{locked}';
|
||||||
|
|
||||||
jQuery('document').ready(function() {
|
jQuery('document').ready(function() {
|
||||||
var room = 'topic_' + '{topic_id}';
|
var room = 'topic_' + '{topic_id}';
|
||||||
|
|
||||||
app.enter_room(room);
|
app.enter_room(room);
|
||||||
set_up_posts();
|
set_up_posts();
|
||||||
|
|
||||||
|
if (locked === '1') set_locked_state(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -106,11 +111,11 @@ function set_up_posts(div) {
|
|||||||
else div = '#' + div;
|
else div = '#' + div;
|
||||||
|
|
||||||
jQuery(div + ' .post_reply').click(function() {
|
jQuery(div + ' .post_reply').click(function() {
|
||||||
app.open_post_window('reply', "{topic_id}", "{topic_name}");
|
if (locked !== '1') app.open_post_window('reply', "{topic_id}", "{topic_name}");
|
||||||
});
|
});
|
||||||
|
|
||||||
jQuery(div + ' .quote').click(function() {
|
jQuery(div + ' .quote').click(function() {
|
||||||
app.open_post_window('quote', "{topic_id}", "{topic_name}");
|
if (locked !== '1') app.open_post_window('quote', "{topic_id}", "{topic_name}");
|
||||||
|
|
||||||
// this needs to be looked at, obviously. only single line quotes work well I think maybe replace all \r\n with > ?
|
// this needs to be looked at, obviously. only single line quotes work well I think maybe replace all \r\n with > ?
|
||||||
document.getElementById('post_content').innerHTML = '> ' + document.getElementById('content_' + this.id.replace('quote_', '')).innerHTML;
|
document.getElementById('post_content').innerHTML = '> ' + document.getElementById('content_' + this.id.replace('quote_', '')).innerHTML;
|
||||||
@@ -139,4 +144,28 @@ function set_up_posts(div) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function set_locked_state(locked) {
|
||||||
|
var threadReplyBtn = document.getElementById('post_reply'),
|
||||||
|
postReplyBtns = document.querySelectorAll('#post-container .post_reply'),
|
||||||
|
quoteBtns = document.querySelectorAll('#post-container .quote'),
|
||||||
|
numReplyBtns = postReplyBtns.length,
|
||||||
|
x;
|
||||||
|
if (locked === true) {
|
||||||
|
threadReplyBtn.disabled = true;
|
||||||
|
threadReplyBtn.innerHTML = 'Locked';
|
||||||
|
for(x=0;x<numReplyBtns;x++) {
|
||||||
|
postReplyBtns[x].innerHTML = 'Locked <i class="icon-lock"></i>';
|
||||||
|
quoteBtns[x].style.display = 'none';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
threadReplyBtn.disabled = false;
|
||||||
|
threadReplyBtn.innerHTML = 'Reply';
|
||||||
|
for(x=0;x<numReplyBtns;x++) {
|
||||||
|
postReplyBtns[x].innerHTML = 'Reply <i class="icon-reply"></i>';
|
||||||
|
quoteBtns[x].style.display = 'inline-block';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
||||||
</script>
|
</script>
|
||||||
@@ -340,7 +340,7 @@ passport.deserializeUser(function(uid, done) {
|
|||||||
|
|
||||||
app.get('/test', function(req, res) {
|
app.get('/test', function(req, res) {
|
||||||
global.modules.posts.get(function(data) {
|
global.modules.posts.get(function(data) {
|
||||||
res.send('<pre>' + JSON.stringify(data) + '</pre>');
|
res.send('<pre>' + JSON.stringify(data, null, 4) + '</pre>');
|
||||||
}, 1, 1);
|
}, 1, 1);
|
||||||
});
|
});
|
||||||
}(WebServer));
|
}(WebServer));
|
||||||
|
|||||||
Reference in New Issue
Block a user