hikan.ru/mvc/views/post/AJAXpost.gohtml

80 lines
2.5 KiB
Plaintext

{{ template "AJAXpost" . }}
{{ define "AJAXpost" }}
{{ $post := .PostsSublist.GetPostById .Number }}
<div class="page-name">
C:\<a class="accent"
hx-get="/AJAXindex/1"
hx-target=".main-content"
hx-swap="innerHTML"
hx-push-url="/index/1">blog</a>\<a
class="accent"
hx-get="/AJAXpost/{{ .Number }}"
hx-target=".main-content"
hx-swap="innerHTML"
hx-push-url="/post/{{ .Number }}">{{ $post.Title }}</a>\>
<span class="cursor">|</span>
</div>
<div class="post-container">
<div class="post-header">
{{ if ne .AccessLvl 0 }}
<div class="content-control">
{{ template "ContentControl" . }}
</div>
{{ end }}
{{ if ne $post.Tags "" }}
<div class="tags">
{{ range SplitString $post.Tags " " }}{{ . }} {{ end }} |
Опубликовано: {{ $post.PostingTime }} -- Обновлено: {{ $post.UpdateTime }}
</div>
{{ end }}
</div>
<div style="margin-top: -1vw;">
{{ $post.Body }}
</div>
</div>
{{ template "mail" . }}
<div class="read-other-posts">
<div id="right-border"></div>
<span>READ OTHER POSTS</span>
<div id="left-border"></div>
</div>
{{ if ne .Number 1 }}
{{ $nextPost := .PostsSublist.GetPostById (add .Number -1) }}
<div class="next-post">
<a
hx-get="/AJAXpost/{{ add .Number -1 }}"
hx-target=".main-content"
hx-swap="innerHTML"
hx-push-url="/post/{{ add .Number -1 }}">
{{ $nextPost.Title }} →
</a>
</div>
{{ end }}
{{ template "footer" . }}
{{ end }}
{{ define "ContentControl" }}
{{ $post := .PostsSublist.GetPostById .Number }}
<span class="gray">Управление контентом: </span>
<form
action="/delpost/{{ .Number }}"
method="POST">
<button
id="del-submit"
type="submit"
style="display: none;"
class="submit-button">
</button>
<span
style="cursor: pointer;"
onclick="document.getElementById('del-submit').click();">
🗑️
</span>
</form>
<a
hx-get="/AJAXeditpage/{{ .Number }}"
hx-target=".main-content"
hx-swap="innerHTML"
hx-push-url="/editpage/{{ .Number }}">🖍️</a>
{{ end }}