Add custom embed_by_username feature

Feature to allow each imported post to be created using a different discourse
username. A possible use case of this is a multi-author blog where discourse
is being used to track comments. This feature allows authors to receive
updates when someone leaves a comment on one of their articles because each of
the imported posts can be created using the discourse username of the author.
This commit is contained in:
Justin Leveck
2014-04-24 09:48:45 -07:00
parent 8e882ad145
commit a78df3d57d
8 changed files with 184 additions and 65 deletions

View File

@@ -1,10 +1,24 @@
/* global discourseUrl */
/* global discourseUserName */
/* global discourseEmbedUrl */
(function() {
var comments = document.getElementById('discourse-comments'),
iframe = document.createElement('iframe');
iframe.src = discourseUrl + "embed/comments?embed_url=" + encodeURIComponent(discourseEmbedUrl);
iframe = document.createElement('iframe');
if (typeof discourseUserName === 'undefined') {
iframe.src =
[ discourseUrl,
'embed/comments?embed_url=',
encodeURIComponent(discourseEmbedUrl)
].join('');
} else {
iframe.src =
[ discourseUrl,
'embed/comments?embed_url=',
encodeURIComponent(discourseEmbedUrl),
'&discourse_username=',
discourseUserName
].join('');
}
iframe.id = 'discourse-embed-frame';
iframe.width = "100%";
iframe.frameBorder = "0";