diff --git a/app/forms.py b/app/forms.py new file mode 100644 index 0000000..be2c6a6 --- /dev/null +++ b/app/forms.py @@ -0,0 +1,22 @@ +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from flask_wtf import FlaskForm +from wtforms import StringField, TextField, SubmitField +from wtforms.validators import DataRequired, Length + +class SearchForm(FlaskForm): + """Search form.""" + query = StringField('Query', [DataRequired()]) + submit = SubmitField('Search') diff --git a/app/templates/search.html b/app/templates/search.html new file mode 100644 index 0000000..9bc4565 --- /dev/null +++ b/app/templates/search.html @@ -0,0 +1,43 @@ + + +{% extends 'base.html' %} + +{% block content %} + + + +
+

Search in this Agora

+
+
{{ form.query.label }} {{ form.query(size=20, autofocus=true) }} + {{ form.csrf_token }} + {{ form.submit }}
+
+
+ +{% if subnodes %} +
+

Results

+{% for subnode in subnodes %} +(user: {{subnode.user}}) {{ subnode.uri }}: {{subnode.wikilink}}
+{% endfor %} +{% endif %} + +{% endblock %}