Bladeren bron

Styling sticky footer and header

joel
Simon Bowie 3 jaren geleden
bovenliggende
commit
d8a01e87d8
6 gewijzigde bestanden met toevoegingen van 42 en 16 verwijderingen
  1. +1
    -1
      README.md
  2. +5
    -0
      web/app/__init__.py
  3. +3
    -0
      web/app/static/styles/custom.css
  4. +31
    -14
      web/app/templates/base.html
  5. +1
    -1
      web/app/templates/index.html
  6. +1
    -0
      web/requirements.txt

+ 1
- 1
README.md Bestand weergeven

@@ -1,5 +1,5 @@
To build the database run:

`docker exec -it python python`
`from project import db, create_app, models`
`from app import db, create_app, models`
`db.create_all(app=create_app())`

+ 5
- 0
web/app/__init__.py Bestand weergeven

@@ -11,11 +11,14 @@
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager
from flask_moment import Moment
import os

# init SQLAlchemy so we can use it later in our models
db = SQLAlchemy()

moment = Moment()

def create_app():
app = Flask(__name__)

@@ -29,6 +32,8 @@ def create_app():
login_manager.login_view = 'auth.login'
login_manager.init_app(app)

moment.init_app(app)

from .models import User

@login_manager.user_loader

+ 3
- 0
web/app/static/styles/custom.css Bestand weergeven

@@ -0,0 +1,3 @@
main > .container {
padding: 60px 15px 0;
}

+ 31
- 14
web/app/templates/base.html Bestand weergeven

@@ -8,23 +8,29 @@
# @acknowledgements:
# https://www.digitalocean.com/community/tutorials/how-to-make-a-web-application-using-flask-in-python-3
# Bootstrap 5.1.3: https://getbootstrap.com/
# Flask-Moment: https://flask-moment.readthedocs.io/en/latest/
-->

<!DOCTYPE html>
<html>

<head>
{{ moment.include_moment() }}
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>COPIM online toolkit</title>
<!-- Bootstrap CSS -->
<!--<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">-->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link href="{{ url_for('static',filename='styles/custom.css') }}" rel="stylesheet">
</head>

<body>
<nav class="navbar navbar-expand-md navbar-light bg-light">
<body class="d-flex flex-column h-100">

<header>
<!-- Fixed navbar -->
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
<div class="container-fluid">
<a class="navbar-brand" href="{{ url_for('main.index')}}">COPIM online toolkit</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
@@ -76,20 +82,31 @@
{% endif %}
</ul>
</div>
</div>
</nav>
</header>

<div class="container">
{% with messages = get_flashed_messages() %}
{% if messages %}
<div class="alert alert-danger">
{{ messages[0] }}
</div>
{% endif %}
{% endwith %}
{% block content %}
{% endblock %}
</div>
<!-- Begin page content -->
<main class="flex-shrink-0">
<div class="container">
{% with messages = get_flashed_messages() %}
{% if messages %}
<div class="alert alert-danger">
{{ messages[0] }}
</div>
{% endif %}
{% endwith %}
{% block content %}
{% endblock %}
</div>
</main>


<footer class="footer mt-auto py-3 bg-light fixed-bottom">
<div class="container">
<span class="text-muted">© {{ moment().format('YYYY') }} COPIM and licensed under a Creative Commons Attribution 4.0 International License (CC BY 4.0).</span>
</div>
</footer>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>

+ 1
- 1
web/app/templates/index.html Bestand weergeven

@@ -1,7 +1,7 @@
{% extends "base.html" %}

{% block content %}
<h1 class="title">
<h1 class="mt-5">
COPIM online toolkit
</h1>
<h2 class="subtitle">

+ 1
- 0
web/requirements.txt Bestand weergeven

@@ -1,3 +1,4 @@
flask
flask-sqlalchemy
flask-login
flask-moment

Laden…
Annuleren
Opslaan