Property definitions

html $ BSAlert :: defaultinit
# 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\">&times;</span>"
			addn "</button>"
		end
		addn text.write_to_string
		addn "</div>"
	end
end
lib/html/bootstrap.nit:348,1--393,3