Flask jQuery UI Bootstrap minimalistic fork of Flask-Bootsrap extension
Project description
Flask jQuery Ui Bootstrap
Flask-JqueryUiBootstrap is minimalistic fork of Flask-Bootstrap project. This project packages Twitter’s Bootstrap with jQuery UI and is based on jQuery UI Bootstrap project.
If you don’t need jQuery UI Bootstrap is strongly recommended to use better original plugin Flask-Bootstrap.
Usage
Here is an example:
from flask.ext.jqueryuibootstrap import Bootstrap [...] Bootstrap(app)
This makes base layout templates available: jqueryuibootstrap_base.html. This layout file have predefined blocks where you can put your content. The core block to alter is body_content, otherwise see the source of the template for more possibilities.
Macros
A few macros are available to make your life easier. These need to be imported (I recommend create your own base.html template that extends one of the bootstrap base templates first and including the the macros there).
An example base.html:
{% extends "jqueryuibootstrap_base.html" %} {% import "jqueryuibootstrap_wtf.html" as wtf %}
Forms
The jqueryuibootstrap_wtf template contains macros to help you output forms quickly. The most basic way is using them as an aid to create a form by hand:
<form class="form form-horizontal" method="post"> {{ form.hidden_tag() }} {{ wtf.form_errors(form, "only") }} {{ wtf.horizontal_field(form.field1) }} {{ wtf.horizontal_field(form.field2) }} <div class="form-actions"> <button name="action_save" type="submit" class="btn btn-primary">Save changes</button> </div> </form>
However, often you just want to get a form done quickly and have no need for intense fine-tuning:
{{ wtf.quick_form(form) }}
Configuration options
There are a few configuration options used by the templates:
Option |
Default |
|
---|---|---|
BOOTSTRAP_HTML5_SHIM |
True |
Include the default IE-fixes that are usually included when using bootstrap. |
BOOTSTRAP_GOOGLE_ANALYTICS_ACCOUNT |
None |
If set, include Google Analytics boilerplate using this account. |
Installation
Either install from github using pip or from PyPI.
A note on versifying
Flask-JqueryUiBootstrap tries to keep some track of jQuery UI Bootstrap releases. Versifying is usually in the form of x.y.z of jQuery UI Bootstrap version with .z micro version of Flask extension Package. For example, a version of 0.5.0.0 bundles version 0.5.0 of jQuery UI Bootstrap version and is initial release of Flask-JqueryUiBootstrap containing that version.
FAQ
How can I add custom javascript to the template?
Use Jinja2’s super() in conjunction with the bootstrap_js_bottom block. The super-function adds the contents of a block from the parent template, that way you can even decide if you want to include it before or after jQuery/bootstrap. Example:
{% block bootstrap_js_bottom %} {{super()}} <script src="my_app_code.js"> {% endblock %}
Contribute
We are open for any help.
Fork the repository on GitHub to start making your changes to the master branch (or branch off of it).
Write a test which shows that the bug was fixed or that the feature works as expected.
Send a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself to AUTHORS.
History
0.5.0.3 (2013-09-15)
Important API change Bootstrap to JqueryUiBootstrap (Flask-Bootstrap no conflict)
0.5.0.1 (2013-08-26)
Initial version
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file Flask-JqueryUiBootstrap-0.5.0.4.tar.gz
.
File metadata
- Download URL: Flask-JqueryUiBootstrap-0.5.0.4.tar.gz
- Upload date:
- Size: 375.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2978452824ed04d39b5a48b5fcabcd4946526ddb0ea85427190e126c1f846c12 |
|
MD5 | 9cc607d7290e9c794c5cea7ad3cfd1c0 |
|
BLAKE2b-256 | 5be212d12a36411ea6f185b4c827427d8ff66319c8d266ab53186cfea120f3ab |