Bootstrap 3 Jumbotron element for django-fluent-contents
Project description
fluentcms-jumbotron
Displaying a Bootstrap 3 Jumbotron in a page
Installation
First install the module, preferably in a virtual environment. It can be installed from PyPI:
pip install fluentcms-jumbotron
First make sure the project is configured for django-fluent-contents.
Then add the following settings:
INSTALLED_APPS += (
'fluentcms_jumbotron',
)
FLUENT_CONTENTS_PLACEHOLDER_CONFIG = {
'slot name': {
'plugins': ('JumbotronPlugin', ...),
},
}
The database tables can be created afterwards:
./manage.py migrate
Frontend styling
The jumbotron is rendered with the HTML that Bootstrap prescribes:
<div class="jumbotron">
<h1>Hello, world!</h1>
<p>...</p>
<p><a class="btn btn-primary btn-lg" href="#" role="button">Learn more</a></p>
</div>
The standard Bootstrap 3 CSS will provide a reasonable styling for this, which can either be overwritten, or replaced in your own CSS files. The defaults provided by Bootstap 3 is: https://github.com/twbs/bootstrap-sass/blob/master/assets/stylesheets/bootstrap/_jumbotron.scss
Customizing
Centering, adding backgrounds, etc.. all happen by adding CSS styling. For example:
.jumbotron {
background: url('/static/frontend/images/background.jpg') no-repeat fixed 0 0;
background-size: cover;
color: #fff;
text-align: center;
}
.jumbotron .btn {
margin-top: 12px; /* For Sass: $padding-base-vertical * 2; */
}
When you use Sass, you can also override the Sass variables.
Full page width
To display the Bootstrap Jumbotron full page, you likely need to break out of the container the JumbotronPlugin is rendered in. For example, when your page looks like:
<div class="container">
{% page_placeholder "homepage" title="Homepage" role="m" %}
</div>
You can change that into:
<div class="container">
{% page_placeholder "homepage" title="Homepage" role="m" template="pages/placeholders/homepage.html" cachable=1 %}
</div>
The pages/placeholders/homepage.html template looks like:
{% for contentitem, html in contentitems %}
{% if contentitem.plugin.name == 'JumbotronPlugin' %}
</div>
{{ html }}
<div class="container">
{% else %}
{{ html }}
{% endif %}
{% endfor %}
Note the exact HTML tags depend on your frontend HTML layout.
The cachable=1 flag is a promise that the template always returns the same result for every request. Otherwise, remove it.
Contributing
If you like this module, forked it, or would like to improve it, please let us know! Pull requests are welcome too. :-)
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
Built Distribution
File details
Details for the file fluentcms-jumbotron-3.0.tar.gz
.
File metadata
- Download URL: fluentcms-jumbotron-3.0.tar.gz
- Upload date:
- Size: 13.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c63cb8fd05e92b864bdd33d13ad4fa0cb7f589a0c27c79865483bb0e91e8f9c |
|
MD5 | 61473e0c4ba971f8c6b8f81dd80102a5 |
|
BLAKE2b-256 | 84fc70419eefe60f4cf512c5b107fdb5e9a8672a2f1aa4b6741a2f1c61e52d56 |
File details
Details for the file fluentcms_jumbotron-3.0-py3-none-any.whl
.
File metadata
- Download URL: fluentcms_jumbotron-3.0-py3-none-any.whl
- Upload date:
- Size: 14.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38c9861a869b9084fd5a4a12b330a45d7429580a77767d9948738a60945ca524 |
|
MD5 | c309bb6521d8bb4ad04aedb521ff8bf4 |
|
BLAKE2b-256 | dd437e4ff00c3044e839a84a7fc315c58d0b1737c92183c01f9b3db29aacaa5b |