See http://getbootstrap.com/components/#panels
Example:
var p = new BSPanel("default", body = "Panel content")
assert p.write_to_string == """
<div class="panel panel-default">
<div class="panel-body">
Panel content
</div>
</div>
"""
Panel with heading:
p = new BSPanel("danger", heading = "Panel heading", body = "Panel content")
assert p.write_to_string == """
<div class="panel panel-danger">
<div class="panel-heading">
Panel heading
</div>
<div class="panel-body">
Panel content
</div>
</div>
"""
html :: BSPanel :: 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 :: BSComponent :: defaultinit
html :: BSPanel :: defaultinit
core :: Object :: defaultinit
core :: Writable :: defaultinit
template :: Template :: 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 panel component.
#
# See http://getbootstrap.com/components/#panels
#
# Example:
#
# ~~~
# var p = new BSPanel("default", body = "Panel content")
#
# assert p.write_to_string == """
# <div class="panel panel-default">
# <div class="panel-body">
# Panel content
# </div>
# </div>
# """
# ~~~
#
# Panel with heading:
#
# ~~~
# p = new BSPanel("danger", heading = "Panel heading", body = "Panel content")
#
# assert p.write_to_string == """
# <div class="panel panel-danger">
# <div class="panel-heading">
# Panel heading
# </div>
# <div class="panel-body">
# Panel content
# </div>
# </div>
# """
# ~~~
class BSPanel
super BSComponent
autoinit(color, heading, body, footer, css_classes)
# Panel color.
#
# Can be one of `default`, `primary`, `success`, `info`, `warning` or `danger`.
var color: String is writable
# Panel header if any.
var heading: nullable Writable = null is optional, writable
# Body to display in the panel.
var body: nullable Writable = null is optional, writable
init do css_classes.add "panel panel-{color}"
redef fun rendering do
addn "<div{render_css_classes}>"
var heading = self.heading
if heading != null then
addn "<div class=\"panel-heading\">"
addn heading.write_to_string
addn "</div>"
end
var body = self.body
if body != null then
addn "<div class=\"panel-body\">"
addn body.write_to_string
addn "</div>"
end
var footer = self.footer
if footer != null then
addn "<div class=\"panel-footer\">"
addn footer.write_to_string
addn "</div>"
end
addn "</div>"
end
end
lib/html/bootstrap.nit:395,1--471,3