From dd7a9c23b280a170651c6c2cdc68d579a8bf4cdb Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 30 May 2014 11:38:15 +0200 Subject: [PATCH] Added auto-collapse feature for code bbcode boxes --- com.woltlab.wcf/templates/codeBBCodeTag.tpl | 13 ++++++++++- .../lib/system/bbcode/CodeBBCode.class.php | 3 ++- wcfsetup/install/files/style/bbcode.less | 22 +++++++++++++++++++ wcfsetup/install/lang/de.xml | 1 + wcfsetup/install/lang/en.xml | 1 + 5 files changed, 38 insertions(+), 2 deletions(-) diff --git a/com.woltlab.wcf/templates/codeBBCodeTag.tpl b/com.woltlab.wcf/templates/codeBBCodeTag.tpl index d2f6f258db..587fed48ee 100644 --- a/com.woltlab.wcf/templates/codeBBCodeTag.tpl +++ b/com.woltlab.wcf/templates/codeBBCodeTag.tpl @@ -1,4 +1,4 @@ -
+

{@$highlighter->getTitle()}{if $filename}: {@$filename}{/if}

@@ -17,4 +17,15 @@ {/foreach}
+ + {if $lines > 10} + {lang}wcf.bbcode.button.showAll{/lang} + + {/if}
diff --git a/wcfsetup/install/files/lib/system/bbcode/CodeBBCode.class.php b/wcfsetup/install/files/lib/system/bbcode/CodeBBCode.class.php index 708886d5bb..d76f00683b 100644 --- a/wcfsetup/install/files/lib/system/bbcode/CodeBBCode.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/CodeBBCode.class.php @@ -130,7 +130,8 @@ class CodeBBCode extends AbstractBBCode { 'startLineNumber' => $this->startLineNumber, 'content' => $highlightedContent, 'highlighter' => $className::getInstance(), - 'filename' => $this->filename + 'filename' => $this->filename, + 'lines' => substr_count($content, "\n") + 1 )); return WCF::getTPL()->fetch('codeBBCodeTag'); } diff --git a/wcfsetup/install/files/style/bbcode.less b/wcfsetup/install/files/style/bbcode.less index e42fda2153..6986d4c45f 100644 --- a/wcfsetup/install/files/style/bbcode.less +++ b/wcfsetup/install/files/style/bbcode.less @@ -53,6 +53,28 @@ } } } + + &.minimized { + max-height: 200px; + overflow: hidden; + position: relative; + + > .codeBoxExpand { + background-color: @wcfContainerBackgroundColor; + border-top: 1px solid @wcfContainerBorderColor; + bottom: 0; + cursor: pointer; + display: block; + height: 20px; + left: 0; + padding: 4px; + position: absolute; + right: 0; + text-align: center; + + .boxShadow(0, -10px, @wcfContainerBackgroundColor, 25px, 5px); + } + } } // rtl fix diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 4687660c6a..f98bcd1fed 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -1538,6 +1538,7 @@ Erlaubte Dateiendungen: {', '|implode:$attachmentHandler->getFormattedAllowedExt + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index 91e5adf1f7..b0a213331d 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -1481,6 +1481,7 @@ Allowed extensions: {', '|implode:$attachmentHandler->getFormattedAllowedExtensi + -- 2.20.1