Improved styling of user mentions
authorMarcel Werk <burntime@woltlab.com>
Thu, 18 Aug 2016 18:10:06 +0000 (20:10 +0200)
committerMarcel Werk <burntime@woltlab.com>
Thu, 18 Aug 2016 18:10:06 +0000 (20:10 +0200)
com.woltlab.wcf/templates/userBBCodeTag.tpl
wcfsetup/install/files/lib/system/bbcode/UserBBCode.class.php
wcfsetup/install/files/style/bbcode/userMention.scss [new file with mode: 0644]

index 540243b6c1cbeeac1ae687525d1761e1a8550b40..7cd4355def5096142ae282b60790a38e770f8b20 100644 (file)
@@ -1,7 +1,6 @@
 {if $userProfile === null}
        {* user no longer exists, use plain output rather than using a broken link *}
-       @{$username}
+       <span class="userMention">{$username}</span>
 {else}
-       {* non-breaking space below to prevent wrapping of user avatar and username *}
-       <a href="{link controller='User' object=$userProfile->getDecoratedObject()}{/link}">{@$userProfile->getAvatar()->getImageTag(16)}&nbsp;{$userProfile->username}</a>
+       <a href="{link controller='User' object=$userProfile->getDecoratedObject()}{/link}" class="userMention userLink" data-user-id="{@$userProfile->userID}">{$userProfile->username}</a>
 {/if}
index d8bc47be60baf21eccacdd2d5a4501292926e39b..7b00ec22d9275aec019b95eaa3566944fe3a5c8f 100644 (file)
@@ -25,9 +25,6 @@ class UserBBCode extends AbstractBBCode {
                
                /** @var UserProfile $userProfile */
                $userProfile = MessageEmbeddedObjectManager::getInstance()->getObject('com.woltlab.wcf.user', $userID);
-               if ($userProfile === null) {
-                       return '@'.$content;
-               }
                
                return WCF::getTPL()->fetch('userBBCodeTag', 'wcf', [
                        'username' => $content,
diff --git a/wcfsetup/install/files/style/bbcode/userMention.scss b/wcfsetup/install/files/style/bbcode/userMention.scss
new file mode 100644 (file)
index 0000000..7c9ff03
--- /dev/null
@@ -0,0 +1,9 @@
+.userMention {
+       background-color: $wcfSidebarBackground;
+       border-radius: 2px;
+       padding: 2px 5px;
+       
+       &::before {
+               content: '@';
+       }
+}