Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
Jennifer Huang <[email protected]>
Alexa Orrico <[email protected]>
Joann Vuong <[email protected]>
Ibrahim Hanafi <[email protected]>
Ruba Salih <>
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ EOF all create destroy help quit show update
No known bugs at this time.

## Authors
Ibrahim hanafi - [Github](https://github.com/hima890)

Ruba Salih - [Github](https://github.com/Ruba-Salih)

Alexa Orrico - [Github](https://github.com/alexaorrico) / [Twitter](https://twitter.com/alexa_orrico)
Jennifer Huang - [Github](https://github.com/jhuang10123) / [Twitter](https://twitter.com/earthtojhuang)
Jhoan Zamora - [Github](https://github.com/jzamora5) / [Twitter](https://twitter.com/JhoanZamora10)
Expand Down
Binary file added models/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file added models/__pycache__/amenity.cpython-38.pyc
Binary file not shown.
Binary file added models/__pycache__/base_model.cpython-38.pyc
Binary file not shown.
Binary file added models/__pycache__/city.cpython-38.pyc
Binary file not shown.
Binary file added models/__pycache__/place.cpython-38.pyc
Binary file not shown.
Binary file added models/__pycache__/review.cpython-38.pyc
Binary file not shown.
Binary file added models/__pycache__/state.cpython-38.pyc
Binary file not shown.
Binary file added models/__pycache__/user.cpython-38.pyc
Binary file not shown.
Binary file added models/engine/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file not shown.
49 changes: 49 additions & 0 deletions web_dynamic/0-hbnb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/python3
""" Starts a Flash Web Application """
from models import storage
from models.state import State
from models.city import City
from models.amenity import Amenity
from models.place import Place
from os import environ
from flask import Flask, render_template
import uuid

app = Flask(__name__)
# app.jinja_env.trim_blocks = True
# app.jinja_env.lstrip_blocks = True


@app.teardown_appcontext
def close_db(error):
""" Remove the current SQLAlchemy Session """
storage.close()


@app.route('/0-hbnb/', strict_slashes=False)
def hbnb():
""" HBNB is alive! """
states = storage.all(State).values()
states = sorted(states, key=lambda k: k.name)
st_ct = []

for state in states:
st_ct.append([state, sorted(state.cities, key=lambda k: k.name)])

amenities = storage.all(Amenity).values()
amenities = sorted(amenities, key=lambda k: k.name)

places = storage.all(Place).values()
places = sorted(places, key=lambda k: k.name)
cache_id = uuid.uuid4()

return render_template('0-hbnb.html',
states=st_ct,
amenities=amenities,
places=places,
cache_id=cache_id)


if __name__ == "__main__":
""" Main Function """
app.run(host='0.0.0.0', port=5000)
49 changes: 49 additions & 0 deletions web_dynamic/1-hbnb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/python3
""" Starts a Flash Web Application """
from models import storage
from models.state import State
from models.city import City
from models.amenity import Amenity
from models.place import Place
from os import environ
from flask import Flask, render_template
import uuid

app = Flask(__name__)
# app.jinja_env.trim_blocks = True
# app.jinja_env.lstrip_blocks = True


@app.teardown_appcontext
def close_db(error):
""" Remove the current SQLAlchemy Session """
storage.close()


@app.route('/1-hbnb/', strict_slashes=False)
def hbnb():
""" HBNB is alive! """
states = storage.all(State).values()
states = sorted(states, key=lambda k: k.name)
st_ct = []

for state in states:
st_ct.append([state, sorted(state.cities, key=lambda k: k.name)])

amenities = storage.all(Amenity).values()
amenities = sorted(amenities, key=lambda k: k.name)

places = storage.all(Place).values()
places = sorted(places, key=lambda k: k.name)
cache_id = uuid.uuid4()

return render_template('1-hbnb.html',
states=st_ct,
amenities=amenities,
places=places,
cache_id=cache_id)


if __name__ == "__main__":
""" Main Function """
app.run(host='0.0.0.0', port=5000)
49 changes: 49 additions & 0 deletions web_dynamic/100-hbnb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/python3
""" Starts a Flash Web Application """
from models import storage
from models.state import State
from models.city import City
from models.amenity import Amenity
from models.place import Place
from os import environ
from flask import Flask, render_template
import uuid

app = Flask(__name__)
# app.jinja_env.trim_blocks = True
# app.jinja_env.lstrip_blocks = True


@app.teardown_appcontext
def close_db(error):
""" Remove the current SQLAlchemy Session """
storage.close()


@app.route('/100-hbnb/', strict_slashes=False)
def hbnb():
""" HBNB is alive! """
states = storage.all(State).values()
states = sorted(states, key=lambda k: k.name)
st_ct = []

for state in states:
st_ct.append([state, sorted(state.cities, key=lambda k: k.name)])

amenities = storage.all(Amenity).values()
amenities = sorted(amenities, key=lambda k: k.name)

places = storage.all(Place).values()
places = sorted(places, key=lambda k: k.name)
cache_id = uuid.uuid4()

return render_template('100-hbnb.html',
states=st_ct,
amenities=amenities,
places=places,
cache_id=cache_id)


if __name__ == "__main__":
""" Main Function """
app.run(host='0.0.0.0', port=5000)
49 changes: 49 additions & 0 deletions web_dynamic/2-hbnb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/python3
""" Starts a Flash Web Application """
from models import storage
from models.state import State
from models.city import City
from models.amenity import Amenity
from models.place import Place
from os import environ
from flask import Flask, render_template
import uuid

app = Flask(__name__)
# app.jinja_env.trim_blocks = True
# app.jinja_env.lstrip_blocks = True


@app.teardown_appcontext
def close_db(error):
""" Remove the current SQLAlchemy Session """
storage.close()


@app.route('/2-hbnb/', strict_slashes=False)
def hbnb():
""" HBNB is alive! """
states = storage.all(State).values()
states = sorted(states, key=lambda k: k.name)
st_ct = []

for state in states:
st_ct.append([state, sorted(state.cities, key=lambda k: k.name)])

amenities = storage.all(Amenity).values()
amenities = sorted(amenities, key=lambda k: k.name)

places = storage.all(Place).values()
places = sorted(places, key=lambda k: k.name)
cache_id = uuid.uuid4()

return render_template('2-hbnb.html',
states=st_ct,
amenities=amenities,
places=places,
cache_id=cache_id)


if __name__ == "__main__":
""" Main Function """
app.run(host='0.0.0.0', port=5000)
49 changes: 49 additions & 0 deletions web_dynamic/3-hbnb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/python3
""" Starts a Flash Web Application """
from models import storage
from models.state import State
from models.city import City
from models.amenity import Amenity
from models.place import Place
from os import environ
from flask import Flask, render_template
import uuid

app = Flask(__name__)
# app.jinja_env.trim_blocks = True
# app.jinja_env.lstrip_blocks = True


@app.teardown_appcontext
def close_db(error):
""" Remove the current SQLAlchemy Session """
storage.close()


@app.route('/3-hbnb/', strict_slashes=False)
def hbnb():
""" HBNB is alive! """
states = storage.all(State).values()
states = sorted(states, key=lambda k: k.name)
st_ct = []

for state in states:
st_ct.append([state, sorted(state.cities, key=lambda k: k.name)])

amenities = storage.all(Amenity).values()
amenities = sorted(amenities, key=lambda k: k.name)

places = storage.all(Place).values()
places = sorted(places, key=lambda k: k.name)
cache_id = uuid.uuid4()

return render_template('3-hbnb.html',
states=st_ct,
amenities=amenities,
places=places,
cache_id=cache_id)


if __name__ == "__main__":
""" Main Function """
app.run(host='0.0.0.0', port=5000)
49 changes: 49 additions & 0 deletions web_dynamic/4-hbnb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/python3
""" Starts a Flash Web Application """
from models import storage
from models.state import State
from models.city import City
from models.amenity import Amenity
from models.place import Place
from os import environ
from flask import Flask, render_template
import uuid

app = Flask(__name__)
# app.jinja_env.trim_blocks = True
# app.jinja_env.lstrip_blocks = True


@app.teardown_appcontext
def close_db(error):
""" Remove the current SQLAlchemy Session """
storage.close()


@app.route('/4-hbnb/', strict_slashes=False)
def hbnb():
""" HBNB is alive! """
states = storage.all(State).values()
states = sorted(states, key=lambda k: k.name)
st_ct = []

for state in states:
st_ct.append([state, sorted(state.cities, key=lambda k: k.name)])

amenities = storage.all(Amenity).values()
amenities = sorted(amenities, key=lambda k: k.name)

places = storage.all(Place).values()
places = sorted(places, key=lambda k: k.name)
cache_id = uuid.uuid4()

return render_template('4-hbnb.html',
states=st_ct,
amenities=amenities,
places=places,
cache_id=cache_id)


if __name__ == "__main__":
""" Main Function """
app.run(host='0.0.0.0', port=5000)
Empty file added web_dynamic/__init__.py
Empty file.
Binary file added web_dynamic/__pycache__/0-hbnb.cpython-38.pyc
Binary file not shown.
Binary file added web_dynamic/__pycache__/100-hbnb.cpython-38.pyc
Binary file not shown.
Binary file added web_dynamic/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
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.
16 changes: 16 additions & 0 deletions web_dynamic/static/scripts/1-hbnb.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
$(document).ready(function () {
$('input[type=checkbox]').click(function () {
const myListName = [];
const myId = [];
$('input[type=checkbox]:checked').each(function () {
myListName.push($(this).attr('data-name'));
myId.push($(this).attr('data-id'));
});
if (myListName.length === 0) {
$('.amenities h4').html('&nbsp;');
} else {
$('.amenities h4').text(myListName.join(', '));
}
console.log(myId);
});
});
Loading