nitc :: DocTab :: defaultinit
nitc :: DocTab :: is_active=
Is this tab displayed by default?template :: Template :: _is_frozen
Is the template allowing more modification (add
)
template :: Template :: _is_writing
Flag to avoid infinite recursivity if a template contains itselftemplate :: Template :: _render_done
Flag to avoid multiple renderingcore :: Object :: class_factory
Implementation used byget_class
to create the specific class.
core :: Object :: defaultinit
nitc :: DocTab :: defaultinit
template :: Template :: defaultinit
core :: Writable :: defaultinit
nitc :: DocTab :: is_active=
Is this tab displayed by default?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.
template :: Template :: is_writing
Flag to avoid infinite recursivity if a template contains itselftemplate :: Template :: is_writing=
Flag to avoid infinite recursivity if a template contains itselfcore :: Object :: native_class_name
The class name of the object in CString format.core :: Object :: output_class_name
Display class name on stdout (debug only).template :: Template :: render_done=
Flag to avoid multiple renderingcore :: 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 documentation tabulated view
class DocTab
# Tab uniq id in the page
var id: String is writable
# Table title
var title: String is writable
# Is this tab displayed by default?
var is_active = false is optional, writable
# Tab header icon
var icon: nullable String = null is optional, writable
# Tab content
var content = new Array[StaticCard]
# Tab sidebar
var sidebar = new DocSidebar
# Tab metadata sidebar
var metadata = new DocSidebar
# Is this tab empty?
fun is_empty: Bool do return content.is_empty
end
src/doc/static/static_base.nit:305,1--331,3
redef class DocTab
super Template
# Show sidebar for this page?
var show_sidebar = true is writable
# Tab link for tab headers
fun tab_link: Template do
var tpl = new Template
tpl.addn "<li class='{if is_active then "active" else ""}'>"
tpl.addn " <a data-toggle='tab' href='#{id}'>"
var icon = self.icon
if icon != null then
tpl.addn " <span class='glyphicon glyphicon-{icon}'></span>"
end
tpl.addn " {title}"
tpl.addn " </a>"
tpl.addn "</li>"
return tpl
end
redef fun rendering do
var has_left = show_sidebar and sidebar.cards.not_empty
var has_right = metadata.cards.not_empty
addn "<div class='tab-pane {if is_active then "active" else ""}' id='{id}'>"
if has_left then
addn " <div class='col-sm-3'>"
addn sidebar
addn " </div>"
end
var cols = 12
if has_left then cols -= 3
if has_right then cols -= 3
addn " <div class='col-sm-{cols}'>"
for card in content do addn card
addn " </div>"
if has_right then
addn " <div class='col-sm-3'>"
addn metadata
addn " </div>"
end
addn "</div>"
end
end
src/doc/static/static_html.nit:205,1--250,3