]> git.phdru.name Git - m_librarian.git/blobdiff - m_librarian/web/views/search_authors_form.tmpl
Feat(web): Preserve values in form
[m_librarian.git] / m_librarian / web / views / search_authors_form.tmpl
index ec731552518d70a1a90d044d40ebfe243e2d9c66..c3aa07ce027ed8fe7c8f9fcfd43255e8100edd58 100644 (file)
@@ -1,15 +1,26 @@
 #encoding utf-8
+#from bottle import html_escape
+#def $search_type_checked($value)
+#if $getVar('search_type', '') == $value
+checked#slurp
+#end if
+#end def
+#def $case_sensitive_checked
+#if $getVar('case_sensitive', None)
+checked#slurp
+#end if
+#end def
 <form action="/search_authors/" method="POST">
-  <input name="search_authors" type="text" style="width: 80%">
+  <input name="search_authors" value="$html_escape($getVar('search_authors', ''))" type="text" style="width: 80%">
   <br>
-  <input name="search_type" value="start" type="radio">
+  <input name="search_type" value="start" $search_type_checked('start') type="radio">
   Подстрока в начале
-  <input name="search_type" value="substring" type="radio">
+  <input name="search_type" value="substring" $search_type_checked('substring') type="radio">
   Подстрока
-  <input name="search_type" value="full" type="radio">
+  <input name="search_type" value="full" $search_type_checked('full') type="radio">
   Точное совпадение
   <br>
-  <input name="case_sensitive" type="checkbox">
+  <input name="case_sensitive" type="checkbox" $case_sensitive_checked>
   Различать прописные/строчные
   <br>
   <input name="submit" type="submit">