client/posts: implement loop video flag
This commit is contained in:
parent
865c4f3b79
commit
8a68e182fd
4 changed files with 19 additions and 1 deletions
|
@ -50,10 +50,10 @@
|
||||||
<section class='flags'>
|
<section class='flags'>
|
||||||
<label>Miscellaneous</label>
|
<label>Miscellaneous</label>
|
||||||
|
|
||||||
<!-- TODO: bind state -->
|
|
||||||
<%= ctx.makeCheckbox({
|
<%= ctx.makeCheckbox({
|
||||||
text: 'Loop video',
|
text: 'Loop video',
|
||||||
name: 'loop',
|
name: 'loop',
|
||||||
|
checked: ctx.post.flags.includes('loop'),
|
||||||
}) %>
|
}) %>
|
||||||
</section>
|
</section>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
|
@ -106,6 +106,9 @@ class PostController {
|
||||||
if (e.detail.safety !== undefined) {
|
if (e.detail.safety !== undefined) {
|
||||||
post.safety = e.detail.safety;
|
post.safety = e.detail.safety;
|
||||||
}
|
}
|
||||||
|
if (e.detail.flags !== undefined) {
|
||||||
|
post.flags = e.detail.flags;
|
||||||
|
}
|
||||||
if (e.detail.relations !== undefined) {
|
if (e.detail.relations !== undefined) {
|
||||||
post.relations = e.detail.relations;
|
post.relations = e.detail.relations;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,10 @@ class PostEditSidebarControl extends events.EventTarget {
|
||||||
.value.toLowerCase() :
|
.value.toLowerCase() :
|
||||||
undefined,
|
undefined,
|
||||||
|
|
||||||
|
flags: this._loopVideoInputNode ?
|
||||||
|
(this._loopVideoInputNode.checked ? ['loop'] : []) :
|
||||||
|
undefined,
|
||||||
|
|
||||||
tags: this._tagInputNode ?
|
tags: this._tagInputNode ?
|
||||||
misc.splitByWhitespace(this._tagInputNode.value) :
|
misc.splitByWhitespace(this._tagInputNode.value) :
|
||||||
undefined,
|
undefined,
|
||||||
|
@ -78,6 +82,10 @@ class PostEditSidebarControl extends events.EventTarget {
|
||||||
return this._formNode.querySelector('.tags input');
|
return this._formNode.querySelector('.tags input');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get _loopVideoInputNode() {
|
||||||
|
return this._formNode.querySelector('.flags input[name=loop]');
|
||||||
|
}
|
||||||
|
|
||||||
get _relationsInputNode() {
|
get _relationsInputNode() {
|
||||||
return this._formNode.querySelector('.relations input');
|
return this._formNode.querySelector('.relations input');
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ class Post extends events.EventTarget {
|
||||||
this._canvasHeight = null;
|
this._canvasHeight = null;
|
||||||
this._fileSize = null;
|
this._fileSize = null;
|
||||||
|
|
||||||
|
this._flags = [];
|
||||||
this._tags = [];
|
this._tags = [];
|
||||||
this._notes = [];
|
this._notes = [];
|
||||||
this._comments = [];
|
this._comments = [];
|
||||||
|
@ -51,6 +52,7 @@ class Post extends events.EventTarget {
|
||||||
get canvasHeight() { return this._canvasHeight || 450; }
|
get canvasHeight() { return this._canvasHeight || 450; }
|
||||||
get fileSize() { return this._fileSize || 0; }
|
get fileSize() { return this._fileSize || 0; }
|
||||||
|
|
||||||
|
get flags() { return this._flags; }
|
||||||
get tags() { return this._tags; }
|
get tags() { return this._tags; }
|
||||||
get notes() { return this._notes; }
|
get notes() { return this._notes; }
|
||||||
get comments() { return this._comments; }
|
get comments() { return this._comments; }
|
||||||
|
@ -61,6 +63,7 @@ class Post extends events.EventTarget {
|
||||||
get ownFavorite() { return this._ownFavorite; }
|
get ownFavorite() { return this._ownFavorite; }
|
||||||
get ownScore() { return this._ownScore; }
|
get ownScore() { return this._ownScore; }
|
||||||
|
|
||||||
|
set flags(value) { this._flags = value; }
|
||||||
set tags(value) { this._tags = value; }
|
set tags(value) { this._tags = value; }
|
||||||
set safety(value) { this._safety = value; }
|
set safety(value) { this._safety = value; }
|
||||||
set relations(value) { this._relations = value; }
|
set relations(value) { this._relations = value; }
|
||||||
|
@ -108,6 +111,9 @@ class Post extends events.EventTarget {
|
||||||
if (this._safety !== this._orig._safety) {
|
if (this._safety !== this._orig._safety) {
|
||||||
detail.safety = this._safety;
|
detail.safety = this._safety;
|
||||||
}
|
}
|
||||||
|
if (_arraysDiffer(this._flags, this._orig._flags)) {
|
||||||
|
detail.flags = this._flags;
|
||||||
|
}
|
||||||
if (_arraysDiffer(this._tags, this._orig._tags)) {
|
if (_arraysDiffer(this._tags, this._orig._tags)) {
|
||||||
detail.tags = this._tags;
|
detail.tags = this._tags;
|
||||||
}
|
}
|
||||||
|
@ -212,6 +218,7 @@ class Post extends events.EventTarget {
|
||||||
_canvasHeight: response.canvasHeight,
|
_canvasHeight: response.canvasHeight,
|
||||||
_fileSize: response.fileSize,
|
_fileSize: response.fileSize,
|
||||||
|
|
||||||
|
_flags: response.flags || [],
|
||||||
_tags: response.tags || [],
|
_tags: response.tags || [],
|
||||||
_notes: response.notes || [],
|
_notes: response.notes || [],
|
||||||
_comments: CommentList.fromResponse(response.comments || []),
|
_comments: CommentList.fromResponse(response.comments || []),
|
||||||
|
|
Loading…
Reference in a new issue