1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-22 21:40:08 +00:00

Further message template improvements

- Publish message types to JavaScript
- add message type icons
- style info message properly
This commit is contained in:
Maximilian Mader 2013-06-24 17:45:46 +02:00
parent c3dd2c899b
commit 5fd1e6e7be
4 changed files with 49 additions and 39 deletions

View File

@ -420,7 +420,10 @@ Insert the given messages into the chat stream.
if createNewMessage if createNewMessage
message.isFollowUp = no message.isFollowUp = no
output = v.messageTemplate.fetch message output = v.messageTemplate.fetch
'message': message
'messageTypes': v.config.messageTypes
li = $ '<li></li>' li = $ '<li></li>'
li.addClass 'timsChatMessage' li.addClass 'timsChatMessage'
li.addClass "timsChatMessage#{message.type}" li.addClass "timsChatMessage#{message.type}"
@ -431,7 +434,10 @@ Insert the given messages into the chat stream.
li.appendTo $ '#timsChatMessageContainer > ul' li.appendTo $ '#timsChatMessageContainer > ul'
else else
message.isFollowUp = yes message.isFollowUp = yes
output = v.messageTemplate.fetch message output = v.messageTemplate.fetch
'message': message
'messageTypes': v.config.messageTypes
$('.timsChatMessage:last-child .text').append $(output).find('.text li:last-child') $('.timsChatMessage:last-child .text').append $(output).find('.text li:last-child')
lastMessage = message lastMessage = message

View File

@ -89,6 +89,7 @@ public function assignVariables() {
'roomID' => $this->roomID, 'roomID' => $this->roomID,
'rooms' => $this->rooms, 'rooms' => $this->rooms,
'commands' => $this->commands, 'commands' => $this->commands,
'messageTypes' => (new \ReflectionClass('\chat\data\message\Message'))->getConstants(),
'defaultSmilies' => $this->defaultSmilies, 'defaultSmilies' => $this->defaultSmilies,
'smileyCategories' => $this->smileyCategories, 'smileyCategories' => $this->smileyCategories,
'sidebarCollapsed' => \wcf\system\user\collapsible\content\UserCollapsibleContentHandler::getInstance()->isCollapsed('com.woltlab.wcf.collapsibleSidebar', 'be.bastelstu.chat.ChatPage'), 'sidebarCollapsed' => \wcf\system\user\collapsible\content\UserCollapsibleContentHandler::getInstance()->isCollapsed('com.woltlab.wcf.collapsibleSidebar', 'be.bastelstu.chat.ChatPage'),

View File

@ -34,7 +34,8 @@
{ {
reloadTime: {@CHAT_RELOADTIME}, reloadTime: {@CHAT_RELOADTIME},
messageURL: '{link application="chat" controller="NewMessages"}{/link}', messageURL: '{link application="chat" controller="NewMessages"}{/link}',
installedCommands: [ {implode from=$commands item='command'}'{$command|encodeJS}'{/implode} ] installedCommands: [ {implode from=$commands item='command'}'{$command|encodeJS}'{/implode} ],
messageTypes: { {implode from=$messageTypes key='name' item='messageType'}'{$name|substr:5|encodeJS}': {$messageType|encodeJS}{/implode} }
}, },
new WCF.Template('{literal}{if $newMessageCount}({#$newMessageCount}) {/if}{$title} - {/literal}{"chat.general.title"|language|encodeJS} - {PAGE_TITLE|language|encodeJS}'), new WCF.Template('{literal}{if $newMessageCount}({#$newMessageCount}) {/if}{$title} - {/literal}{"chat.general.title"|language|encodeJS} - {PAGE_TITLE|language|encodeJS}'),
new WCF.Template('{@$messageTemplate|encodeJS}'), new WCF.Template('{@$messageTemplate|encodeJS}'),
@ -60,27 +61,6 @@
})(jQuery, this); })(jQuery, this);
//]]> //]]>
</script> </script>
<!--<style type="text/css">
/*<![CDATA[*/
.timsChatMessage::before {
content: "";
}
{assign var='type' value='\chat\data\message\Message::TYPE_'}
.timsChatMessage{$type|concat:'JOIN'|constant}::before {
content: "\f090";
}
.timsChatMessage{$type|concat:'LEAVE'|constant}::before {
content: "\f08b";
}
.timsChatMessage{$type|concat:'INFORMATION'|constant}::before {
content: "\f05a";
}
/*]]>*/
</style>-->
</head> </head>
<body id="tpl{$templateName|ucfirst}"> <body id="tpl{$templateName|ucfirst}">
@ -112,7 +92,7 @@
{include file='messageFormSmilies' wysiwygSelector=''} {include file='messageFormSmilies' wysiwygSelector=''}
{/if} {/if}
<nav id="timsChatOptions" class="marginTop buttonGroupNavigation"> <nav id="timsChatOptions" class="marginTop jsMobileNavigation buttonGroupNavigation">
<span class="invisible">{lang}chat.general.controls{/lang}</span> <span class="invisible">{lang}chat.general.controls{/lang}</span>
<ul class="smallButtons buttonGroup"> <ul class="smallButtons buttonGroup">
<li><a id="timsChatAutoscroll" accesskey="d" class="button active timsChatToggle jsTooltip" title="{lang}chat.general.scroll{/lang}" data-status="1"><span class="icon icon16 icon-arrow-down"></span><span class="invisible">{lang}chat.general.scroll{/lang}</span></a></li>{* <li><a id="timsChatAutoscroll" accesskey="d" class="button active timsChatToggle jsTooltip" title="{lang}chat.general.scroll{/lang}" data-status="1"><span class="icon icon16 icon-arrow-down"></span><span class="invisible">{lang}chat.general.scroll{/lang}</span></a></li>{*

View File

@ -1,31 +1,54 @@
{literal} {literal}
<div class="innerMessageContainer{if $type == 0 || $type == 7} bubble{/if}"> <div class="messageIcon">
{if $message.type == $messageTypes.LEAVE || $message.type == $messageTypes.JOIN}
<span class="icon icon16 icon-{if $message.type == $messageTypes.LEAVE}signout{else}signin{/if}"></span>
{/if}
</div>
<div class="innerMessageContainer{if $message.type == $messageTypes.NORMAL || $message.type == $messageTypes.WHISPER || $message.type == $messageTypes.INFORMATION} bubble{/if}{if $message.type == $messageTypes.WHISPER && $message.sender != $__wcf.User.userID} right{/if}">
<div class="userAvatar framed"> <div class="userAvatar framed">
{if $type == 0 || $type == 7} {if $message.type != $messageTypes.INFORMATION}
{@$avatar[32]} {if $message.type == $messageTypes.NORMAL || $message.type == $messageTypes.WHISPER}
{@$message.avatar[32]}
{else} {else}
{@$avatar[16]} {@$message.avatar[16]}
{/if}
{else}
<span class="icon icon32 icon-info-sign"></span>
{/if} {/if}
</div> </div>
<div class="innerMessage"> <div class="innerMessage">
<span class="username"> <span class="username">
{@$formattedUsername} {if ($message.type == $messageTypes.WHISPER && $message.sender == WCF.User.userID) || $message.type != $messageTypes.WHISPER}
{if $type == 7} {@$message.formattedUsername}
<span class="icon icon16 icon-double-angle-right jsTooltip" title="{/literal}{lang}chat.ui.whispers{/lang}{literal}" onclick="be.bastelstu.Chat.insertText('/whisper {if $receiver == WCF.User.userID}{$username.replace("\\", "\\\\").replace("'", "\\'")}{else}{$additionalData.receiverUsername.replace("\\", "\\\\").replace("'", "\\'")}{/if}, ', { append: false });"></span> {else}
{$additionalData.receiverUsername} {$message.additionalData.receiverUsername}
{/if}
{if $message.type == $messageTypes.WHISPER}
<span class="icon icon16 icon-double-angle-{if $message.sender == WCF.User.userID}right{else}left{/if} jsTooltip" title="{/literal}{lang}chat.ui.whispers{/lang}{literal}" onclick="be.bastelstu.Chat.insertText('/whisper {if $message.receiver == WCF.User.userID}{$message.username.replace("\\", "\\\\").replace("'", "\\'")}{else}{$message.additionalData.receiverUsername.replace("\\", "\\\\").replace("'", "\\'")}{/if}, ', { append: false });"></span>
{if ($message.type == $messageTypes.WHISPER && $message.sender == WCF.User.userID) || $message.type != $messageTypes.WHISPER}
{$message.additionalData.receiverUsername}
{else}
{@$message.formattedUsername}
{/if}
{/if} {/if}
</span> </span>
<time>{@$formattedTime}</time>
{if $type == 0 || $type == 7} <time>{@$message.formattedTime}</time>
<ul>
<li class="text">{@$formattedMessage}</li> {if $message.type == $messageTypes.NORMAL || $message.type == $messageTypes.WHISPER}
<ul class="text">
<li>
{if $message.isFollowUp} <time>{@$message.formattedTime}</time>{/if}
{@$message.formattedMessage}
</li>
</ul> </ul>
{else} {else}
<span class="text">{@$formattedMessage}</span> <span class="text">{@$message.formattedMessage}</span>
{/if} {/if}
</div> </div>
<span class="markContainer"> <span class="markContainer">
<input type="checkbox" value="{@$messageID}" /> <input type="checkbox" value="{@$message.messageID}" />
</span> </span>
</div> </div>
{/literal} {/literal}