Skip to main content

Bootstrap 3 Button element for django-fluent-contents

Project description

fluentcms-button

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

Displaying a Bootstrap 3 Button in text.

This button can be used for navigation, for example at the end of a text block.

These buttons can’t be used in forms.

Installation

First install the module, preferably in a virtual environment. It can be installed from PyPI:

pip install fluentcms-button

First make sure the project is configured for django-fluent-contents.

Then add the following settings:

INSTALLED_APPS += (
    'fluentcms_button',
)

FLUENT_CONTENTS_PLACEHOLDER_CONFIG = {
    'slot name': {
        'plugins': ('ButtonPlugin', ...),
    },
}

The database tables can be created afterwards:

./manage.py migrate

Frontend styling

The button is rendered with the HTML that Bootstrap prescribes:

<a class="btn btn-default" href="#" role="button">Link</a>

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/_buttons.scss

When you use Sass, you can also override the Sass variables.

Configuration

When desired, the following settings can be overwritten:

from django.utils.translation import pgettext_lazy

FLUENTCMS_BUTTON_STYLES = (
    ('btn-default', pgettext_lazy("button-style", u"Default")),
    ('btn-primary', pgettext_lazy("button-style", u"Primary")),
    ('btn-success', pgettext_lazy("button-style", u"Success")),
    ('btn-info', pgettext_lazy("button-style", u"Info")),
    ('btn-warning', pgettext_lazy("button-style", u"Warning")),
    ('btn-danger', pgettext_lazy("button-style", u"Danger")),
    ('btn-link', pgettext_lazy("button-style", u"Link")),
)

FLUENTCMS_BUTTON_SIZES = (
    ('', pgettext_lazy("button-size", u"Default")),
    ('btn-lg', pgettext_lazy("button-size", u"Large")),
    ('btn-sm', pgettext_lazy("button-size", u"Small")),
    ('btn-xs', pgettext_lazy("button-size", u"Extra Small")),
)

By default, the standard Bootstrap button classes are used. These can be redefined when the project uses other classes for the buttons.

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-button-1.1.1.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

fluentcms_button-1.1.1-py2.py3-none-any.whl (12.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file fluentcms-button-1.1.1.tar.gz.

File metadata

File hashes

Hashes for fluentcms-button-1.1.1.tar.gz
Algorithm Hash digest
SHA256 f5044b73119d472e03ee675d41e1da04a3b8e225428d3257cfce56cf86ec04e3
MD5 0c06c6c58474f086fae19f41da4c8a13
BLAKE2b-256 4e1224c63a4591f98a05c18c6704d9f693090c1e1d679eb1025abad47750991c

See more details on using hashes here.

File details

Details for the file fluentcms_button-1.1.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for fluentcms_button-1.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0b252476d1bcb87efbb05bd2a184562758b3c779b0f1e908ecc6cef8f778dc05
MD5 a4ba2b36674021a8c421ec9c3a3de340
BLAKE2b-256 4cd75f66a7b00ba07dabba8dc7f0a3676395de7be8ab2957b435ee3b21b67fdb

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