feat: add line breaks on threads list text

This commit is contained in:
Yanislav Igonin 2022-01-20 21:03:18 +02:00
parent 16d5fa039e
commit 62be228308
5 changed files with 41 additions and 56 deletions

View File

@ -15,11 +15,3 @@
.file {
width: 100%;
}
.line-break {
white-space: pre-line;
}
.word-wrap {
word-break: break-word;
}

3
static/styles/utils.css Normal file
View File

@ -0,0 +1,3 @@
.line-break {
white-space: pre-line;
}

View File

@ -1,11 +1,9 @@
<!DOCTYPE html>
<html lang="en">
<head>
{{ template "static" }}
<link
href="/static/styles/index.css"
rel="stylesheet"
>
<link href="/static/styles/index.css" rel="stylesheet">
{{ template "meta-tags-static" }}
</head>
@ -24,11 +22,8 @@
{{ $length := len $Post.Files }}
{{ if gt $length 0 }}
{{ $FirstFile := index $Post.Files 0 }}
<img
src="/uploads/{{$Post.ID}}/t/{{$FirstFile.ID}}.{{$FirstFile.Ext}}"
class="card-img-top"
alt="Uploaded picture"
>
<img src="/uploads/{{$Post.ID}}/t/{{$FirstFile.ID}}.{{$FirstFile.Ext}}" class="card-img-top"
alt="Uploaded picture">
{{ end }}
<div class="card-body">
@ -38,9 +33,9 @@
{{ $textLength := len $Post.Text }}
{{ if gt $textLength 300 }}
<p class="card-text">{{ slice $Post.Text 0 300 }} ...</p>
<p class="card-text line-break text-break">{{ slice $Post.Text 0 300 }} ...</p>
{{ else }}
<p class="card-text">{{$Post.Text}}</p>
<p class="card-text line-break text-break">{{$Post.Text}}</p>
{{ end }}
<a href="/{{$Post.ID}}" class="btn btn-outline-primary">Open</a>

View File

@ -11,8 +11,6 @@
crossorigin="anonymous">
</script>
<link rel="icon" href="/static/favicon.ico"/>
<link
href="/static/styles/post-form.css"
rel="stylesheet"
>
<link href="/static/styles/utils.css" rel="stylesheet">
<link href="/static/styles/post-form.css" rel="stylesheet">
{{ end }}

View File

@ -2,11 +2,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
{{ template "static" }}
{{ template "meta-tags-dynamic" $FirstPost }}
<link href="/static/styles/thread.css" rel="stylesheet" >
<link href="/static/styles/post.css" rel="stylesheet" >
<link href="/static/styles/thread.css" rel="stylesheet">
<link href="/static/styles/post.css" rel="stylesheet">
</head>
<body>
@ -34,11 +35,7 @@
{{ range $File := $Post.Files }}
<div class="file-container">
<a href="/uploads/{{$FirstPost.ID}}/o/{{$File.ID}}.{{$File.Ext}}" target="blank">
<img
src="/uploads/{{$FirstPost.ID}}/t/{{$File.ID}}.{{$File.Ext}}"
class="file"
alt="Uploaded picture"
>
<img src="/uploads/{{$FirstPost.ID}}/t/{{$File.ID}}.{{$File.Ext}}" class="file" alt="Uploaded picture">
</a>
</div>
{{ end }}
@ -46,7 +43,7 @@
{{ end }}
<div class="p-2">
<p class="card-text line-break word-wrap">{{$Post.Text}}</p>
<p class="card-text line-break text-break">{{$Post.Text}}</p>
</div>
</div>