Skip to content

Commit

Permalink
add task 11
Browse files Browse the repository at this point in the history
  • Loading branch information
alexaorrico committed Dec 4, 2017
1 parent 1c17062 commit ce73eb1
Show file tree
Hide file tree
Showing 8 changed files with 214 additions and 0 deletions.
27 changes: 27 additions & 0 deletions web_flask/10-hbnb_filters.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/python3
"""
starts a Flask web application
"""

from flask import Flask, render_template
from models import *
from models import storage
app = Flask(__name__)


@app.route('/hbnb_filters', strict_slashes=False)
def filters():
"""display a HTML page like 6-index.html from static"""
states = storage.all("State").values()
amenities = storage.all("Amenity").values()
return render_template('10-hbnb_filters.html', states=states,
amenities=amenities)


@app.teardown_appcontext
def teardown_db(exception):
"""closes the storage on teardown"""
storage.close()

if __name__ == '__main__':
app.run(host='0.0.0.0', port='5000')
Binary file added web_flask/static/images/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web_flask/static/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions web_flask/static/styles/3-footer.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
footer {
position: fixed;
bottom: 0;
width: 100%;
background-color: white;
height: 60px;
border-top: 1px solid #CCCCCC;
display: flex;
justify-content: center;
align-items: center;
}
15 changes: 15 additions & 0 deletions web_flask/static/styles/3-header.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
header {
width: 100%;
background-color: white;
height: 70px;
border-bottom: 1px solid #CCCCCC;
display: flex;
align-items: center;
}

.logo {
width: 142px;
height: 60px;
background: url("../images/logo.png") no-repeat center;
padding-left: 20px;
}
15 changes: 15 additions & 0 deletions web_flask/static/styles/4-common.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
body {
margin: 0;
padding: 0;
color: #484848;
font-size: 14px;
font-family: Circular,"Helvetica Neue",Helvetica,Arial,sans-serif;
}

.container {
max-width: 1000px;
margin-top: 30px;
margin-bottom: 30px;
margin-left: auto;
margin-right: auto;
}
91 changes: 91 additions & 0 deletions web_flask/static/styles/6-filters.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
.filters {
background-color: white;
height: 70px;
width: 100%;
border: 1px solid #DDDDDD;
border-radius: 4px;
display: flex;
align-items: center;
}

section.filters > button{
font-size: 18px;
color: white;
background-color: #FF5A5F;
height: 48px;
border: 0px;
border-radius: 4px;
width: 20%;
margin-left: auto;
margin-right: 30px;
opacity: 1;
}

section.filters > button:hover {
opacity: 0.9;
}

.locations, .amenities {
height: 100%;
width: 25%;
padding-left: 50px;
}

.locations {
border-right: 1px solid #DDDDDD;
}
.locations > h3, .amenities > h3 {
font-weight: 600;
margin: 12px 0 5px 0;
}

.locations > h4, .amenities > h4 {
font-weight: 400;
font-size: 14px;
margin: 0 0 5px 0;
}

.popover {
display: none;
position: relative;
left: -51px;
background-color: #FAFAFA;
width: 100%;
border: 1px solid #DDDDDD;
border-radius: 4px;
z-index: 1;
padding: 30px 50px 30px 0;
margin-top: 17px;
}

.popover, .popover ul {
list-style-type: none;
}
.locations:hover > .popover {
display: block;
}

.amenities:hover > .popover {
display: block;
}

.popover h2 {
margin-top: 0px;
margin-bottom: 5px;
}

.locations > .popover > li {
margin-bottom: 30px;
margin-left: 30px;
}
.locations > .popover > li > ul {
padding-left: 20px;
}
.locations > .popover > li > ul > li {
margin-bottom: 10px;
}

.amenities > .popover > li {
margin-left: 50px;
margin-bottom: 10px;
}
55 changes: 55 additions & 0 deletions web_flask/templates/10-hbnb_filters.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="styles/4-common.css">
<link rel="stylesheet" href="styles/3-header.css">
<link rel="stylesheet" href="styles/3-footer.css">
<link rel="stylesheet" href="styles/6-filters.css">
<link rel="icon" href="images/icon.png" type="image/png">
<title>AirBnb Clone</title>
</head>
<body>
<header>
<div class="logo">
</div>
</header>
<div class="container">
<section class="filters">
<div class="locations">
<h3>States</h3>
<h4>&nbsp;</h4>
<ul class="popover">
{% for state in states|sort(attribute='name') %}
<li>
<h2>{{ state.name }}:</h2>
<ul>
{% for city in state.cities|sort(attribute='name') %}
<li>{{ city.name }}</li>
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
</div>
<div class="amenities">
<h3>Amenities</h3>
<h4>&nbsp;</h4>
<ul class="popover">
{% for amenity in amenities|sort(attribute='name') %}
<li>{{ amenity.name }}</li>
{% endfor %}
</ul>
</div>
<button>
Search
</button>
</section>
</div>
<footer>
<p>
Holberton School
</p>
</footer>
</body>
</html>

0 comments on commit ce73eb1

Please sign in to comment.