Skip to main content

Bootstrap 3 Jumbotron element for django-fluent-contents

Project description

fluentcms-jumbotron

https://img.shields.io/travis/edoburu/fluentcms-jumbotron/master.svg?branch=master https://img.shields.io/pypi/v/fluentcms-jumbotron.svg https://img.shields.io/pypi/dm/fluentcms-jumbotron.svg https://img.shields.io/badge/wheel-yes-green.svg https://img.shields.io/pypi/l/fluentcms-jumbotron.svg https://img.shields.io/codecov/c/github/edoburu/fluentcms-jumbotron/master.svg

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

fluentcms-jumbotron-1.1.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

fluentcms_jumbotron-1.1-py2.py3-none-any.whl (12.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file fluentcms-jumbotron-1.1.tar.gz.

File metadata

File hashes

Hashes for fluentcms-jumbotron-1.1.tar.gz
Algorithm Hash digest
SHA256 e68492fd7b4bcc4b3d6862947f8d3c0b6533570862157c435accebcd8e18765f
MD5 e7171932dee67ec2bde5beede396461c
BLAKE2b-256 432a70f03475b5e2bccfed153c52e712f77828a0cf6ed034b38c9a430eedc5e8

See more details on using hashes here.

File details

Details for the file fluentcms_jumbotron-1.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for fluentcms_jumbotron-1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 807512187390ad795fd8e73c3e55212e3db4700e9e7e0f367d44096ab842a411
MD5 a978f3fc9e9c34291bd4189467d9151f
BLAKE2b-256 ee1b0ff77ef55d195cdc754a19a4db28d47de57b796cbdd80a2964182a669dc6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page