From ae911c33e0e69c56792e87cf13111552468acc53 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Sun, 27 Nov 2016 14:05:18 +0100 Subject: [PATCH] Overhauled media-bbcode --- com.woltlab.wcf/templates/mediaBBCodeTag.tpl | 12 +++++++++- .../ViewableMediaRuntimeCache.class.php | 24 +++++++++++++++++++ ...ediaMessageEmbeddedObjectHandler.class.php | 4 ++-- .../install/files/style/bbcode/media.scss | 11 +++++++++ 4 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 wcfsetup/install/files/lib/system/cache/runtime/ViewableMediaRuntimeCache.class.php create mode 100644 wcfsetup/install/files/style/bbcode/media.scss diff --git a/com.woltlab.wcf/templates/mediaBBCodeTag.tpl b/com.woltlab.wcf/templates/mediaBBCodeTag.tpl index 448dcfedd1..b4f206b367 100644 --- a/com.woltlab.wcf/templates/mediaBBCodeTag.tpl +++ b/com.woltlab.wcf/templates/mediaBBCodeTag.tpl @@ -1 +1,11 @@ -{$media->getTitle()} \ No newline at end of file +
+ {if $thumbnailSize != 'original'} + {$media->altText} + {else} + {$media->altText} + {/if} + + {if $media->caption} +
{$media->caption}
+ {/if} +
diff --git a/wcfsetup/install/files/lib/system/cache/runtime/ViewableMediaRuntimeCache.class.php b/wcfsetup/install/files/lib/system/cache/runtime/ViewableMediaRuntimeCache.class.php new file mode 100644 index 0000000000..2803d3db91 --- /dev/null +++ b/wcfsetup/install/files/lib/system/cache/runtime/ViewableMediaRuntimeCache.class.php @@ -0,0 +1,24 @@ + + * @package WoltLabSuite\Core\System\Cache\Runtime + * @since 3.0 + * + * @method ViewableMedia[] getCachedObjects() + * @method ViewableMedia getObject($objectID) + * @method ViewableMedia[] getObjects(array $objectIDs) + */ +class ViewableMediaRuntimeCache extends AbstractRuntimeCache { + /** + * @inheritDoc + */ + protected $listClassName = ViewableMediaList::class; +} diff --git a/wcfsetup/install/files/lib/system/message/embedded/object/MediaMessageEmbeddedObjectHandler.class.php b/wcfsetup/install/files/lib/system/message/embedded/object/MediaMessageEmbeddedObjectHandler.class.php index fd11d4ad9a..aad97f6699 100644 --- a/wcfsetup/install/files/lib/system/message/embedded/object/MediaMessageEmbeddedObjectHandler.class.php +++ b/wcfsetup/install/files/lib/system/message/embedded/object/MediaMessageEmbeddedObjectHandler.class.php @@ -2,7 +2,7 @@ namespace wcf\system\message\embedded\object; use wcf\data\media\Media; use wcf\data\media\MediaList; -use wcf\system\cache\runtime\MediaRuntimeCache; +use wcf\system\cache\runtime\ViewableMediaRuntimeCache; use wcf\system\html\input\HtmlInputProcessor; use wcf\util\ArrayUtil; @@ -39,7 +39,7 @@ class MediaMessageEmbeddedObjectHandler extends AbstractSimpleMessageEmbeddedObj * @inheritDoc */ public function loadObjects(array $objectIDs) { - return MediaRuntimeCache::getInstance()->getObjects($objectIDs); + return ViewableMediaRuntimeCache::getInstance()->getObjects($objectIDs); } /** diff --git a/wcfsetup/install/files/style/bbcode/media.scss b/wcfsetup/install/files/style/bbcode/media.scss new file mode 100644 index 0000000000..b8613ae1d6 --- /dev/null +++ b/wcfsetup/install/files/style/bbcode/media.scss @@ -0,0 +1,11 @@ +.mediaBBCode { + display: inline-block; + + figcaption { + color: $wcfContentDimmedText; + margin-top: 5px; + text-align: center; + + @include wcfFontSmall; + } +} -- 2.20.1