feat(us): adds contact and about sections
This commit is contained in:
@@ -33,5 +33,6 @@ def create_app(config_class=Config):
|
||||
app.register_blueprint(users_bp, url_prefix="/users")
|
||||
from app.pets import bp as pets_bp
|
||||
app.register_blueprint(pets_bp, url_prefix="/pets")
|
||||
|
||||
from app.us import bp as us_bp
|
||||
app.register_blueprint(us_bp, url_prefix="/us")
|
||||
return app
|
||||
6
app/static/css/about-us.css
Normal file
6
app/static/css/about-us.css
Normal file
@@ -0,0 +1,6 @@
|
||||
.about-us {
|
||||
background-image: url('/static/img/animals-bg.jpg');
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
3
app/static/css/contact-us.css
Normal file
3
app/static/css/contact-us.css
Normal file
@@ -0,0 +1,3 @@
|
||||
.contact-us {
|
||||
max-width: var(--main-content-max-width, 480px);
|
||||
}
|
||||
BIN
app/static/img/animals-bg.jpg
Normal file
BIN
app/static/img/animals-bg.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 322 KiB |
@@ -50,7 +50,8 @@
|
||||
</div>
|
||||
<footer class="footer">
|
||||
{% block footer %}
|
||||
© Copyright 2010 by <a href="http://domain.invalid/">you</a>.
|
||||
<p class="m-0">Some images by <a href="https://www.freepik.com/">freepik</a>.</p>
|
||||
<p class="m-0">This is <a href="https://github.com/gabdlr/a-dog-a-pet">my</a> CS50's final project.</p>
|
||||
{% endblock %}
|
||||
<form action="https://validator.w3.org/check" class="text-center" enctype="multipart/form-data" method="post" target="_blank">
|
||||
<input name="doctype" type="hidden" value="HTML5">
|
||||
|
||||
25
app/templates/us/about.html
Normal file
25
app/templates/us/about.html
Normal file
@@ -0,0 +1,25 @@
|
||||
{% extends "layout/layout.html" %}
|
||||
{% from "layout/inner_header.html" import inner_header%}
|
||||
{% block title %} about us {% endblock %}
|
||||
{% block head %}
|
||||
{{ super() }}
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/about-us.css') }}">
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<div class="container-fluid about-us h-100">
|
||||
<div class="row justify-content-center">
|
||||
<div class="row justify-content-center mt-5">
|
||||
<div class="col-12 col-sm-6 mt-5 mt-sm-0">
|
||||
<h1 class="text-white fs-1">About us</h1>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-12 col-sm-6">
|
||||
<p>This is my CS50's project, dedicated to my cat that I love so much.</p>
|
||||
<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Natus sit hic sapiente error at reprehenderit. Iste dolorum nesciunt obcaecati quo! Corporis iste minus, magnam impedit rem excepturi temporibus laboriosam placeat.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
43
app/templates/us/contact.html
Normal file
43
app/templates/us/contact.html
Normal file
@@ -0,0 +1,43 @@
|
||||
{% extends "layout/layout.html" %}
|
||||
{% from "forms/submit-btn.html" import form_submit_button %}
|
||||
{% from "layout/inner_header.html" import inner_header%}
|
||||
{% block title %} contact us {% endblock %}
|
||||
{% block head %}
|
||||
{{ super() }}
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/contact-us.css') }}">
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<div class="contact-us mx-auto">
|
||||
<div class="my-3">
|
||||
{{ inner_header("Contact us") }}
|
||||
</div>
|
||||
<div class="row px-2">
|
||||
{% include 'message.html' %}
|
||||
</div>
|
||||
<form class="row g-3 needs-validation" method="post">
|
||||
<div class="col-12">
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="email" >Email address</label>
|
||||
<input
|
||||
type="email"
|
||||
class="form-control"
|
||||
{% if user != none %} disabled {% endif %}
|
||||
id="email"
|
||||
placeholder="name@example.com"
|
||||
{% if user != none %} value="{{user.email}}" {% endif %}
|
||||
>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="message" class="form-label">Your message</label>
|
||||
<textarea class="form-control" id="message" rows="3" required></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 text-center">
|
||||
{{ form_submit_button("Submit") }}
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
4
app/us/__init__.py
Normal file
4
app/us/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
from flask import Blueprint
|
||||
|
||||
bp = Blueprint('us', __name__)
|
||||
from app.us import routes
|
||||
23
app/us/routes.py
Normal file
23
app/us/routes.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from flask import flash, render_template, request, session
|
||||
from app.us import bp
|
||||
from app.extensions import db
|
||||
from app.models.user import User
|
||||
from app.utils.alert_type import AlertType
|
||||
from app.utils.flash_message import FlashMessage
|
||||
|
||||
@bp.route('contact', methods=['GET', 'POST'])
|
||||
def contact():
|
||||
user = None
|
||||
user_id = session.get('id')
|
||||
if request.method == 'POST':
|
||||
flash(FlashMessage("Message sent! (not really :$)", AlertType.SUCCESS.value))
|
||||
|
||||
if user_id is not None:
|
||||
user = db.session.execute(db.select(User).filter_by(id=user_id)).one_or_none()
|
||||
if user is not None:
|
||||
user = user[0]
|
||||
return render_template("us/contact.html",user=user)
|
||||
|
||||
@bp.route('about')
|
||||
def about():
|
||||
return render_template("us/about.html")
|
||||
Reference in New Issue
Block a user