client/posts: allow for multiple source URLs to be entered and viewed

This commit is contained in:
Shyam Sunder 2020-01-26 17:49:04 -05:00
parent 0ff9f9d5a2
commit af6eff9ff8
5 changed files with 8 additions and 10 deletions

View file

@ -60,9 +60,8 @@
<% if (ctx.canEditPostSource) { %>
<section class='post-source'>
<%= ctx.makeTextInput({
<%= ctx.makeTextarea({
text: 'Source',
name: 'source',
value: ctx.post.source,
}) %>
</section>

View file

@ -42,9 +42,10 @@
<% if (ctx.post.source) { %>
<section class='source'>
Source: <a href='<%- ctx.post.source %>' title='<%- ctx.post.source %>'>
<%- ctx.post.prettyPrintSource() %>
</a>
Source: <% for (let i = 0; i < ctx.post.sourceSplit.length; i++) { %>
<% if (i != 0) { %>&middot;<% } %>
<a href='<%- ctx.post.sourceSplit[i] %>' title='<%- ctx.post.sourceSplit[i] %>'><%- ctx.extractRootDomain(ctx.post.sourceSplit[i]) %></a>
<% } %>
</section>
<% } %>

View file

@ -408,7 +408,7 @@ class PostEditSidebarControl extends events.EventTarget {
}
get _sourceInputNode() {
return this._formNode.querySelector('.post-source input');
return this._formNode.querySelector('.post-source textarea');
}
get _featureLinkNode() {

View file

@ -27,6 +27,7 @@ class PostReadonlySidebarControl extends events.EventTarget {
canEditPosts: api.hasPrivilege('posts:edit'),
canViewTags: api.hasPrivilege('tags:view'),
escapeColons: uri.escapeColons,
extractRootDomain: uri.extractRootDomain,
getPrettyTagName: misc.getPrettyTagName,
}));

View file

@ -33,6 +33,7 @@ class Post extends events.EventTarget {
get fullContentUrl() { return this._fullContentUrl; }
get thumbnailUrl() { return this._thumbnailUrl; }
get source() { return this._source; }
get sourceSplit() { return this._source.split('\n'); }
get canvasWidth() { return this._canvasWidth || 800; }
get canvasHeight() { return this._canvasHeight || 450; }
get fileSize() { return this._fileSize || 0; }
@ -271,10 +272,6 @@ class Post extends events.EventTarget {
Math.round(Math.random() * 1000);
}
prettyPrintSource() {
return uri.extractRootDomain(this._source);
}
_updateFromResponse(response) {
const map = () => ({
_version: response.version,