logs-content: Added add post form
This commit is contained in:
@@ -5,10 +5,19 @@ const {postApi} = require("../../../../../rpdata/api/Post")
|
||||
module.exports = class {
|
||||
onCreate(input) {
|
||||
this.state = {
|
||||
log: input.log
|
||||
log: input.log,
|
||||
modal: null,
|
||||
}
|
||||
}
|
||||
|
||||
open(modal) {
|
||||
this.state.modal = modal
|
||||
}
|
||||
|
||||
close() {
|
||||
this.state.modal = null
|
||||
}
|
||||
|
||||
/**
|
||||
* Patch the posts
|
||||
*
|
||||
@@ -70,8 +79,13 @@ module.exports = class {
|
||||
})
|
||||
}
|
||||
|
||||
postEdited(post) {
|
||||
this.patch([post])
|
||||
postEdited(patch) {
|
||||
this.patch([patch])
|
||||
}
|
||||
|
||||
postAdded(post) {
|
||||
this.state.log.posts = this.state.log.posts.concat([post])
|
||||
this.state.log = Object.assign({}, this.state.log)
|
||||
}
|
||||
|
||||
get title() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<logs-content-menu user=input.user log=state.log />
|
||||
<logs-content-menu user=input.user log=state.log on-select("open") />
|
||||
<main>
|
||||
<div class="logs-content">
|
||||
<h1 class="color-primary">${component.title}</h1>
|
||||
@@ -12,4 +12,6 @@
|
||||
last=(post.position === state.log.posts.length)
|
||||
/>
|
||||
</div>
|
||||
|
||||
<add-post-modal enabled=(state.modal === "add") logId=state.log.id on-close("close") on-added("postAdded") />
|
||||
</main>
|
||||
Reference in New Issue
Block a user