Skip to content

Releases: paqstd-dev/django-simple-components

v0.1.0

03 Nov 01:19
Compare
Choose a tag to compare

The syntax for describing components and usage has been changed:

  • To create a closable tag, you now need to include # at the beginning and / at the end before the tag name:

      {% #set_component ... %}
         ...
      {% /set_component %}
      {% #component ... %}
        ...
      {% /component %}

    This is very similar to the endtag in Django Templates.

  • Added slots. Slots are a powerful opportunity to upgrade your components! Slots can accept any content. Each slot has a name, and is specified inside the set_component tag:

      {% #set_component "card" %}
          <div class="card">
              <div class="card-header">
                  <h3>{{ title }}</h3>
              </div>
              <div class="card-body">
                  {% set_slot "body" %}
              </div>
          </div>
      {% /set_component %}
  • Inline tags can still be used, in the old syntax.

The tag engine has been completely redesigned, the context is used more and more globally.

v0.0.3

02 Nov 10:10
Compare
Choose a tag to compare

Fixed bug for {% component kwarg1="..." kwarg2="..." %} without name with kwargs.

Added built-in Exceptions that inherit from the base template.TemplateSyntaxError:

  • SetComponentNameError,
  • ComponentNameError,
  • ComponentArgsError,
  • ComponentNotDefined.

Added more tests for check raise exceptions, coverage badge added.

v0.0.2

29 Oct 09:12
Compare
Choose a tag to compare

Fixed bug for deploy new version to PyPI.

v0.0.1

29 Oct 07:12
Compare
Choose a tag to compare

Django Simple Components is a small package to easily create components inside your templates without saving them in the templates folder.

{% load simple_components %}

{% set_component "first_component" %}
    <div class="card">
        <h3>{{ title }}</h3>
        <p>{{ description }}</p>
    </div>
{% end_set_component %}

<div class="card-list">
    {% component "first_component" title="Hello world!" description="Some text..." %}
    {% component "first_component"
        title="Some lines"
        description="Other text..."
    %}

    {% with value="this text will be capitalized later" %}
        {% component "first_component" title=123 description=value|capfirst %}
    {% endwith %}
</div>