Skip to content

Commit

Permalink
Merge branch 'clenk' into celery
Browse files Browse the repository at this point in the history
  • Loading branch information
awest1339 committed Sep 8, 2017
2 parents d2e7fb9 + ceef8f1 commit 8f2d7cb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion web/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def tasks():

@app.route('/report/<int:task_id>', methods=['GET'])
def reports(task_id=1):
term = re.escape(request.args.get('st', None))
term = re.escape(request.args.get('st', ''))

return render_template('report.html', task_id=task_id,
api_loc=app.config['API_LOC'], search_term=term)
Expand Down
10 changes: 10 additions & 0 deletions web/templates/report.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
else {
shouldExpand = (parentSize < 10 && numberRowsInContent < 10);
}
{% if search_term %}
if (!shouldExpand && content.indexOf('{{ search_term }}') >= 0) {
shouldExpand = true;
}
{% endif %}

if (shouldExpand) {
expanderStyle = 'style="display: none;"'
Expand Down Expand Up @@ -233,6 +238,11 @@
.attr("data-placement", "left")
.tooltip();
})

{% if search_term %}
// Scroll to highlighted search term
$('html, body'). scrollTop($('.highlight').first().offset().top);
{% endif %}
});
}

Expand Down

0 comments on commit 8f2d7cb

Please sign in to comment.