See http://getbootstrap.com/components/#alerts
Example:
var alert = new BSAlert("danger", "Danger!")
assert alert.write_to_string == """
<div class="alert alert-danger">
Danger!
</div>
"""
html :: BSAlert :: defaultinit
html :: BSAlert :: is_dismissible
Can the alert be dismissed by clicking the close button?html :: BSAlert :: is_dismissible=
Can the alert be dismissed by clicking the close button?core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
html :: BSComponent :: css_classes
CSS classes to add on this element.html :: BSComponent :: css_classes=
CSS classes to add on this element.html :: BSComponent :: defaultinit
core :: Object :: defaultinit
template :: Template :: defaultinit
html :: BSAlert :: defaultinit
core :: Writable :: defaultinit
html :: BSAlert :: is_dismissible
Can the alert be dismissed by clicking the close button?html :: BSAlert :: is_dismissible=
Can the alert be dismissed by clicking the close button?template :: Template :: is_frozen=
Is the template allowing more modification (add
)
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: Object :: output_class_name
Display class name on stdout (debug only).html :: BSComponent :: render_css_classes
Renderself
css clases as a class
attribute.
core :: Writable :: write_to_bytes
Likewrite_to
but return a new Bytes (may be quite large)
core :: Writable :: write_to_file
Likewrite_to
but take care of creating the file
core :: Writable :: write_to_string
Likewrite_to
but return a new String (may be quite large).
# A Bootstrap alert component.
#
# See http://getbootstrap.com/components/#alerts
#
# Example:
#
# ~~~
# var alert = new BSAlert("danger", "Danger!")
# assert alert.write_to_string == """
# <div class="alert alert-danger">
# Danger!
# </div>
# """
# ~~~
class BSAlert
super BSComponent
autoinit(color, text, is_dismissible, css_classes)
# Class used to change the color of the alert.
#
# Can be one of `primary`, `success`, `info`, `warning` or `danger`.
var color: String
# Text to display in the alert.
var text: Writable
# Can the alert be dismissed by clicking the close button?
#
# See http://getbootstrap.com/components/#alerts-dismissible
#
# Default is `false`.
var is_dismissible = false is optional, writable
init do css_classes.add "alert alert-{color}"
redef fun rendering do
addn "<div{render_css_classes}>"
if is_dismissible then
add "<button type=\"button\" class=\"close\" data-dismiss=\"alert\""
add "aria-label=\"Close\"><span aria-hidden=\"true\">×</span>"
addn "</button>"
end
addn text.write_to_string
addn "</div>"
end
end
lib/html/bootstrap.nit:348,1--393,3