Skip to content

Commit

Permalink
unbreak search
Browse files Browse the repository at this point in the history
  • Loading branch information
ralsina committed Jul 16, 2017
1 parent d00adfb commit 93bb83d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
3 changes: 1 addition & 2 deletions _static/assets/js/connect_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ document.addEventListener('DOMContentLoaded', function () {
// If we are showing a modal, don't jump to a separate page
if (!$('#editModal').is(':visible') &&
!$('#helpModal').is(':visible') &&
!$('#newPageModal').is(':visible') &&
!$('#searchModal').is(':visible')) {
!$('#newPageModal').is(':visible')) {
load()
} else {
// When a modal is shown, keep the hash fixed to the wiki page
Expand Down
2 changes: 2 additions & 0 deletions _static/assets/js/index_sanic.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
help_path = '/_static/help.md'

function load() {
q = window.location.hash
if (!q || q == '') {
Expand Down
16 changes: 11 additions & 5 deletions gyro.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ async def post_wikiword(request, word='index'):
with open(path, mode='w', encoding='utf-8') as outf:
outf.write(markdown)
reindex_site() # FIXME: this can be made more efficient.
return response.json({'message': 'Saved'})
return response.json(
{
'message': 'Saved'
}, headers={"Cache-Control": "no-cache"})


@app.route('/<word:path>', methods=['DELETE'])
@app.route('/', methods=['DELETE'])
Expand Down Expand Up @@ -82,12 +86,14 @@ def reindex_site():
@app.route('/_title_list')
async def get_title_list(request):
titles = glob.glob(os.path.join('pages', '**', '*.md'), recursive=True)
titles = [os.path.splitext('/'.join(t.split(os.sep)[1:]))[0] for t in titles]
titles = [
os.path.splitext('/'.join(t.split(os.sep)[1:]))[0] for t in titles
]
return response.json(titles)


if __name__ == '__main__':
host = os.environ.get('host','127.0.0.1')
port = int(os.environ.get('port','8000'))
debug = os.environ.get('debug','true').lower() == 'true'
host = os.environ.get('host', '127.0.0.1')
port = int(os.environ.get('port', '8000'))
debug = os.environ.get('debug', 'true').lower() == 'true'
app.run(host, port, debug=debug)

0 comments on commit 93bb83d

Please sign in to comment.