Skip to content
Snippets Groups Projects
Commit 7c98683d authored by Benjamin Bertrand's avatar Benjamin Bertrand
Browse files

Remove flask-bootstrap dependency

The official flask-bootstrap is still not compatible with bootstrap 4.
The application basically only uses the main template and one macro.
It's easier to include directly bootstrap in CSEntry.
It makes upgrading to the latest bootstrap much easier and removes a
dependency.

Update to bootstrap 4.1.3

Added:
- jquery-3.3.1.min.js
- bootstrap.bundle.min.js (include popper but not jquery)

Note that jquery.slim can't be used.
We need for example $.getJSON for datatables.
parent 0293261a
No related branches found
No related tags found
No related merge requests found
......@@ -14,7 +14,6 @@ from flask_login import LoginManager
from flask_ldap3_login import LDAP3LoginManager
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_bootstrap import Bootstrap
from flask_admin import Admin
from flask_mail import Mail
from flask_jwt_extended import JWTManager
......@@ -37,7 +36,6 @@ db = SQLAlchemy(metadata=metadata, session_options={"autoflush": False})
migrate = Migrate(db=db)
login_manager = LoginManager()
ldap_manager = LDAP3LoginManager()
bootstrap = Bootstrap()
admin = Admin(template_mode="bootstrap3")
mail = Mail()
jwt = JWTManager()
......
......@@ -19,7 +19,6 @@ from .extensions import (
migrate,
login_manager,
ldap_manager,
bootstrap,
admin,
mail,
jwt,
......@@ -121,7 +120,6 @@ def create_app(config=None):
settings_string = "\n".join(settings_to_display)
app.logger.info(f"Settings:\n{settings_string}")
bootstrap.init_app(app)
db.init_app(app)
migrate.init_app(app)
login_manager.init_app(app)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Source diff could not be displayed: it is too large. Options to address this: view the blob.
This diff is collapsed.
{% macro flashed_messages(messages=None, container=True, transform={
'critical': 'danger',
'error': 'danger',
'info': 'info',
'warning': 'warning',
'success': 'success',
'debug': 'info',
'notset': 'info',
'message': 'info',
}, default_category=None, dismissible=False) -%}
{% with messages = messages or get_flashed_messages(with_categories=True) -%}
{% if messages -%} {# don't output anything if there are no messages #}
{% if container -%}
<!-- begin message block -->
<div class="container flashed-messages">
<div class="row">
<div class="col-md-12">
{% endif -%}
{% for cat, msg in messages %} <div class="alert alert-{{transform.get(cat.lower(), default_category or cat)}}{% if dismissible %} alert-dismissible{% endif %}" role="alert">
{% if dismissible %} <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>{% endif %}
{{msg}}
</div>
{%- endfor -%}
{% if container %}
</div>
</div>
</div>
<!-- end message block -->
{% endif -%}
{% endif -%}
{% endwith -%}
{% endmacro -%}
{% macro is_active(active) -%}
{% if active %}active{% endif %}
{%- endmacro %}
......
{% extends "base.html" %}
{% from "_helpers.html" import is_active %}
{% from "_helpers.html" import is_active, flashed_messages %}
{# overwrite the base content block to use container-fluid instead of container #}
{% block content %}
......@@ -35,7 +35,7 @@
</div>
<div class="col-12 col-md-10 col-xl-10">
{{utils.flashed_messages(messages, container=False, dismissible=True)}}
{{flashed_messages(messages, container=False, dismissible=True)}}
{% block main %}{% endblock %}
</div>
......
{%- extends "bootstrap/base.html" %}
{% import "bootstrap/utils.html" as utils %}
{% from "_helpers.html" import is_active %}
{%- extends "bootstrap.html" %}
{% from "_helpers.html" import is_active, flashed_messages %}
{% block styles %}
{{super()}}
......@@ -56,7 +55,7 @@
{% block content %}
<div class="container">
{{utils.flashed_messages(messages, container=False, dismissible=True)}}
{{flashed_messages(messages, container=False, dismissible=True)}}
{% block main %}{% endblock %}
</div>
{% endblock %}
......
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="CSEntry">
<meta name="author" content="Benjamin Bertrand">
<title>{% block title %}{% endblock %}</title>
{%- block styles %}
<link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
{%- endblock styles %}
</head>
<body>
{% block body -%}
{% block navbar %}
{%- endblock navbar %}
{% block content -%}
{%- endblock content %}
{% block scripts %}
<script src="{{ url_for('static', filename='js/jquery.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/bootstrap.bundle.min.js') }}"></script>
{%- endblock scripts %}
{%- endblock body %}
</body>
</html>
{% import "bootstrap/wtf.html" as wtf %}
{% extends "base.html" %}
{% block title %}Login - CSEntry{% endblock %}
......
......@@ -98,7 +98,6 @@ dependencies:
- arrow==0.12.1
- dominate==2.3.1
- email-validator==1.0.2
- git+https://github.com/beenje/flask-bootstrap@4.0.0.0.dev1
- flask-caching==1.3.3
- flask-jwt-extended==3.4.0
- flask-ldap3-login==0.9.13
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment