html :: BSPanel :: defaultinit
# 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