Tuile

Documentation du tag

Returns a tile item. Takes a dict as parameter, with the following structure:

data_dict = {
    "title": "Title of the tile item",
    "url": "URL of the link of the tile item",
    "image_path": "path of the tile image",
    "svg_path": "path of the tile image if this is a SVG",
    "description": "(Optional) description of the tile item",
    "detail": "(Optional) detail zone of the tile tiem
    "top_detail": "(Optional) dict with a top detail content and optional tags or badges",
    "heading_tag": "(Optional) Heading tag for the alert title (default: h3)",
    "id": "(Optional) id of the tile item",
    "enlarge_link": "(Optional) boolean. If true (default), the link covers the whole card",
    "extra_classes": "(Optional) string with names of extra classes"
}

All of the keys of the dict can be passed directly as named parameters of the tag.

Relevant extra_classes:

  • village-tile--sm: for a small (SM) tile
  • village-tile--horizontal: for an horizontal tile
  • village-tile--download: Replaces the forward arrow icon with a download one
  • village-tile--grey: adds a grey background on the tile
  • village-tile--no-border: removes the tile border
  • village-tile--no-background: removes the tile background
  • village-tile--shadow: adds a shadow to the tile border

Format of the top_detail dict (every field is optional):

top_detail = {
    "tags": "a list of tag items (mutually exclusive with badges)",
    "badges": "a list of badge items (mutually exclusive with tags)"
}

Note: image_path will work even if a SVG is provided, but svg_path will use a <svg> html tag instead of the <img> tag.

Tag name: village_tile

Usage: {% village_tile data_dict %}

Exemples

Données

{'image_path': '/static/img/placeholder.1x1.svg',
 'title': 'Tuile basique (verticale, MD)',
 'url': '/'}

Résultat

Données

{'description': 'Tuile horizontale (MD)',
 'detail': 'Avec un pictogramme SVG',
 'extra_classes': 'village-tile--horizontal',
 'id': 'tile-cityhall',
 'svg_path': '/static/django_village/dist/artwork/pictograms/buildings/city-hall.svg',
 'title': 'Tuile horizontale',
 'url': '/'}

Résultat

Données

{'extra_classes': 'village-tile--sm',
 'id': 'tile-nuclear-plant',
 'svg_path': '/static/django_village/dist/artwork/pictograms/buildings/nuclear-plant.svg',
 'title': 'Tuile verticale (SM)',
 'url': '/'}

Résultat

Données

{'extra_classes': 'village-tile--horizontal village-tile--sm',
 'id': 'tile-map',
 'svg_path': '/static/django_village/dist/artwork/pictograms/map/map.svg',
 'title': 'Tuile horizontale (SM)',
 'top_detail': {'badges': [{'extra_classes': 'village-badge--sm '
                                             'village-badge--purple-glycine',
                            'label': 'Badge coloré'}]},
 'url': '/'}

Résultat

Données

{'extra_classes': 'village-tile--horizontal village-tile--grey '
                  'village-tile--shadow village-tile--no-border',
 'id': 'tile-map',
 'svg_path': '/static/django_village/dist/artwork/pictograms/leisure/paint.svg',
 'title': 'Tuile à fond gris et ombre sans bordure',
 'url': '/'}

Résultat

Données

{'detail': 'PDF — 1,7 Mo',
 'extra_classes': 'village-tile--horizontal village-tile--download',
 'svg_path': '/static/django_village/dist/artwork/pictograms/document/document-signature.svg',
 'title': 'Tuile de téléchargement',
 'url': '/'}

Résultat