See http://getbootstrap.com/components/#badges
Example:
var b = new BSBadge("42 messages")
assert b.write_to_string == "<span class=\"badge\">42 messages</span>"
html :: BSBadge :: defaultinit
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 :: BSBadge :: defaultinit
core :: Object :: defaultinit
html :: BSComponent :: defaultinit
template :: Template :: defaultinit
core :: Writable :: defaultinit
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 badge component.
#
# See http://getbootstrap.com/components/#badges
#
# Example:
#
# ~~~
# var b = new BSBadge("42 messages")
# assert b.write_to_string == "<span class=\"badge\">42 messages</span>"
# ~~~
class BSBadge
super BSComponent
autoinit(text, css_classes)
# Text to display in the label.
var text: Writable
init do css_classes.add "badge"
redef fun rendering do
add "<span{render_css_classes}>{text.write_to_string}</span>"
end
end
lib/html/bootstrap.nit:294,1--316,3