mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 23:15:48 +01:00
removed debug statements, adding missing file re: issue #3
This commit is contained in:
84
public/src/forum/admin/topics.js
Normal file
84
public/src/forum/admin/topics.js
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
$(document).ready(function() {
|
||||||
|
var topicsListEl = document.querySelector('.topics');
|
||||||
|
|
||||||
|
$(topicsListEl).on('click', '[data-action]', function() {
|
||||||
|
var $this = $(this),
|
||||||
|
action = this.getAttribute('data-action'),
|
||||||
|
tid = $this.parents('[data-tid]').attr('data-tid');
|
||||||
|
|
||||||
|
switch(action) {
|
||||||
|
case 'pin':
|
||||||
|
if (!$this.hasClass('active')) socket.emit('api:topic.pin', { tid: tid });
|
||||||
|
else socket.emit('api:topic.unpin', { tid: tid });
|
||||||
|
break;
|
||||||
|
case 'lock':
|
||||||
|
if (!$this.hasClass('active')) socket.emit('api:topic.lock', { tid: tid });
|
||||||
|
else socket.emit('api:topic.unlock', { tid: tid });
|
||||||
|
break;
|
||||||
|
case 'delete':
|
||||||
|
if (!$this.hasClass('active')) socket.emit('api:topic.delete', { tid: tid });
|
||||||
|
else socket.emit('api:topic.restore', { tid: tid });
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Resolve proper button state for all topics
|
||||||
|
var topicEls = topicsListEl.querySelectorAll('li'),
|
||||||
|
numTopics = topicEls.length;
|
||||||
|
for(var x=0;x<numTopics;x++) {
|
||||||
|
if (topicEls[x].getAttribute('data-pinned')) topicEls[x].querySelector('[data-action="pin"]').className += ' active';
|
||||||
|
if (topicEls[x].getAttribute('data-locked')) topicEls[x].querySelector('[data-action="lock"]').className += ' active';
|
||||||
|
if (topicEls[x].getAttribute('data-deleted')) topicEls[x].querySelector('[data-action="delete"]').className += ' active';
|
||||||
|
topicEls[x].removeAttribute('data-pinned');
|
||||||
|
topicEls[x].removeAttribute('data-locked');
|
||||||
|
topicEls[x].removeAttribute('data-deleted');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('api:topic.pin', function(response) {
|
||||||
|
if (response.status === 'ok') {
|
||||||
|
var btnEl = document.querySelector('li[data-tid="' + response.tid + '"] button[data-action="pin"]');
|
||||||
|
|
||||||
|
$(btnEl).addClass('active');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('api:topic.unpin', function(response) {
|
||||||
|
if (response.status === 'ok') {
|
||||||
|
var btnEl = document.querySelector('li[data-tid="' + response.tid + '"] button[data-action="pin"]');
|
||||||
|
|
||||||
|
$(btnEl).removeClass('active');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('api:topic.lock', function(response) {
|
||||||
|
if (response.status === 'ok') {
|
||||||
|
var btnEl = document.querySelector('li[data-tid="' + response.tid + '"] button[data-action="lock"]');
|
||||||
|
|
||||||
|
$(btnEl).addClass('active');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('api:topic.unlock', function(response) {
|
||||||
|
if (response.status === 'ok') {
|
||||||
|
var btnEl = document.querySelector('li[data-tid="' + response.tid + '"] button[data-action="lock"]');
|
||||||
|
|
||||||
|
$(btnEl).removeClass('active');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('api:topic.delete', function(response) {
|
||||||
|
if (response.status === 'ok') {
|
||||||
|
var btnEl = document.querySelector('li[data-tid="' + response.tid + '"] button[data-action="delete"]');
|
||||||
|
|
||||||
|
$(btnEl).addClass('active');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('api:topic.restore', function(response) {
|
||||||
|
if (response.status === 'ok') {
|
||||||
|
var btnEl = document.querySelector('li[data-tid="' + response.tid + '"] button[data-action="delete"]');
|
||||||
|
|
||||||
|
$(btnEl).removeClass('active');
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -23,7 +23,6 @@ var user = require('./../user.js'),
|
|||||||
});
|
});
|
||||||
|
|
||||||
app.get('/users', function(req, res) {
|
app.get('/users', function(req, res) {
|
||||||
console.log('derp');
|
|
||||||
user.getUserList(function(data) {
|
user.getUserList(function(data) {
|
||||||
res.send(app.build_header() + app.create_route("users", "users") + templates['footer']);
|
res.send(app.build_header() + app.create_route("users", "users") + templates['footer']);
|
||||||
});
|
});
|
||||||
@@ -134,7 +133,7 @@ var user = require('./../user.js'),
|
|||||||
var filename = uid + '-profileimg' + extension;
|
var filename = uid + '-profileimg' + extension;
|
||||||
var uploadPath = path.join(global.configuration['ROOT_DIRECTORY'], config.upload_path, filename);
|
var uploadPath = path.join(global.configuration['ROOT_DIRECTORY'], config.upload_path, filename);
|
||||||
|
|
||||||
console.log('trying to upload to : '+ uploadPath);
|
console.log('Info: Attempting upload to: '+ uploadPath);
|
||||||
|
|
||||||
var is = fs.createReadStream(tempPath);
|
var is = fs.createReadStream(tempPath);
|
||||||
var os = fs.createWriteStream(uploadPath);
|
var os = fs.createWriteStream(uploadPath);
|
||||||
@@ -235,7 +234,6 @@ var user = require('./../user.js'),
|
|||||||
});
|
});
|
||||||
|
|
||||||
function api_method(req, res) {
|
function api_method(req, res) {
|
||||||
console.log('derp');
|
|
||||||
var callerUID = req.user?req.user.uid : 0;
|
var callerUID = req.user?req.user.uid : 0;
|
||||||
|
|
||||||
if (!req.params.section && !req.params.username) {
|
if (!req.params.section && !req.params.username) {
|
||||||
|
|||||||
@@ -193,7 +193,6 @@ marked.setOptions({
|
|||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
console.log(topics);
|
|
||||||
callback(topics);
|
callback(topics);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -158,7 +158,6 @@ var express = require('express'),
|
|||||||
|
|
||||||
var category_url = cid + (req.params.slug ? '/' + req.params.slug : '');
|
var category_url = cid + (req.params.slug ? '/' + req.params.slug : '');
|
||||||
categories.getCategoryById(cid, 0, function(returnData) {
|
categories.getCategoryById(cid, 0, function(returnData) {
|
||||||
console.log(returnData);
|
|
||||||
res.send(
|
res.send(
|
||||||
app.build_header() +
|
app.build_header() +
|
||||||
'\n\t<noscript>\n' + templates['noscript/header'] + templates['noscript/category'].parse(returnData) + '\n\t</noscript>' +
|
'\n\t<noscript>\n' + templates['noscript/header'] + templates['noscript/category'].parse(returnData) + '\n\t</noscript>' +
|
||||||
@@ -293,8 +292,6 @@ var express = require('express'),
|
|||||||
|
|
||||||
app.all('/test', function(req, res) {
|
app.all('/test', function(req, res) {
|
||||||
res.send();
|
res.send();
|
||||||
// console.log('CSRF is: ', res.locals.token);
|
|
||||||
// res.send('<form method="POST" action="/test"><input type="hidden" name="_csrf" value="' + res.locals.token + '" /><button type="submit">go</button></form>');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user