• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

zostera / django-bootstrap4 / 5398229605

pending completion
5398229605

push

github

dyve
Remove Django 2 support

277 of 344 branches covered (80.52%)

Branch coverage included in aggregate %.

689 of 773 relevant lines covered (89.13%)

4.42 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.74
/src/bootstrap4/components.py
1
from django.utils.safestring import mark_safe
5✔
2
from django.utils.translation import gettext as _
5✔
3

4
from bootstrap4.utils import render_tag
5✔
5

6
from .text import text_value
5✔
7

8

9
def render_alert(content, alert_type=None, dismissible=True):
5✔
10
    """Render a Bootstrap alert."""
11
    button = ""
5✔
12
    if not alert_type:
5✔
13
        alert_type = "info"
5✔
14
    css_classes = ["alert", "alert-" + text_value(alert_type)]
5✔
15
    if dismissible:
5!
16
        css_classes.append("alert-dismissible")
5✔
17
        close = _("close")
5✔
18
        button = (
5✔
19
            '<button type="button" class="close" data-dismiss="alert" aria-label="{close}">&times;</button>'
20
        ).format(close=close)
21
    button_placeholder = "__BUTTON__"
5✔
22
    return mark_safe(
5✔
23
        render_tag(
24
            "div",
25
            attrs={"class": " ".join(css_classes), "role": "alert"},
26
            content=mark_safe(button_placeholder) + text_value(content),
27
        ).replace(button_placeholder, button)
28
    )
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc