The node of the aside element.
The aside content is used to display all the information on a document.
The node of the aside element.
The aside content is used to display all the information on a document.
Create the node.
def __init__(self, parent: str):
"""Create the node.
:param parent: (str) The parent node identifier
"""
super(WhakerKitDocAsideNode, self).__init__(parent, 'doc_aside', 'aside', attributes={'id': 'doc_aside', 'class': 'doc-aside', 'tabindex': '0'})
self.reset()
Reset the aside node to its default values.
def reset(self):
"""Reset the aside node to its default values."""
h2 = HTMLNode(self.identifier, 'h2', 'h2')
h2.set_value(get_msg(MSG_DETAILS))
self.append_child(h2)
self.__append_p('doc_filename', value=get_msg(MSG_DOC_FILENAME))
self.__append_p('doc_author', value=get_msg(MSG_DOC_AUTHOR))
self.__append_p('doc_filetype', value=get_msg(MSG_DOC_FILETYPE))
self.__append_p('doc_date', value=get_msg(MSG_DOC_DATE))
self.__append_p('doc_description', value=get_msg(MSG_DOC_DESCRIPTION))
self.__append_p('doc_downloads', value=get_msg(MSG_DOC_DOWNLOADS), span_value=get_msg(MSG_DOC_DOWNLOADS_VALUE))
button = HTMLNode(self.identifier, 'button', 'button', attributes={'id': 'close_aside_button', 'onclick': 'asideManager.closeDetails()', 'class': 'apply-button'})
button.set_value(get_msg(MSG_CLOSE))
self.append_child(button)
Append a paragraph with given identifier name.
def __append_p(self, name: str, value='', span_value='--'):
"""Append a paragraph with given identifier name.
:param name: (str) Identifier for the paragraph.
"""
p = HTMLNode(self.identifier, name + '_p', 'p', value='<b>' + value + '</b>')
self.append_child(p)
name = name + '_span'
span = HTMLNode(p.identifier, 'span', 'span', attributes={'id': name}, value=span_value)
p.append_child(span)