diff --git a/client/html/post_edit_sidebar.tpl b/client/html/post_edit_sidebar.tpl
index a66a375f..e13070af 100644
--- a/client/html/post_edit_sidebar.tpl
+++ b/client/html/post_edit_sidebar.tpl
@@ -93,6 +93,15 @@
<% } %>
+ <% if (ctx.canEditPostSource) { %>
+
+ <%= ctx.makeTextInput({
+ text: 'Source',
+ name: 'source',
+ }) %>
+
+ <% } %>
+
<% if (ctx.canFeaturePosts || ctx.canDeletePosts || ctx.canMergePosts) { %>
diff --git a/client/html/post_readonly_sidebar.tpl b/client/html/post_readonly_sidebar.tpl
index 401ce209..2b4712c5 100644
--- a/client/html/post_readonly_sidebar.tpl
+++ b/client/html/post_readonly_sidebar.tpl
@@ -44,6 +44,21 @@
Google Images
+
+
diff --git a/client/js/controls/post_edit_sidebar_control.js b/client/js/controls/post_edit_sidebar_control.js
index a5af449c..856a9f06 100644
--- a/client/js/controls/post_edit_sidebar_control.js
+++ b/client/js/controls/post_edit_sidebar_control.js
@@ -37,6 +37,7 @@ class PostEditSidebarControl extends events.EventTarget {
canEditPostFlags: api.hasPrivilege('posts:edit:flags'),
canEditPostContent: api.hasPrivilege('posts:edit:content'),
canEditPostThumbnail: api.hasPrivilege('posts:edit:thumbnail'),
+ canEditPostSource : api.hasPrivilege('posts:edit:source'),
canCreateAnonymousPosts: api.hasPrivilege('posts:create:anonymous'),
canDeletePosts: api.hasPrivilege('posts:delete'),
canFeaturePosts: api.hasPrivilege('posts:feature'),
@@ -58,7 +59,7 @@ class PostEditSidebarControl extends events.EventTarget {
new ExpanderControl(
'post-content',
'Content',
- this._hostNode.querySelectorAll('.post-content, .post-thumbnail'));
+ this._hostNode.querySelectorAll('.post-content, .post-thumbnail, .post-source'));
new ExpanderControl(
'post-management',
'Management',
@@ -349,6 +350,10 @@ class PostEditSidebarControl extends events.EventTarget {
thumbnail: this._newPostThumbnail !== undefined ?
this._newPostThumbnail :
undefined,
+
+ source: this._sourceInputNode ?
+ this._sourceInputNode.value :
+ undefined,
},
}));
}
@@ -402,6 +407,10 @@ class PostEditSidebarControl extends events.EventTarget {
return this._formNode.querySelector('.post-thumbnail a');
}
+ get _sourceInputNode() {
+ return this._formNode.querySelector('.post-source input');
+ }
+
get _featureLinkNode() {
return this._formNode.querySelector('.management .feature');
}
diff --git a/client/js/models/post.js b/client/js/models/post.js
index aea8c4cc..0d9b0d42 100644
--- a/client/js/models/post.js
+++ b/client/js/models/post.js
@@ -32,6 +32,7 @@ class Post extends events.EventTarget {
get contentUrl() { return this._contentUrl; }
get fullContentUrl() { return this._fullContentUrl; }
get thumbnailUrl() { return this._thumbnailUrl; }
+ get source() { return this._source; }
get canvasWidth() { return this._canvasWidth || 800; }
get canvasHeight() { return this._canvasHeight || 450; }
get fileSize() { return this._fileSize || 0; }
@@ -57,6 +58,7 @@ class Post extends events.EventTarget {
set relations(value) { this._relations = value; }
set newContent(value) { this._newContent = value; }
set newThumbnail(value) { this._newThumbnail = value; }
+ set source(value) { this._source = value; }
static fromResponse(response) {
const ret = new Post();
@@ -122,6 +124,9 @@ class Post extends events.EventTarget {
if (this._newThumbnail !== undefined) {
files.thumbnail = this._newThumbnail;
}
+ if (this._source !== this._orig._source) {
+ detail.source = this._source;
+ }
let apiPromise = this._id ?
api.put(uri.formatApiLink('post', this.id), detail, files) :
@@ -278,6 +283,7 @@ class Post extends events.EventTarget {
_contentUrl: response.contentUrl,
_fullContentUrl: new URL(response.contentUrl, document.getElementsByTagName('base')[0].href).href,
_thumbnailUrl: response.thumbnailUrl,
+ _source: response.source,
_canvasWidth: response.canvasWidth,
_canvasHeight: response.canvasHeight,
_fileSize: response.fileSize,