Browse Source

logs-content: Added possessive prefix if nick has that.

1.0
Gisle Aune 6 years ago
parent
commit
3981bb1d71
  1. 10
      marko/page/logs-content/components/post/component.js
  2. 2
      marko/page/logs-content/components/post/index.marko

10
marko/page/logs-content/components/post/component.js

@ -4,6 +4,7 @@ module.exports = class {
shortName: "", shortName: "",
name: "", name: "",
text: "", text: "",
nameSuffix: "",
modal: null, modal: null,
removed: false, removed: false,
} }
@ -39,6 +40,7 @@ module.exports = class {
updatePost(input) { updatePost(input) {
this.state.shortName = input.post.nick.split("_").shift() this.state.shortName = input.post.nick.split("_").shift()
this.state.name = input.post.nick this.state.name = input.post.nick
this.state.nameSuffix = ""
this.state.text = input.post.text.replace(/\x02/g, "**") this.state.text = input.post.text.replace(/\x02/g, "**")
@ -51,7 +53,15 @@ module.exports = class {
for (const character of input.characters) { for (const character of input.characters) {
for (const nick of character.nicks) { for (const nick of character.nicks) {
if (nick === postNick) { if (nick === postNick) {
this.state.name = character.name
this.state.shortName = character.shortName this.state.shortName = character.shortName
if (input.post.nick.endsWith("'s")) {
this.state.nameSuffix = "'s"
} else if (input.post.nick.endsWith("'")) {
this.state.nameSuffix = "'"
}
return return
} }
} }

2
marko/page/logs-content/components/post/index.marko

@ -18,7 +18,7 @@
<markdown class="post-content post-scene" source=state.text /> <markdown class="post-content post-scene" source=state.text />
</div> </div>
<div if(input.post.kind === "action") class="post-body color-text"> <div if(input.post.kind === "action") class="post-body color-text">
<markdown class="post-content post-action" source=(state.shortName + " " + state.text) />
<markdown class="post-content post-action" source=(state.shortName + state.nameSuffix + " " + state.text) />
</div> </div>
<div if(input.post.kind === "text") class="post-body color-text"> <div if(input.post.kind === "text") class="post-body color-text">
<markdown class="post-content post-text" source=state.text /> <markdown class="post-content post-text" source=state.text />

Loading…
Cancel
Save