From 45c2f4e8aabe6db9aab85e39c0cd57b61dc13d4d Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 2 Sep 2016 12:11:21 +0200 Subject: [PATCH] Added dynamic table overflow --- .../output/node/HtmlOutputNodeTable.class.php | 43 +++++++++++++++++++ wcfsetup/install/files/style/ui/message.scss | 7 +++ 2 files changed, 50 insertions(+) create mode 100644 wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeTable.class.php diff --git a/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeTable.class.php b/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeTable.class.php new file mode 100644 index 0000000000..d8f49aa08e --- /dev/null +++ b/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeTable.class.php @@ -0,0 +1,43 @@ + + * @package WoltLabSuite\Core\System\Html\Output\Node + * @since 3.0 + */ +class HtmlOutputNodeTable extends AbstractHtmlOutputNode { + /** + * @inheritDoc + */ + protected $tagName = 'table'; + + /** + * @inheritDoc + */ + public function process(array $elements, AbstractHtmlNodeProcessor $htmlNodeProcessor) { + if ($this->outputType === 'text/html' || $this->outputType === 'text/simplified-html') { + /** @var \DOMElement $element */ + foreach ($elements as $element) { + // check if table is not contained within another table + $parent = $element; + while ($parent = $parent->parentNode) { + if ($parent->nodeName === 'table') { + continue; + } + } + + $div = $element->ownerDocument->createElement('div'); + $div->setAttribute('class', 'messageTableOverflow'); + + $element->parentNode->insertBefore($div, $element); + $div->appendChild($element); + } + } + } +} diff --git a/wcfsetup/install/files/style/ui/message.scss b/wcfsetup/install/files/style/ui/message.scss index 1b27e71564..f52b324778 100644 --- a/wcfsetup/install/files/style/ui/message.scss +++ b/wcfsetup/install/files/style/ui/message.scss @@ -620,3 +620,10 @@ } } } + +@include screen-sm-down { + /* allow tables to overflow on small screens */ + .messageTableOverflow { + overflow: auto; + } +} -- 2.20.1