Button on search screen to go back

main
Bob Mottram 2019-12-17 12:58:10 +00:00
parent b8b720ccad
commit e87f66f62d
2 changed files with 8 additions and 3 deletions

View File

@ -1674,7 +1674,8 @@ class PubServer(BaseHTTPRequestHandler):
self.path=self.path.split('?')[0] self.path=self.path.split('?')[0]
# show the search screen # show the search screen
msg=htmlSearch(self.server.translate, \ msg=htmlSearch(self.server.translate, \
self.server.baseDir,self.path).encode() self.server.baseDir,self.path, \
self.server.defaultTimeline).encode()
self._set_headers('text/html',len(msg),cookie) self._set_headers('text/html',len(msg),cookie)
self._write(msg) self._write(msg)
self.server.GETbusy=False self.server.GETbusy=False

View File

@ -3808,13 +3808,16 @@ def htmlHashTagSwarm(baseDir: str,actor: str) -> str:
return tagSwarmHtml return tagSwarmHtml
def htmlSearch(translate: {}, \ def htmlSearch(translate: {}, \
baseDir: str,path: str) -> str: baseDir: str,path: str, \
defaultTimeline:str) -> str:
"""Search called from the timeline icon """Search called from the timeline icon
""" """
actor=path.replace('/search','') actor=path.replace('/search','')
nickname=getNicknameFromActor(actor) nickname=getNicknameFromActor(actor)
domain,port=getDomainFromActor(actor) domain,port=getDomainFromActor(actor)
backUrl=actor+'/'+defaultTimeline
if os.path.isfile(baseDir+'/img/search-background.png'): if os.path.isfile(baseDir+'/img/search-background.png'):
if not os.path.isfile(baseDir+'/accounts/search-background.png'): if not os.path.isfile(baseDir+'/accounts/search-background.png'):
copyfile(baseDir+'/img/search-background.png',baseDir+'/accounts/search-background.png') copyfile(baseDir+'/img/search-background.png',baseDir+'/accounts/search-background.png')
@ -3832,6 +3835,7 @@ def htmlSearch(translate: {}, \
followStr+=' <form method="POST" accept-charset="UTF-8" action="'+actor+'/searchhandle">' followStr+=' <form method="POST" accept-charset="UTF-8" action="'+actor+'/searchhandle">'
followStr+=' <input type="hidden" name="actor" value="'+actor+'">' followStr+=' <input type="hidden" name="actor" value="'+actor+'">'
followStr+=' <input type="text" name="searchtext" autofocus><br>' followStr+=' <input type="text" name="searchtext" autofocus><br>'
followStr+=' <a href="'+backUrl+'"><button class="button">'+translate['Go Back']+'</button></a>'
followStr+=' <button type="submit" class="button" name="submitSearch">'+translate['Submit']+'</button>' followStr+=' <button type="submit" class="button" name="submitSearch">'+translate['Submit']+'</button>'
followStr+=' </form>' followStr+=' </form>'
followStr+=' <p class="hashtagswarm">'+htmlHashTagSwarm(baseDir,actor)+'</p>' followStr+=' <p class="hashtagswarm">'+htmlHashTagSwarm(baseDir,actor)+'</p>'