Fixes tags.
This commit is contained in:
parent
5356f47c9c
commit
3897fdc688
3 changed files with 5 additions and 6 deletions
|
@ -48,11 +48,12 @@ fun formatHumanReadableSize(bytes: Long) = when (bytes) {
|
|||
else -> "${bytes / 1_000_000_000} gb"
|
||||
}
|
||||
|
||||
private val tagSplitRegex = Regex("\\s")
|
||||
private val tagSplitRegex = Regex("\\s+")
|
||||
|
||||
object TagAdapter {
|
||||
fun parse(ser: String?): List<Tag> {
|
||||
return ser?.let { if (it.isNotBlank()) it.split(tagSplitRegex).map { Tag(it) } else emptyList() } ?: emptyList()
|
||||
return ser?.trim()?.let { if (it.isNotBlank()) it.split(tagSplitRegex).map { Tag(it) } else emptyList() }
|
||||
?: emptyList()
|
||||
}
|
||||
|
||||
fun List<Tag>.serialize() = if (this.isEmpty()) "" else this.joinToString(",") { it.value }
|
||||
|
|
|
@ -15,9 +15,8 @@
|
|||
</div>
|
||||
|
||||
<div class="field border label">
|
||||
<input id="itags" type="text" name="tags">
|
||||
<input id="itags" type="text" name="tags" value="{for $tags}{*$tag} {/for}">
|
||||
<label for="itags">Tags</label>
|
||||
<div id="tags">{for $tags}<span>{*$tag}</span>{/for}</div>
|
||||
</div>
|
||||
|
||||
<div class="field textarea label border">
|
||||
|
|
|
@ -14,9 +14,8 @@
|
|||
</div>
|
||||
|
||||
<div class="field border label">
|
||||
<input id="itags" type="text" name="tags">
|
||||
<input id="itags" type="text" name="tags" value="{for $tags}{*$tag} {/for}">
|
||||
<label for="itags">Tags</label>
|
||||
<div id="tags">{for $tags}<span>{*$tag}</span>{/for}</div>
|
||||
</div>
|
||||
|
||||
<div class="field textarea label border">
|
||||
|
|
Loading…
Reference in a new issue