From cbd03e75e2b51d7712d77e3dc6b6fcf33475575e Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 12 Jun 2013 11:13:10 -0400 Subject: [PATCH] fixing bug where the number of posts counted was incorrect (1 over), causing thread tools to not appear when a topic was locked. also integrated bootbox into confirm dialogs for thread deletion --- public/src/forum/topic.js | 18 +++++++++--------- public/templates/admin/header.tpl | 1 + public/templates/header.tpl | 1 + public/vendor/bootbox/bootbox.min.js | 17 +++++++++++++++++ 4 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 public/vendor/bootbox/bootbox.min.js diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index f75f615e55..90906529de 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -43,13 +43,13 @@ deleteThreadEl.addEventListener('click', function(e) { e.preventDefault(); if (thread_state.deleted !== '1') { - if (confirm('really delete thread? (THIS DIALOG TO BE REPLACED WITH BOOTBOX)')) { - socket.emit('api:topic.delete', { tid: tid }); - } + bootbox.confirm('Are you sure you want to delete this thread?', function(confirm) { + if (confirm) socket.emit('api:topic.delete', { tid: tid }); + }); } else { - if (confirm('really restore thread? (THIS DIALOG TO BE REPLACED WITH BOOTBOX)')) { - socket.emit('api:topic.restore', { tid: tid }); - } + bootbox.confirm('Are you sure you want to restore this thread?', function(confirm) { + if (confirm) socket.emit('api:topic.restore', { tid: tid }); + }); } }, false); @@ -525,7 +525,7 @@ quoteBtns = document.querySelectorAll('#post-container .quote'), editBtns = document.querySelectorAll('#post-container .edit'), deleteBtns = document.querySelectorAll('#post-container .delete'), - numReplyBtns = postReplyBtns.length, + numPosts = document.querySelectorAll('#post_container li[data-pid]').length, lockThreadEl = document.getElementById('lock_thread'), x; @@ -533,7 +533,7 @@ lockThreadEl.innerHTML = ' Unlock Thread'; threadReplyBtn.disabled = true; threadReplyBtn.innerHTML = 'Locked '; - for(x=0;x + +