|
|
@ -16,16 +16,12 @@ define('forum/topic/fork', ['components', 'postSelect'], function(components, po
|
|
|
|
parseModal(function(html) {
|
|
|
|
parseModal(function(html) {
|
|
|
|
forkModal = $(html);
|
|
|
|
forkModal = $(html);
|
|
|
|
|
|
|
|
|
|
|
|
forkModal.on('hidden.bs.modal', function() {
|
|
|
|
|
|
|
|
forkModal.remove();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
forkCommit = forkModal.find('#fork_thread_commit');
|
|
|
|
forkCommit = forkModal.find('#fork_thread_commit');
|
|
|
|
|
|
|
|
|
|
|
|
showForkModal();
|
|
|
|
$(document.body).append(forkModal);
|
|
|
|
|
|
|
|
|
|
|
|
forkModal.find('.close,#fork_thread_cancel').on('click', closeForkModal);
|
|
|
|
forkModal.find('.close,#fork_thread_cancel').on('click', closeForkModal);
|
|
|
|
forkModal.find('#fork-title').on('change', checkForkButtonEnable);
|
|
|
|
forkModal.find('#fork-title').on('keyup', checkForkButtonEnable);
|
|
|
|
|
|
|
|
|
|
|
|
postSelect.init(function() {
|
|
|
|
postSelect.init(function() {
|
|
|
|
checkForkButtonEnable();
|
|
|
|
checkForkButtonEnable();
|
|
|
@ -43,14 +39,6 @@ define('forum/topic/fork', ['components', 'postSelect'], function(components, po
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function showForkModal() {
|
|
|
|
|
|
|
|
forkModal.modal({backdrop: false, show: true})
|
|
|
|
|
|
|
|
.css('position', 'fixed')
|
|
|
|
|
|
|
|
.css('left', Math.max(0, (($(window).width() - forkModal.outerWidth()) / 2) + $(window).scrollLeft()) + 'px')
|
|
|
|
|
|
|
|
.css('top', '0px')
|
|
|
|
|
|
|
|
.css('z-index', '2000');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function createTopicFromPosts() {
|
|
|
|
function createTopicFromPosts() {
|
|
|
|
forkCommit.attr('disabled', true);
|
|
|
|
forkCommit.attr('disabled', true);
|
|
|
|
socket.emit('topics.createTopicFromPosts', {
|
|
|
|
socket.emit('topics.createTopicFromPosts', {
|
|
|
@ -88,14 +76,14 @@ define('forum/topic/fork', ['components', 'postSelect'], function(components, po
|
|
|
|
|
|
|
|
|
|
|
|
function showPostsSelected() {
|
|
|
|
function showPostsSelected() {
|
|
|
|
if (postSelect.pids.length) {
|
|
|
|
if (postSelect.pids.length) {
|
|
|
|
forkModal.find('#fork-pids').text(postSelect.pids.join(', '));
|
|
|
|
forkModal.find('#fork-pids').translateHtml('[[topic:fork_pid_count, ' + postSelect.pids.length + ']]');
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
forkModal.find('#fork-pids').translateHtml('[[topic:fork_no_pids]]');
|
|
|
|
forkModal.find('#fork-pids').translateHtml('[[topic:fork_no_pids]]');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function checkForkButtonEnable() {
|
|
|
|
function checkForkButtonEnable() {
|
|
|
|
if (forkModal.find('#fork-title').length && postSelect.pids.length) {
|
|
|
|
if (forkModal.find('#fork-title').val().length && postSelect.pids.length) {
|
|
|
|
forkCommit.removeAttr('disabled');
|
|
|
|
forkCommit.removeAttr('disabled');
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
forkCommit.attr('disabled', true);
|
|
|
|
forkCommit.attr('disabled', true);
|
|
|
@ -104,10 +92,10 @@ define('forum/topic/fork', ['components', 'postSelect'], function(components, po
|
|
|
|
|
|
|
|
|
|
|
|
function closeForkModal() {
|
|
|
|
function closeForkModal() {
|
|
|
|
postSelect.pids.forEach(function(pid) {
|
|
|
|
postSelect.pids.forEach(function(pid) {
|
|
|
|
components.get('post', 'pid', pid).css('opacity', 1);
|
|
|
|
components.get('post', 'pid', pid).toggleClass('bg-success', false);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
forkModal.modal('hide');
|
|
|
|
forkModal.remove();
|
|
|
|
|
|
|
|
|
|
|
|
components.get('topic').off('click', '[data-pid]');
|
|
|
|
components.get('topic').off('click', '[data-pid]');
|
|
|
|
postSelect.enableClicksOnPosts();
|
|
|
|
postSelect.enableClicksOnPosts();
|
|
|
|