Referer cleanup

This commit is contained in:
Zed
2019-09-05 22:53:23 +02:00
parent 1e55f21fa5
commit 7bdf5b0f76
3 changed files with 15 additions and 10 deletions

View File

@@ -39,8 +39,18 @@ proc linkText*(text: string; class=""): VNode =
buildHtml():
a(href=url, class=class): text text
proc refererField*(path: string): VNode =
buildHtml():
verbatim "<input name=\"referer\" style=\"display: none\" value=\"$1\"/>" % path
proc iconReferer*(icon, action, path: string, title=""): VNode =
buildHtml(form(`method`="get", action=action, class="icon-button")):
verbatim "<input name=\"referer\" style=\"display: none\" value=\"$1\"/>" % path
refererField path
button(`type`="submit"):
icon icon, title=title
proc buttonReferer*(action, text, path: string; class=""; `method`="post"): VNode =
buildHtml(form(`method`=`method`, action=action, class=class)):
refererField path
button(`type`="submit"):
text text