From 66b78b581698ff937984826883ebc5c6c1a814d6 Mon Sep 17 00:00:00 2001 From: lawsonredeye Date: Sun, 5 May 2024 22:25:40 +0100 Subject: [PATCH 1/4] updated readme --- .gitignore | 3 +++ README.md | 2 ++ 2 files changed, 5 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000000..316ac1f1fb4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +v4/ +installer.sh + diff --git a/README.md b/README.md index ae0c24c98f4..9648b8ba35c 100644 --- a/README.md +++ b/README.md @@ -158,6 +158,8 @@ Alexa Orrico - [Github](https://github.com/alexaorrico) / [Twitter](https://twit Jennifer Huang - [Github](https://github.com/jhuang10123) / [Twitter](https://twitter.com/earthtojhuang) Jhoan Zamora - [Github](https://github.com/jzamora5) / [Twitter](https://twitter.com/JhoanZamora10) David Ovalle - [Github](https://github.com/Nukemenonai) / [Twitter](https://twitter.com/disartDave) +Lawson Omoregbee - [Github](https://github.com/Lawsonredeye) / [Twitter](https://twitter.com/LawsonRedeye) +Justin Ebedi - [Github](https://github.com/La-Programmer) Second part of Airbnb: Joann Vuong ## License From bbc27d0c91dcd56b3538500f10783569440467e9 Mon Sep 17 00:00:00 2001 From: lawsonredeye Date: Sun, 5 May 2024 23:19:23 +0100 Subject: [PATCH 2/4] implemented a script to handle automation of moving files and renaming the route to /0-hbnb/ --- set.sh | 9 ++ web_dynamic/0-hbnb.py | 46 ++++++++ web_dynamic/__init__.py | 0 web_dynamic/static/images/icon.png | Bin 0 -> 2962 bytes web_dynamic/static/images/icon_bath.png | Bin 0 -> 704 bytes web_dynamic/static/images/icon_bed.png | Bin 0 -> 447 bytes web_dynamic/static/images/icon_group.png | Bin 0 -> 1051 bytes web_dynamic/static/images/logo.png | Bin 0 -> 9876 bytes web_dynamic/static/styles/3-footer.css | 16 +++ web_dynamic/static/styles/3-header.css | 11 ++ web_dynamic/static/styles/4-common.css | 11 ++ web_dynamic/static/styles/6-filters.css | 103 +++++++++++++++++ web_dynamic/static/styles/8-places.css | 101 +++++++++++++++++ web_dynamic/static/styles/w3c_validator.py | 123 +++++++++++++++++++++ web_dynamic/templates/0-hbnb.html | 78 +++++++++++++ 15 files changed, 498 insertions(+) create mode 100644 set.sh create mode 100755 web_dynamic/0-hbnb.py create mode 100755 web_dynamic/__init__.py create mode 100644 web_dynamic/static/images/icon.png create mode 100644 web_dynamic/static/images/icon_bath.png create mode 100644 web_dynamic/static/images/icon_bed.png create mode 100644 web_dynamic/static/images/icon_group.png create mode 100644 web_dynamic/static/images/logo.png create mode 100644 web_dynamic/static/styles/3-footer.css create mode 100644 web_dynamic/static/styles/3-header.css create mode 100644 web_dynamic/static/styles/4-common.css create mode 100644 web_dynamic/static/styles/6-filters.css create mode 100644 web_dynamic/static/styles/8-places.css create mode 100755 web_dynamic/static/styles/w3c_validator.py create mode 100644 web_dynamic/templates/0-hbnb.html diff --git a/set.sh b/set.sh new file mode 100644 index 00000000000..7d10f676b68 --- /dev/null +++ b/set.sh @@ -0,0 +1,9 @@ +#!/usr/bin/bash +# - used for setting up flask web dynamics + +mkdir -p web_dynamic +cp -r web_flask/static web_flask/templates/100-hbnb.html web_flask/__init__.py web_flask/100-hbnb.py web_dynamic +mv web_dynamic/100-hbnb.py web_dynamic/0-hbnb.py +mv web_dynamic/100-hbnb.html web_dynamic/0-hbnb.html + +sed -i "s#/hbnb#/0-hbnb/#g" web_dynamic/0-hbnb.py \ No newline at end of file diff --git a/web_dynamic/0-hbnb.py b/web_dynamic/0-hbnb.py new file mode 100755 index 00000000000..77842e2e115 --- /dev/null +++ b/web_dynamic/0-hbnb.py @@ -0,0 +1,46 @@ +#!/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 +from uuid import uuid4 +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('100-hbnb.html', + states=st_ct, + amenities=amenities, + places=places, cache_id=uuid4) + + +if __name__ == "__main__": + """ Main Function """ + app.run(host='0.0.0.0', port=5000) diff --git a/web_dynamic/__init__.py b/web_dynamic/__init__.py new file mode 100755 index 00000000000..e69de29bb2d diff --git a/web_dynamic/static/images/icon.png b/web_dynamic/static/images/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..93492bb8df2ec8408a935db7d4352e70e297d48d GIT binary patch literal 2962 zcmaJ@dpy(YAOE^bDo5^=HRNtH%#4L>bIFih@PDUw@9?C7LK45=KA zNx776q!JD}P_xtmCKA-m=PllI=^A;OPQ zm+TwJ3dFf12{eise#6I%O`(g>0AOd&rsD}wBo-))6hWqBs89UCbkppaO25StQBWg^)q@E2aBXun~GfI(keSWzhO zKS>4Ryg*Jg1_@+kW?@Qznwx{*a5HmDD>&TT1O$Vc!yr)6gqxaMBCX&^m^J9@0E?nA zh~Y?YH1=yO(Fp~PWU=T-2qZQ()-2Y-jK+w7nA_OcY;eF}rXmkhW*n7;XPZ))I^P)3 zBqo7DrnAU2DrkcdA4ZE|p}?X{|G5H%{+*V}{8}ba!60lr9b#?<-MG>>M;z||yHY6M zy_qa;(tq;(pTtbxI64X9O=8kw7z9z{!gV%6(UDFJ5}rk4_|j<6->T>pNn_ENku*BU z$p;QHz~KpG>W0Da3j&8jx>A`eJe5FlMWetX4l^>Dh{QrMa4Ty#7GrI_*W4TfN0?(^ zHjWmSa3~aRgRrvthDFl|F%%M&^$kn>jjY53vwYGLVhd{#UENnMC^8*nStT=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00001 diff --git a/web_dynamic/static/images/icon_bed.png b/web_dynamic/static/images/icon_bed.png new file mode 100644 index 0000000000000000000000000000000000000000..2a63284877067dcb61b769fd59e8ee373587b0be GIT binary patch literal 447 zcmeAS@N?(olHy`uVBq!ia0vp^Mj*_=3?wxlRx|^t$pJngu0XnMkb%!ndUAozGAIf1 z3ua(sX64}I;^CE*Q#3F%wXpN{i-=9nD6gz;XziFdWA5TjTelxSb?*G-JNG_+|M~mx zviF&$K)tIyT^vI^j=#O^&UeT_#Pwo+)q9mM_a;x+{r{?=!!(C77B>!oQ*-yt>6GnW zvb0u7U+vo+51u1=EDhnF`&QiX_{);$Z#jXF;fza^;C9#FjyJu$eswQfV=yaSXUXd8 zOV{`w(o3GyDaWjxm?#vV?{2*?Yr?E~e^`u+I&Q^G-!Q>}@0sHBZ48dCLMLt(OVPgg&ebxsLQ E03-gv2mk;8 literal 0 HcmV?d00001 diff --git a/web_dynamic/static/images/icon_group.png b/web_dynamic/static/images/icon_group.png new file mode 100644 index 0000000000000000000000000000000000000000..3e012ab4d5cdc2146782461b475b2a81ce0fea4d GIT binary patch literal 1051 zcmeAS@N?(olHy`uVBq!ia0vp^Mj*_=3?wxlRx~p(FqQ=Pgt!8^Wut(;A)xa1&vRh7 zSC<6&1v4-*F|)9;v2$>8ar5x<@e2qF35$q|iAze!$jZqpD66S!Xld)}=^Gdt8Jn70 zTG`s!J370#x_Nqe`}q0=hQ-7sr)1|86ql4%RM$6jboNi2I(^3MxeFF8TeW)arY+ld z?%K2Oz~Q6EPnA zgW||zoJzi$)5NBGZPtle#HKS|ONG3(HoLZl9GLX^x%AAL)@KUZ+vTc0{VsSi z|7-5$4L5oF7urh2ac+5eFFjb7YkJ+RdkcL#rzu5sa_K66=m>b_)UA@+{lO#H>wv(! zKGwt?PPf%;9!;rgkiMT8v73YEVpvoAipxQ+*R6D08{BU5?0I*&$T((Mh|u|rRhb!| z=lE8x*>H4C#d+ti#sLx)(RZV*`io0Cl{SazpONRXdQn&qR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vldTi1s|{?;8;Ol-FMqm+h*hAgKal=o`o(t$#$nVFCHDTbVRPky*{aHz|G z%A4&hF5AiOT%l4DxsLrj9~yLG{u^9qWok?WRD4z{ZtgoZf@Cn{)%u_YP<{^@HUrT0 zUv4J9{`^D-QW$M>JLbk>#mNFpC2Z-_R|R0&jI>4EQV3ioF73au^zb!pJ zHCmR*2heE5FR`#Ygeiv{mkJ<4uO4(@8r+>1qT5usfH%(BvBMm(^zv7?87n3PHDU~O zbOWg7R>aS=`GK9-T^u{WH>yoK$_mS}O@H)W$%$a{X3BnhxCN_jX^{eI7eLl4;*aJe zxKe?GGl#S&b+^@g)`t&OjBrLPFh*2G9ZteiaZ@f(gCS1YgaCqU@0)qFtN_F5)_|xr z{WB}|J>c0ke0+OL&<@aHvn7U*_w4HJ$4fN;1^|a9@@e^3ZS3Fg#AGBDC8|Ce1^*w{ C(Z%)v literal 0 HcmV?d00001 diff --git a/web_dynamic/static/styles/3-footer.css b/web_dynamic/static/styles/3-footer.css new file mode 100644 index 00000000000..2cd4ff05d90 --- /dev/null +++ b/web_dynamic/static/styles/3-footer.css @@ -0,0 +1,16 @@ +footer { + position: fixed; + background: white; + height: 60px; + width: 100%; + bottom: 0; + border-top: 1px solid #CCCCCC; +} +footer p { + position: absolute; + text-align: center; + top: 10%; + bottom: 0; + right: 0; + left: 0; +} diff --git a/web_dynamic/static/styles/3-header.css b/web_dynamic/static/styles/3-header.css new file mode 100644 index 00000000000..245cac7c980 --- /dev/null +++ b/web_dynamic/static/styles/3-header.css @@ -0,0 +1,11 @@ +header { + background: white; + height: 70px; + width: 100%; + border-bottom: 1px solid #CCCCCC; +} +header .logo { + background: url("../images/logo.png") no-repeat; + left: 20px; + height: 100%; +} diff --git a/web_dynamic/static/styles/4-common.css b/web_dynamic/static/styles/4-common.css new file mode 100644 index 00000000000..46cfc19d1c1 --- /dev/null +++ b/web_dynamic/static/styles/4-common.css @@ -0,0 +1,11 @@ +body { + margin: 0; + padding: 0; + color: #484848; + font-size: 14px; + font-family: Circular,"Helvetica Neue",Helvetica,Arial,sans-serif; +} +body .container { + max-width: 1000px; + margin: 30px auto; +} diff --git a/web_dynamic/static/styles/6-filters.css b/web_dynamic/static/styles/6-filters.css new file mode 100644 index 00000000000..d47107732aa --- /dev/null +++ b/web_dynamic/static/styles/6-filters.css @@ -0,0 +1,103 @@ +.container .filters { + position: relative; + background: white; + height: 70px; + width: 100%; + border: 1px solid #DDDDDD; + border-radius: 4px; +} +button { + position: absolute; + font-size: 18px; + background: #FF5A5F; + color: #FFFFFF; + height: 48px; + width: 20%; + border-style: none; + border-radius: 4px; + top: 15%; + right: 30px; +} +button:hover { + opacity: 0.9; +} +.filters div { + display: inline-grid; +} +.filters h2 { + margin-left: 15%; + margin-top: 0; + margin-bottom: 0; + font-weight: 600; +} +.filters h3 { + margin-left: 15%; + margin-bottom: 0; + font-weight: 600; +} +.filters h4 { + margin-left: 15%; + margin-top: 0; + font-weight: 400; + font-size: 14px; +} +.locations { + height: 100%; + width: 25%; + border-right: 1px solid #DDDDDD; +} +.amenities { + height: 100%; + width: 25%; +} + +.popover { + visibility: hidden; + width: 100%; + border: 1px solid #DDDDDD; + border-radius: 4px; + background: #FAFAFA; + padding-bottom: 15px; + height: 300px; + overflow-y: scroll; + scrollbar-width: none; + max-height: 300px; +} + +.popover::-webkit-scrollbar{ + width: 0px; +} + +.amenities .popover { + padding: 10px 0; + margin-left: -5px; + margin-top: 0%; +} + +.amenities .popover ul{ + margin: 0px; +} + +.locations .popover { + margin-top: 0%; +} +.popover ul { + list-style-type: none; + padding-bottom: 10px; + padding-left: 10px; +} +.popover ul li{ + padding: 4px; + padding-left: 10px; +} + +.popover ul h2{ + margin-top: 1.5%; + margin-bottom: 5%; + margin-left: 0px; +} + +.amenities:hover .popover, +.locations:hover .popover { + visibility: visible; +} diff --git a/web_dynamic/static/styles/8-places.css b/web_dynamic/static/styles/8-places.css new file mode 100644 index 00000000000..9dac66c0d7f --- /dev/null +++ b/web_dynamic/static/styles/8-places.css @@ -0,0 +1,101 @@ +.places { + column-count: 2; + columns: 30em; + justify-content: center; + padding: 0 20px; + margin-top: 1%; + margin-bottom: 8%; +} +@media only screen and (max-width: 920px) +{ + .places { + display: flex; + flex-wrap: wrap; + } +} + +.placesh1 h1 { + width: 100%; + margin-right: 400px; + text-align: left; + font-size: 35px; +} + +.places article { + -webkit-column-break-inside: avoid; + page-break-inside: avoid; + display: inline-block; + width: 390px; + height: 100%; + padding: 20px; + margin: 20px; + border: 1px solid #FF5A5F; + border-radius: 4px; +} +.places h2 { + font-size: 30px; + text-align: center; + margin-top: 0; +} +.title_box { + display: flex; + justify-content: space-between; + margin-top: -2%; +} + +.title_box h2 { + text-align: left; + margin: 25px 3% 40px 2%; + max-width: 75%; + word-wrap: break-word; +} +.price_by_night { + display: flex; + height: 60px; + min-width: 60px; + font-size: 30px; + justify-content: center; + align-items: center; + color: #FF5A5F; + border: 4px solid #FF5A5F; + border-radius: 50%; + align-items: center; + padding: 2.3%; +} + +.information { + display: flex; + justify-content: center; + align-items: center; + height: 80px; + border-top: 1px solid #DDDDDD; + border-bottom: 1px solid #DDDDDD; + margin-bottom: 5%; +} + +.information div { + display: flex; + justify-content: flex-end; + align-items: center; + flex-direction: column; + height: 65px; +} + +.information .max_guest { + background: url("../images/icon_group.png") no-repeat top center; + width: 100px; +} + +.information .number_rooms { + background: url("../images/icon_bed.png") no-repeat top center; + width: 100px; +} + +.information .number_bathrooms { + background: url("../images/icon_bath.png") no-repeat top center; + width: 100px; +} + +.user { + margin-bottom: 1.5%; +} diff --git a/web_dynamic/static/styles/w3c_validator.py b/web_dynamic/static/styles/w3c_validator.py new file mode 100755 index 00000000000..ee9593fce40 --- /dev/null +++ b/web_dynamic/static/styles/w3c_validator.py @@ -0,0 +1,123 @@ +#!/usr/bin/python3 +""" +W3C validator for Holberton School + +For HTML and CSS files. + +Based on 2 APIs: + +- https://validator.w3.org/nu/ +- http://jigsaw.w3.org/css-validator/validator + + +Usage: + +Simple file: + +``` +./w3c_validator.py index.html +``` + +Multiple files: + +``` +./w3c_validator.py index.html header.html styles/common.css +``` + +All errors are printed in `STDERR` + +Return: +Exit status is the # of errors, 0 on Success + +References + +https://developer.mozilla.org/en-US/ + +""" +import sys +import requests + + +def __print_stdout(msg): + """Print message in STDOUT + """ + sys.stdout.write(msg) + + +def __print_stderr(msg): + """Print message in STDERR + """ + sys.stderr.write(msg) + + +def __analyse_html(file_path): + """Start analyse of HTML file + """ + h = {'Content-Type': "text/html; charset=utf-8"} + d = open(file_path, "rb").read() + u = "https://validator.w3.org/nu/?out=json" + r = requests.post(u, headers=h, data=d) + res = [] + messages = r.json().get('messages', []) + for m in messages: + res.append("[{}:{}] {}".format(file_path, m['lastLine'], m['message'])) + return res + + +def __analyse_css(file_path): + """Start analyse of CSS file + """ + d = {'output': "json"} + f = {'file': (file_path, open(file_path, 'rb'), 'text/css')} + u = "http://jigsaw.w3.org/css-validator/validator" + r = requests.post(u, data=d, files=f) + res = [] + errors = r.json().get('cssvalidation', {}).get('errors', []) + for e in errors: + res.append("[{}:{}] {}".format(file_path, e['line'], e['message'])) + return res + + +def __analyse(file_path): + """Start analyse of a file and print the result + """ + nb_errors = 0 + try: + result = None + if file_path.endswith('.css'): + result = __analyse_css(file_path) + else: + result = __analyse_html(file_path) + + if len(result) > 0: + for msg in result: + __print_stderr("{}\n".format(msg)) + nb_errors += 1 + else: + __print_stdout("{}: OK\n".format(file_path)) + + except Exception as e: + __print_stderr("[{}] {}\n".format(e.__class__.__name__, e)) + return nb_errors + + +def __files_loop(): + """Loop that analyses for each file from input arguments + """ + nb_errors = 0 + for file_path in sys.argv[1:]: + nb_errors += __analyse(file_path) + + return nb_errors + + +if __name__ == "__main__": + """Main + """ + if len(sys.argv) < 2: + __print_stderr("usage: w3c_validator.py file1 file2 ...\n") + exit(1) + + """execute tests, then exit. Exit status = # of errors (0 on success) + """ + sys.exit(__files_loop()) diff --git a/web_dynamic/templates/0-hbnb.html b/web_dynamic/templates/0-hbnb.html new file mode 100644 index 00000000000..afa4622833f --- /dev/null +++ b/web_dynamic/templates/0-hbnb.html @@ -0,0 +1,78 @@ + + + + + + + + + + + HBnB + + +
+ +
+
+
+
+

States

+

 

+
+
    + {% for state in states %} +
  • +

    {{ state[0].name }}:

    +
      + {% for city in state[1] %} +
    • {{ city.name }}
    • + {% endfor %} +
    +
  • + {% endfor %} +
+
+
+
+

Amenities

+

 

+
+
    + {% for amenity in amenities %} +
  • {{ amenity.name }}
  • + {% endfor %} +
+
+
+ +
+

Places

+
+ + {% for place in places %} +
+
+

{{ place.name }}

+
${{ place.price_by_night }}
+
+
+
{{ place.max_guest }} Guest{% if place.max_guest != 1 %}s{% endif %}
+
{{ place.number_rooms }} Bedroom{% if place.number_rooms != 1 %}s{% endif %}
+
{{ place.number_bathrooms }} Bathroom{% if place.number_bathrooms != 1 %}s{% endif %}
+
+
+ Owner: {{ place.user.first_name }} {{ place.user.last_name }} +
+
+ {{ place.description | safe }} +
+
+ {% endfor %} +
+
+
+

Holberton School

+
+ + From d34fcd6f034c6a33e95198d457026678ee8f1a01 Mon Sep 17 00:00:00 2001 From: La-Programmer Date: Tue, 7 May 2024 08:54:43 +0100 Subject: [PATCH 3/4] Add feature to select amenities and update amenity list --- web_dynamic/1-hbnb.py | 46 ++++++++++++++++ web_dynamic/static/scripts/1-hbnb.js | 29 ++++++++++ web_dynamic/templates/1-hbnb.html | 80 ++++++++++++++++++++++++++++ 3 files changed, 155 insertions(+) create mode 100755 web_dynamic/1-hbnb.py create mode 100644 web_dynamic/static/scripts/1-hbnb.js create mode 100644 web_dynamic/templates/1-hbnb.html diff --git a/web_dynamic/1-hbnb.py b/web_dynamic/1-hbnb.py new file mode 100755 index 00000000000..6dd7bd437fe --- /dev/null +++ b/web_dynamic/1-hbnb.py @@ -0,0 +1,46 @@ +#!/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 +from uuid import uuid4 +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) + + return render_template('1-hbnb.html', + states=st_ct, + amenities=amenities, + places=places, cache_id=uuid4()) + + +if __name__ == "__main__": + """ Main Function """ + app.run(debug=True, host='0.0.0.0', port=5000) diff --git a/web_dynamic/static/scripts/1-hbnb.js b/web_dynamic/static/scripts/1-hbnb.js new file mode 100644 index 00000000000..4e3c55974aa --- /dev/null +++ b/web_dynamic/static/scripts/1-hbnb.js @@ -0,0 +1,29 @@ +$(document).ready(function () { + const listElement = $('.amenities div.popover ul li input'); + let amenityList = []; + let amenityListName = []; + listElement.click(function() { + if ($(this).is(':checked')) { + console.log(amenityList); // DEBUG PRINT + amenityList.push($(this).attr("data-id")); + amenityListName.push($(this).attr("data-name")) + console.log(amenityListName); // DEBUG PRINT + updateH4(amenityListName); + } else { + console.log(amenityList); // DEBUG PRINT + const elementAttr = listElement.attr("data-id"); + const elementIndex = amenityList.indexOf(elementAttr); + console.log(elementIndex); // DEBUG PRINT + amenityList.splice(elementIndex, 1); + console.log(amenityList); // DEBUG PRINT + updateH4(amenityList); + } + }); + + function updateH4(list) { + const headerElement = $(".amenities h4"); + amenityListString = list.join(", "); + console.log(amenityListString); + headerElement.text(amenityListString); + }; +}); \ No newline at end of file diff --git a/web_dynamic/templates/1-hbnb.html b/web_dynamic/templates/1-hbnb.html new file mode 100644 index 00000000000..83be770838e --- /dev/null +++ b/web_dynamic/templates/1-hbnb.html @@ -0,0 +1,80 @@ + + + + + + + + + + + + + HBnB + + +
+ +
+
+
+
+

States

+

 

+
+
    + {% for state in states %} +
  • +

    {{ state[0].name }}:

    +
      + {% for city in state[1] %} +
    • {{ city.name }}
    • + {% endfor %} +
    +
  • + {% endfor %} +
+
+
+
+

Amenities

+

 

+
+
    + {% for amenity in amenities %} +
  • {{ amenity.name }}
  • + {% endfor %} +
+
+
+ +
+

Places

+
+ + {% for place in places %} +
+
+

{{ place.name }}

+
${{ place.price_by_night }}
+
+
+
{{ place.max_guest }} Guest{% if place.max_guest != 1 %}s{% endif %}
+
{{ place.number_rooms }} Bedroom{% if place.number_rooms != 1 %}s{% endif %}
+
{{ place.number_bathrooms }} Bathroom{% if place.number_bathrooms != 1 %}s{% endif %}
+
+
+ Owner: {{ place.user.first_name }} {{ place.user.last_name }} +
+
+ {{ place.description | safe }} +
+
+ {% endfor %} +
+
+
+

Holberton School

+
+ + From dffafe4d4739037d1f2173967955805e0ab88194 Mon Sep 17 00:00:00 2001 From: La-Programmer Date: Wed, 15 May 2024 12:26:39 +0100 Subject: [PATCH 4/4] Push all updates --- web_dynamic/0-hbnb.py | 4 +- web_dynamic/2-hbnb.py | 46 ++++++++++ web_dynamic/__pycache__/0-hbnb.cpython-38.pyc | Bin 0 -> 1658 bytes web_dynamic/__pycache__/1-hbnb.cpython-38.pyc | Bin 0 -> 1668 bytes web_dynamic/__pycache__/2-hbnb.cpython-38.pyc | Bin 0 -> 1668 bytes .../__pycache__/__init__.cpython-38.pyc | Bin 0 -> 143 bytes web_dynamic/static/scripts/1-hbnb.js | 2 +- web_dynamic/static/scripts/2-hbnb.js | 41 +++++++++ web_dynamic/static/styles/3-header.css | 16 ++++ web_dynamic/static/styles/6-filters.css | 13 ++- web_dynamic/templates/2-hbnb.html | 81 ++++++++++++++++++ 11 files changed, 199 insertions(+), 4 deletions(-) create mode 100755 web_dynamic/2-hbnb.py create mode 100644 web_dynamic/__pycache__/0-hbnb.cpython-38.pyc create mode 100644 web_dynamic/__pycache__/1-hbnb.cpython-38.pyc create mode 100644 web_dynamic/__pycache__/2-hbnb.cpython-38.pyc create mode 100644 web_dynamic/__pycache__/__init__.cpython-38.pyc create mode 100644 web_dynamic/static/scripts/2-hbnb.js create mode 100644 web_dynamic/templates/2-hbnb.html diff --git a/web_dynamic/0-hbnb.py b/web_dynamic/0-hbnb.py index 77842e2e115..cc169aef498 100755 --- a/web_dynamic/0-hbnb.py +++ b/web_dynamic/0-hbnb.py @@ -35,10 +35,10 @@ def hbnb(): places = storage.all(Place).values() places = sorted(places, key=lambda k: k.name) - return render_template('100-hbnb.html', + return render_template('0-hbnb.html', states=st_ct, amenities=amenities, - places=places, cache_id=uuid4) + places=places, cache_id=uuid4()) if __name__ == "__main__": diff --git a/web_dynamic/2-hbnb.py b/web_dynamic/2-hbnb.py new file mode 100755 index 00000000000..6bb3ccc43b6 --- /dev/null +++ b/web_dynamic/2-hbnb.py @@ -0,0 +1,46 @@ +#!/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 +from uuid import uuid4 +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) + + return render_template('2-hbnb.html', + states=st_ct, + amenities=amenities, + places=places, cache_id=uuid4()) + + +if __name__ == "__main__": + """ Main Function """ + app.run(debug=True, host='0.0.0.0', port=5000) diff --git a/web_dynamic/__pycache__/0-hbnb.cpython-38.pyc b/web_dynamic/__pycache__/0-hbnb.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..50e88301e8aa0a04d4b864c6e507494f6f61555b GIT binary patch literal 1658 zcmb_cF>f0;6efAR(@B0OTldRNu}O*Qsjb&kY^&|ld$J?f-Vl&>K-!gExh{K`Om4`& zUwuz)$;~rneg^G*xh1#dy-SR2=a>w3=SgzxGUIHLB`_h<@!WM@Ne_ps5>JCa(E!pr(o#m)&sp`Bibv0m3h@Q`y4WlZlOzKoQ z(Mt#6bXv%#ImI(p19=AXIZWFH;>Z=fCYU}1%;p~^U#qe{SBV>|B%c~^>XPHHzBthN zSe3KnSXqm49}Sp6KTVkH+WN4SF}1lNW*wIQ{CGI7OEo;5T31xVgTfqEhbfp=Dm{NX ze5FRIoK;y_(k8zO^Cc0o?a1znKO$al#FThOa;!N7u@Mv_am zv^jyjlzji#`)RHG1Yi}&@Yd!c@Y;B#<)GyG=b5(qd$$JAM8TPw{hvb(7Q}2K*+zmD{^v}y1L8wm+6D5C{5^Wd{yw<% zH(y&d+}M?Rz?;b8ZL>`q5QR%t02{&m$(0pxof?q zX)27!ze#hPtteMaA?M@Gy&$?l?H7(o_zQo7L z;GOhP2##-(2LuDgK88R7fKO~Yl^I#Ts#1{hx^n6V=dZsAO+5vy5^&N4W?J3B%D3XG e^C7mWR{QvHc+fcQ-ue2#$04VkuuD5TG5Z_2UTwwz literal 0 HcmV?d00001 diff --git a/web_dynamic/__pycache__/1-hbnb.cpython-38.pyc b/web_dynamic/__pycache__/1-hbnb.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d11dcd4625c20adb773fe52ae52c075672ab9636 GIT binary patch literal 1668 zcmb_cy>Hw$6elH0r#s)5?bt~=1PV~3xS_r_$j~7$YNrS~6h>ROC_tbPbRy%EO-UD$ z=kyMDQ!;e%-q9Wnbm-rswNvK~1qu}Cd%SaMv`dFj;M042kB{&D-Xp*5bXo*P_{S$N zdI2H7qHue_8u=8a`2~m|oCqpBMGKF66nS6y1>?-|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&eYo=KES0NAn(ZE!*}fO z{TqLa_PXIFwopS>hX!w(shfZ(T(TV45bjSV4Ue)Enm)fO-x6IuLR^JLYUs8Ozxe zVm=(+uNz4ssw_!(SX4qPt53}X%^%5jE*9=#B>y;H~bC>Vioen;ieeG37 zH*iDn0v{=jchf<_8NN*p7z`Zy83OSEM!scbszvpxOhC%2(#r3xdj@!*s~KPxgOl3V mv+@>Zt|iwu0AiadxrYyk1CPg`k0!Jr{G!Xq5L?8o3AjbiSi&=m~3PUi1CZpd2KczG$ M)edCZXCP((0Jf1I>;M1& literal 0 HcmV?d00001 diff --git a/web_dynamic/static/scripts/1-hbnb.js b/web_dynamic/static/scripts/1-hbnb.js index 4e3c55974aa..9496b44ed20 100644 --- a/web_dynamic/static/scripts/1-hbnb.js +++ b/web_dynamic/static/scripts/1-hbnb.js @@ -26,4 +26,4 @@ $(document).ready(function () { console.log(amenityListString); headerElement.text(amenityListString); }; -}); \ No newline at end of file +}); diff --git a/web_dynamic/static/scripts/2-hbnb.js b/web_dynamic/static/scripts/2-hbnb.js new file mode 100644 index 00000000000..f3567d05b7d --- /dev/null +++ b/web_dynamic/static/scripts/2-hbnb.js @@ -0,0 +1,41 @@ +$(document).ready(function () { + const listElement = $('.amenities div.popover ul li input'); + let amenityList = []; + let amenityListName = []; + listElement.click(function() { + if ($(this).is(':checked')) { + console.log(amenityList); // DEBUG PRINT + amenityList.push($(this).attr("data-id")); + amenityListName.push($(this).attr("data-name")) + console.log(amenityListName); // DEBUG PRINT + updateH4(amenityListName); + } else { + console.log(amenityList); // DEBUG PRINT + const elementAttr = listElement.attr("data-id"); + const elementIndex = amenityList.indexOf(elementAttr); + console.log(elementIndex); // DEBUG PRINT + amenityList.splice(elementIndex, 1); + console.log(amenityList); // DEBUG PRINT + updateH4(amenityList); + } + }); + + function updateH4(list) { + const headerElement = $(".amenities h4"); + amenityListString = list.join(", "); + console.log(amenityListString); + headerElement.text(amenityListString); + }; + + $.ajax({ + url: 'http://0.0.0.0:5001/api/v1/status/', + success: function (data) { + indicator = $('#api_status'); + if (data.status == "OK") { + indicator.addClass("available"); + } else { + indicator.removeClass("available"); + } + } + }); + }); diff --git a/web_dynamic/static/styles/3-header.css b/web_dynamic/static/styles/3-header.css index 245cac7c980..4667a2c3cfd 100644 --- a/web_dynamic/static/styles/3-header.css +++ b/web_dynamic/static/styles/3-header.css @@ -2,10 +2,26 @@ header { background: white; height: 70px; width: 100%; + display: grid; + grid-template-columns: 95% 5%; border-bottom: 1px solid #CCCCCC; } + header .logo { background: url("../images/logo.png") no-repeat; left: 20px; height: 100%; } + +header #api_status { + border-radius: 100%; + height: 40px; + margin-top: 22%; + width: 40px; + margin-right: 30px; + background-color: #CCCCCC; +} + +.available { + background-color: #ff545f; +} diff --git a/web_dynamic/static/styles/6-filters.css b/web_dynamic/static/styles/6-filters.css index d47107732aa..0383e702dfe 100644 --- a/web_dynamic/static/styles/6-filters.css +++ b/web_dynamic/static/styles/6-filters.css @@ -70,14 +70,25 @@ button:hover { .amenities .popover { padding: 10px 0; + width: 300px; + position: absolute; margin-left: -5px; - margin-top: 0%; + margin-top: 70px; } .amenities .popover ul{ margin: 0px; } +.amenities h4 { + margin-top: 5px; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + height: fit-content; + width: 150%; +} + .locations .popover { margin-top: 0%; } diff --git a/web_dynamic/templates/2-hbnb.html b/web_dynamic/templates/2-hbnb.html new file mode 100644 index 00000000000..fa00ffbacb6 --- /dev/null +++ b/web_dynamic/templates/2-hbnb.html @@ -0,0 +1,81 @@ + + + + + + + + + + + + + HBnB + + +
+ +
+
+
+
+
+

States

+

 

+
+
    + {% for state in states %} +
  • +

    {{ state[0].name }}:

    +
      + {% for city in state[1] %} +
    • {{ city.name }}
    • + {% endfor %} +
    +
  • + {% endfor %} +
+
+
+
+

Amenities

+

 

+
+
    + {% for amenity in amenities %} +
  • {{ amenity.name }}
  • + {% endfor %} +
+
+
+ +
+

Places

+
+ + {% for place in places %} +
+
+

{{ place.name }}

+
${{ place.price_by_night }}
+
+
+
{{ place.max_guest }} Guest{% if place.max_guest != 1 %}s{% endif %}
+
{{ place.number_rooms }} Bedroom{% if place.number_rooms != 1 %}s{% endif %}
+
{{ place.number_bathrooms }} Bathroom{% if place.number_bathrooms != 1 %}s{% endif %}
+
+
+ Owner: {{ place.user.first_name }} {{ place.user.last_name }} +
+
+ {{ place.description | safe }} +
+
+ {% endfor %} +
+
+ + +