quote gets added to the active composer instead of starting a new one.

This commit is contained in:
Matti Leppänen
2014-01-27 02:51:49 +02:00
parent 6ab08e91a2
commit 4f495e2b46
2 changed files with 26 additions and 4 deletions

View File

@@ -32,6 +32,26 @@ define(['taskbar'], function(taskbar) {
}
}
composer.addQuote = function(tid,pid, title,username, text){
if (allowed()) {
var uuid = composer.active;
if(uuid !== undefined){
var bodyEl = $('#cmp-uuid-'+uuid).find('textarea');
var prevText = bodyEl.val();
if(tid !== composer.posts[uuid].tid) {
text = '\n'+username + ' said in ['+title+'](/topic/'+tid+'#'+pid+'):\n'+text;
}else {
text ='\n'+ username + ' said:\n' + text;
}
composer.posts[uuid].body = prevText + text;
bodyEl.val(composer.posts[uuid].body);
}else{
composer.newReply(tid,title,username + ' said:\n' + text);
}
}
};
composer.newReply = function(tid, title, text) {
if(allowed()) {
push({
@@ -373,8 +393,6 @@ define(['taskbar'], function(taskbar) {
titleEl.focus();
}
}
composer.post = function(post_uuid) {
var postData = composer.posts[post_uuid],
postContainer = $('#cmp-uuid-' + post_uuid),
@@ -586,6 +604,7 @@ define(['taskbar'], function(taskbar) {
return {
newTopic: composer.newTopic,
newReply: composer.newReply,
addQuote: composer.addQuote,
editPost: composer.editPost,
load: composer.load,
minimize: composer.minimize