added search page

This commit is contained in:
bytewerk 2015-02-06 22:03:42 +01:00
parent 72daa11c33
commit 71858c6020
8 changed files with 168 additions and 6 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.swp
*.swo

View File

@ -1,6 +1,6 @@
#!/usr/bin/python3
#/* vim:set ts=2 set noexpandtab */
from flask import Flask, render_template, url_for
from flask import Flask, render_template, url_for, request
app = Flask(__name__)
@app.route("/")
@ -15,5 +15,9 @@ def categorys():
def create():
return render_template("create.html")
@app.route("/search", methods=['GET'])
def search():
return render_template("result.html", results=request.args.get("q", ""))
if __name__ == "__main__":
app.run(debug=True)

10
static/css/search.css Normal file
View File

@ -0,0 +1,10 @@
.logo {
max-width: 40%;
margin-bottom: 20px;
}
.search-box {
width: 80%;
margin-left: auto;
margin-right: auto;
}

View File

@ -110,7 +110,7 @@ body {
*/
.cover {
padding: 0 20px;
padding: 20px;
}
.cover .btn-lg {
padding: 10px 20px;
@ -135,7 +135,7 @@ body {
@media (min-width: 768px) {
/* Pull out the header and footer */
.masthead {
position: fixed;
/*position: fixed;*/
top: 0;
}
.mastfoot {
@ -144,7 +144,7 @@ body {
}
/* Start the vertical centering */
.site-wrapper-inner {
vertical-align: middle;
/*vertical-align: middle;*/
}
/* Handle the widths */
.masthead,

120
static/images/Pirates.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 69 KiB

View File

@ -40,7 +40,7 @@ vim: ts=2 noexpandtab
</nav>
</div>
</div>
<div class="inner cover">
<div class="inner cover">
{% block content %}{% endblock %}
</div>
</div>

9
templates/result.html Normal file
View File

@ -0,0 +1,9 @@
<!--
vim: ts=2 noexpandtab
-->
{% extends "index.html" %}
{% block title %}{{ super() }} - Results{% endblock%}
{% set active_page = "search" %}
{% block content %}
<p>{{results}}</p>
{% endblock content%}

View File

@ -5,5 +5,22 @@ vim: ts=2 noexpandtab
{% block title %}{{ super() }} - Search{% endblock%}
{% set active_page = "search" %}
{% block content %}
<p>SEARCH</p>
<link href="{{ url_for("static", filename="css/search.css") }}" rel="stylesheet">
<div class="search_container">
<img class="logo" src="{{ url_for("static", filename="images/Pirates.svg") }}" />
<form action="search" >
<div class="form-group">
<div class="input-group search-box">
<input type="text" name="q" class="form-control" placeholder="Seach for…" aria-describedby="basic-addon2">
<span class="input-group-btn">
<button class="btn btn-default" type="submit">
<span class="glyphicon glyphicon-search" aria-hidden="true"></span>
Search!
</button>
</span>
</div>
</div>
</form>
</div>
{% endblock content%}