Bootstrap 3 Button element for FeinCMS
Project description
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 make sure the project is configured for feincms.
Then add the following settings:
INSTALLED_APPS += (
'feincms_button',
)
Now, you can create ButtonContent content type:
from feincms.module.page.models import Page
from feincms_button.contents import ButtonContent
Page.create_content_type(ButtonContent)
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
FEINCMS_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")),
)
FEINCMS_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. :-)
Changes
2.0.0 (2021-11-27)
Added Django 3+ support.
Dropped Python 2.7 support.
Dropped Django 1.10 / 1.11 support.
Project details
Release history Release notifications | RSS feed
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
Hashes for feincms_button-2.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b17f88df9ad7071c9d618a5c58764872c0cf7b8a433f593e5b6d8f80d67cb4d |
|
MD5 | cd2d74362291f0e4411fa3335ad88d1b |
|
BLAKE2b-256 | 66e3a7c43f6042e5aad7e2bbdb89ea3edc9e7742f8c674e780ac77bec8145f64 |