Skip to content

Commit

Permalink
added content to web_dynamic 1 done
Browse files Browse the repository at this point in the history
  • Loading branch information
amacharla committed Jan 15, 2018
1 parent 988a315 commit d4b69d4
Show file tree
Hide file tree
Showing 13 changed files with 361 additions and 0 deletions.
89 changes: 89 additions & 0 deletions web_dynamic/0-hbnb.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<!DOCTYPE html>
<html lang="zxx">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../static/styles/4-common.css">
<link rel="stylesheet" href="../static/styles/3-header.css">
<link rel="stylesheet" href="../static/styles/3-footer.css">
<link rel="stylesheet" href="../static/styles/6-filters.css">
<link rel="stylesheet" href="../static/styles/8-places.css">
<link rel="icon" href="../static/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.values()|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 amty in amenities.values() %}
<li>{{ amty.name }}</li>
{% endfor %}
</ul>
</div>
<button>
Search
</button>
</section>
<section class="places">
<h1>Places</h1>
{% for place in places.values()|sort(attribute='name') %}
<article>
<h2>{{ place.name }}</h2>
<div class="price_by_night">
<p>${{ place.price_by_night }}</p>
</div>
<div class="information">
<div class="max_guest">
<div class="guest_image"></div>
<p>{{ place.max_guest }}</p>
</div>
<div class="number_rooms">
<div class="bed_image"></div>
<p>{{ place.number_rooms }}</p>
</div>
<div class="number_bathrooms">
<div class="bath_image"></div>
<p>{{ place.number_bathrooms }}</p>
</div>
</div>
<div class="user">
<p><b>Owner: </b>{{ place.user.first_name ~ ' ' ~ place.user.last_name }}</p>
</div>
<div class="description">
{% autoescape false %}
<p>{{ place.description }}</p>
{% endautoescape %}
</div>
</article>
{% endfor %}
</section>
</div>
<footer>
<p>
Holberton School
</p>
</footer>
</body>
</html>
29 changes: 29 additions & 0 deletions web_dynamic/0-hbnb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/python3
"""Flask app to generate complete html page containing location/amenity
dropdown menus and rental listings"""
from flask import Flask, render_template
from models import storage
app = Flask('web_flask')
app.url_map.strict_slashes = False


@app.route('/hbnb')
def display_hbnb():
"""Generate page with popdown menu of states/cities"""
states = storage.all('State')
amenities = storage.all('Amenity')
places = storage.all('Place')
return render_template('0-hbnb.html',
states=states,
amenities=amenities,
places=places)


@app.teardown_appcontext
def teardown_db(*args, **kwargs):
"""Close database or file storage"""
storage.close()


if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000)
1 change: 1 addition & 0 deletions web_dynamic/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#!/usr/bin/python3
Binary file added web_dynamic/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_dynamic/static/images/icon_bath.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_dynamic/static/images/icon_bed.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_dynamic/static/images/icon_group.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_dynamic/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_dynamic/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_dynamic/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_dynamic/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;
}
93 changes: 93 additions & 0 deletions web_dynamic/static/styles/6-filters.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
.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%;
max-height: 300px;
border: 1px solid #DDDDDD;
border-radius: 4px;
z-index: 1;
padding: 30px 50px 30px 0;
margin-top: 17px;
overflow: scroll;
}

.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;
}
108 changes: 108 additions & 0 deletions web_dynamic/static/styles/8-places.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
.places {
width: 100%;
border: 0;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
}

.places > h1 {
font-size: 30px;
padding-left: 20px;
padding-top: 20px;
margin-bottom: 0px;
flex: 0 1 100%;
}
.places > article {
width: 390px;
max-height: fit-content;
padding: 20px 20px 20px 20px;
margin: 20px 20px 20px 20px;
border: 1px solid #FF5A5F;
border-radius: 4px;
display: flex;
flex-direction: column;
justify-content: flex-start;
position: relative;
}

.places > article > h2 {
font-size: 30px;
margin: 0 20% 0 0;
align-self: center;
}

.price_by_night {
color: #FF5A5F;
border: 4px solid #FF5A5F;
min-width: 60px;
height: 60px;
font-size: 30px;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
margin-left: auto;
position: absolute;
top: 10px;
right: 20px;
}
.price_by_night > p {
margin: 0 0 0 0;
}

.information {
align-self: center;
height: 80px;
width: 100%;
border-top: 1px solid #DDDDDD;
border-bottom: 1px solid #DDDDDD;
margin-top: 30px;
display: flex;
justify-content: center;
align-items: center;
}

.max_guest, .number_rooms, .number_bathrooms {
width: 100px;
text-align: center;
}

.max_guest > p, .number_rooms > p, .number_bathrooms > p{
margin-top: auto;
margin-bottom: auto;
}

.guest_image {
margin-left: auto;
margin-right: auto;
height: 50px;
width: 50px;
background: url("../images/icon_group.png") no-repeat center;
}

.bed_image {
margin-left: auto;
margin-right: auto;
height: 50px;
width: 50px;
background: url("../images/icon_bed.png") no-repeat center;
}

.bath_image {
margin-left: auto;
margin-right: auto;
height: 50px;
width: 50px;
background: url("../images/icon_bath.png") no-repeat center;
}

.user > p {
margin-top: 20px;
margin-bottom: 0px;
}
.description > p {
margin-top: 7px;
margin-bottom: 0px;
}

0 comments on commit d4b69d4

Please sign in to comment.