mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-27 17:11:14 +01:00
closes #6528
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
@import "./manage/registration";
|
||||
@import "./manage/users";
|
||||
@import "./manage/admins-mods";
|
||||
@import "./manage/post-queue";
|
||||
@import "./appearance/customise";
|
||||
@import "./appearance/themes";
|
||||
@import "./extend/plugins";
|
||||
|
||||
8
public/less/admin/manage/post-queue.less
Normal file
8
public/less/admin/manage/post-queue.less
Normal file
@@ -0,0 +1,8 @@
|
||||
.posts-list {
|
||||
.post-content-editable {
|
||||
textarea {
|
||||
width: 100%;
|
||||
height: 300px;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,15 +22,28 @@ define('admin/manage/post-queue', function () {
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.posts-list').on('input', '[data-id]', function () {
|
||||
$('.posts-list').on('click', '.post-content', function () {
|
||||
var el = $(this);
|
||||
el.addClass('hidden');
|
||||
var textareaParent = el.parent().find('.post-content-editable');
|
||||
textareaParent.removeClass('hidden').find('textarea').focus();
|
||||
});
|
||||
|
||||
$('.posts-list').on('blur', '.post-content-editable textarea', function () {
|
||||
var textarea = $(this);
|
||||
var preview = textarea.parent().parent().find('.post-content');
|
||||
var id = textarea.parents('[data-id]').attr('data-id');
|
||||
|
||||
socket.emit('posts.editQueuedContent', {
|
||||
id: el.attr('data-id'),
|
||||
content: el.find('.post-content').html(),
|
||||
}, function (err) {
|
||||
id: id,
|
||||
content: textarea.val(),
|
||||
}, function (err, data) {
|
||||
if (err) {
|
||||
return app.alertError(err);
|
||||
}
|
||||
preview.html(data.postData.content);
|
||||
textarea.parent().addClass('hidden');
|
||||
preview.removeClass('hidden');
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -7,6 +7,7 @@ var user = require('../../user');
|
||||
var topics = require('../../topics');
|
||||
var categories = require('../../categories');
|
||||
var pagination = require('../../pagination');
|
||||
var plugins = require('../../plugins');
|
||||
var utils = require('../../utils');
|
||||
|
||||
var postQueueController = module.exports;
|
||||
@@ -79,6 +80,7 @@ function getQueuedPosts(ids, callback) {
|
||||
});
|
||||
|
||||
async.map(postData, function (postData, next) {
|
||||
postData.data.rawContent = postData.data.content;
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
if (postData.data.cid) {
|
||||
@@ -95,6 +97,10 @@ function getQueuedPosts(ids, callback) {
|
||||
},
|
||||
function (categoryData, next) {
|
||||
postData.category = categoryData;
|
||||
plugins.fireHook('filter:parse.post', { postData: postData.data }, next);
|
||||
},
|
||||
function (result, next) {
|
||||
postData.data.content = result.postData.content;
|
||||
next(null, postData);
|
||||
},
|
||||
], next);
|
||||
|
||||
@@ -4,6 +4,7 @@ var async = require('async');
|
||||
|
||||
var posts = require('../posts');
|
||||
var privileges = require('../privileges');
|
||||
var plugins = require('../plugins');
|
||||
var meta = require('../meta');
|
||||
var topics = require('../topics');
|
||||
var user = require('../user');
|
||||
@@ -184,7 +185,14 @@ SocketPosts.editQueuedContent = function (socket, data, callback) {
|
||||
if (!data || !data.id || !data.content) {
|
||||
return callback(new Error('[[error:invalid-data]]'));
|
||||
}
|
||||
posts.editQueuedContent(socket.uid, data.id, data.content, callback);
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
posts.editQueuedContent(socket.uid, data.id, data.content, next);
|
||||
},
|
||||
function (next) {
|
||||
plugins.fireHook('filter:parse.post', { postData: data }, next);
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
function acceptOrReject(method, socket, data, callback) {
|
||||
|
||||
@@ -42,7 +42,10 @@
|
||||
<!-- ENDIF posts.data.tid -->
|
||||
{posts.data.title}
|
||||
</td>
|
||||
<td class="col-md-5 post-content" contenteditable="true">{posts.data.content}</td>
|
||||
<td class="col-md-5 post-content">{posts.data.content}</td>
|
||||
<td class="col-md-5 post-content-editable hidden">
|
||||
<textarea>{posts.data.rawContent}</textarea>
|
||||
</td>
|
||||
<td class="col-md-1">
|
||||
<span class="timeago" title={posts.data.timestampISO}></span>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user