From 62be228308ce22efd8e5f73c43f537aae3cff517 Mon Sep 17 00:00:00 2001 From: Yanislav Igonin Date: Thu, 20 Jan 2022 21:03:18 +0200 Subject: [PATCH] feat: add line breaks on threads list text --- static/styles/post.css | 8 ------- static/styles/utils.css | 3 +++ templates/index.html | 31 +++++++++++--------------- templates/static.html | 6 ++--- templates/thread.html | 49 +++++++++++++++++++---------------------- 5 files changed, 41 insertions(+), 56 deletions(-) create mode 100644 static/styles/utils.css diff --git a/static/styles/post.css b/static/styles/post.css index d968dd2..7760cfd 100644 --- a/static/styles/post.css +++ b/static/styles/post.css @@ -15,11 +15,3 @@ .file { width: 100%; } - -.line-break { - white-space: pre-line; -} - -.word-wrap { - word-break: break-word; -} \ No newline at end of file diff --git a/static/styles/utils.css b/static/styles/utils.css new file mode 100644 index 0000000..abdbd80 --- /dev/null +++ b/static/styles/utils.css @@ -0,0 +1,3 @@ +.line-break { + white-space: pre-line; +} \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index 3d46276..0887520 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,34 +1,29 @@ + {{ template "static" }} - - + + {{ template "meta-tags-static" }}

Welcome to Micrach

- +
{{ template "post-form" .FormData }} - +
{{ range $Post := .Threads }}
- {{ $length := len $Post.Files }} + {{ $length := len $Post.Files }} {{ if gt $length 0 }} {{ $FirstFile := index $Post.Files 0 }} - Uploaded picture + Uploaded picture {{ end }}
@@ -38,9 +33,9 @@ {{ $textLength := len $Post.Text }} {{ if gt $textLength 300 }} -

{{ slice $Post.Text 0 300 }} ...

+

{{ slice $Post.Text 0 300 }} ...

{{ else }} -

{{$Post.Text}}

+

{{$Post.Text}}

{{ end }} Open @@ -55,9 +50,9 @@
    {{ $ActivePage := .Page }} {{ range $i := Iterate .PagesCount }} -
  • - {{ $i }} -
  • +
  • + {{ $i }} +
  • {{ end }}
diff --git a/templates/static.html b/templates/static.html index 46e4795..0f48603 100644 --- a/templates/static.html +++ b/templates/static.html @@ -11,8 +11,6 @@ crossorigin="anonymous"> - + + {{ end }} diff --git a/templates/thread.html b/templates/thread.html index ac91a42..e16a246 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -2,11 +2,12 @@ + {{ template "static" }} {{ template "meta-tags-dynamic" $FirstPost }} - - + + @@ -14,42 +15,38 @@

⤶ {{ if ne $FirstPost.Title "" }} - {{$FirstPost.Title}} + {{$FirstPost.Title}} {{ else }} - Welcome to Micrach + Welcome to Micrach {{ end }}

- +
{{ template "post-form" .FormData }} - +
{{ range $Post := .Thread }} -
+
- {{ $filesLength := len $Post.Files }} - {{ if gt $filesLength 0 }} -
- {{ range $File := $Post.Files }} -
- - Uploaded picture - -
- {{ end }} + {{ $filesLength := len $Post.Files }} + {{ if gt $filesLength 0 }} +
+ {{ range $File := $Post.Files }} + {{ end }} - -
-

{{$Post.Text}}

-
-
+ {{ end }} + +
+

{{$Post.Text}}

+
+ +
{{end}}