Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Make frontend plugins re-usable components #220

Open
wants to merge 100 commits into
base: master
Choose a base branch
from

Conversation

fsbraun
Copy link
Sponsor Member

@fsbraun fsbraun commented May 28, 2024

When designing frontends it is key to avoid repeating template/HTML code. This PR makes djangocms-frontend components like alerts, cards, buttons or links, etc.

This PR provides a simple way to re-use djangocms-frontend plugins in templates:

{% load frontend %}
{% url "some-name" as link_target %}
{% plugin "link" external_link=link_target link_type="btn" link_context="primary" link_outline=False %}
    Click me!
{% endplugin %}

or

{% load frontend %}
{% plugin "card" card_alignment="center" card_outline="info"  card_text_color="primary" card_full_height=True %}
    {% plugin "cardinner" inner_type="card-header" text_alignment="start" %}
        <h4>Card title</h4>
    {% endplugin %}
    {% plugin "cardinner" inner_type="card-body" text_alignment="center" %}
        Some quick example text to build on the card title and make up the
        bulk of the card's content.
    {% endplugin %}
    {% plugin "listgroupitem" %}An item{% endplugin %}
    {% plugin "listgroupitem" %}A second item{% endplugin %}
    {% plugin "listgroupitem" %}A third item{% endplugin %}
{% endplugin %}

These plugins are not created in the database. They work with djangocms-frontend plugins and most other django CMS plugins.

@fsbraun fsbraun marked this pull request as ready for review May 29, 2024 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant