Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull request for V4 #261

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
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]>
Sophie Ododa <[email protected]>
Simon Mwangi <[email protected]>
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,6 @@ David Ovalle - [Github](https://github.com/Nukemenonai) / [Twitter](https://twit
Second part of Airbnb: Joann Vuong
## License
Public Domain. No copy write protection.

## Forked project
Simon And Sophie
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.
48 changes: 48 additions & 0 deletions web_dynamic/0-hbnb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/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)

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


if __name__ == "__main__":
""" Main Function """
app.run(host='0.0.0.0', port=5000)
45 changes: 45 additions & 0 deletions web_dynamic/1-hbnb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/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.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)

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


if __name__ == "__main__":
""" Main Function """
app.run(host='0.0.0.0', port=5000)
45 changes: 45 additions & 0 deletions web_dynamic/100-hbnb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/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.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)

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


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


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


@app.route('/101-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)
cache_id = str(uuid.uuid4())
places = storage.all(Place).values()
places = sorted(places, key=lambda k: k.name)

return render_template('101-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)i
45 changes: 45 additions & 0 deletions web_dynamic/2-hbnb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/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.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)

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


if __name__ == "__main__":
""" Main Function """
app.run(host='0.0.0.0', port=5000)
45 changes: 45 additions & 0 deletions web_dynamic/3-hbnb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/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.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)

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


if __name__ == "__main__":
""" Main Function """
app.run(host='0.0.0.0', port=5000)
48 changes: 48 additions & 0 deletions web_dynamic/4-hbnb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/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)

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


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__/__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.
17 changes: 17 additions & 0 deletions web_dynamic/static/scripts/1-hbnb.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/node
// Write a JavaScript script (static/scripts/1-hbnb.js):

document.addEvetListener('DOMContentLoaded', (event) => {
const amenityIDlist = [];
const amenityDict = {};
$('input:checkbox').click(function () {
if $(this).is(':checked')) {
amenityDict[$(this).attr('data-id')] = $(this).attr('data-name');
amenityIDlist = Object.keys(amenityDict);
const vals = Object.values(amenityDict);
$('DIV.amenities h4').append(vals);
} else {
delete amenityDict[$(this). attr('data-id')];
}
})
});
Loading