-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Bootstrap 5 Rendering * Fix active dropdown class * fix dropdown position * Fix some flake8 * More flake8 fixes * Move examples, add bootstrap5 example, remove all the flag bits that aren't needed
- Loading branch information
Showing
8 changed files
with
166 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>{{msg|default('example page')}}</title> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous"> | ||
</head> | ||
<body> | ||
{{nav.top.render(id='top-navbar', renderer='bootstrap5')}} | ||
<h1>{{msg|default('Welcome')}}</h1> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from flask import Flask, render_template | ||
|
||
from flask_nav3 import Nav | ||
from flask_nav3.elements import Link, Navbar, Separator, Subgroup, Text, View | ||
|
||
nav = Nav() | ||
|
||
# registers the "top" menubar | ||
nav.register_element( | ||
"top", | ||
Navbar( | ||
View("Widgits, Inc.", "index"), | ||
View("Our Mission", "about"), | ||
Subgroup( | ||
"Products", | ||
View("Wg240-Series", "products", product="wg240"), | ||
View("Wg250-Series", "products", product="wg250"), | ||
Separator(), | ||
Text("Discontinued Products"), | ||
View("Wg10X", "products", product="wg10x"), | ||
), | ||
Link("Tech Support", "http://techsupport.invalid/widgits_inc"), | ||
), | ||
) | ||
|
||
|
||
def create_app(configfile=None): | ||
"""Creates the application.""" | ||
app = Flask(__name__) | ||
nav.init_app(app) | ||
|
||
# not good style, but like to keep our examples short | ||
@app.route("/") | ||
def index(): | ||
return render_template("index.html") | ||
|
||
@app.route("/products/<product>/") | ||
def products(product): | ||
return render_template("index.html", msg="Buy our {0}".format(product)) | ||
|
||
@app.route("/about-us/") | ||
def about(): | ||
return render_template("index.html") | ||
|
||
return app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
nav.navbar a { | ||
text-decoration: none; | ||
color: blue; | ||
font-weight: normal; | ||
} | ||
|
||
nav.navbar .active { | ||
font-weight: bold; | ||
} | ||
|
||
nav.navbar > ul { | ||
list-style: none; | ||
} | ||
|
||
nav.navbar ul li { | ||
display: block; | ||
width: 150px; | ||
margin-right: 20px; | ||
float: left; | ||
} | ||
|
||
nav.navbar ul > li > a:hover { | ||
background-color: #eeeecc; | ||
} | ||
|
||
nav.navbar ul .subgroup { | ||
padding-left: 0px; | ||
} | ||
|
||
h1 { | ||
clear: both; | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters