mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-24 03:33:27 +00:00
Build chat message styles on the controller side (allowing for extra parameters).
This commit is contained in:
parent
9deddcf2a8
commit
ca68f01a9d
2 changed files with 10 additions and 6 deletions
|
@ -35,12 +35,9 @@ aside.chat(
|
|||
span(ng-if="message.user.first_name") {{ message.user.first_name }}
|
||||
span(ng-if="!message.user.first_name") {{ message.user.email }}
|
||||
.message(
|
||||
ng-style="{\
|
||||
'border-color': 'hsl({{ hue(message.user) }}, 70%, 70%)',\
|
||||
'background-color': 'hsl({{ hue(message.user) }}, 60%, 97%)'\
|
||||
}"
|
||||
ng-style="getMessageStyle(message.user);"
|
||||
)
|
||||
.arrow(ng-style="{'border-color': 'hsl({{ hue(message.user) }}, 70%, 70%)'}")
|
||||
.arrow(ng-style="getArrowStyle(message.user)")
|
||||
.message-content
|
||||
p(
|
||||
mathjax,
|
||||
|
|
|
@ -3,9 +3,16 @@ define [
|
|||
"ide/colors/ColorManager"
|
||||
], (App, ColorManager) ->
|
||||
App.controller "ChatMessageController", ["$scope", "ide", ($scope, ide) ->
|
||||
$scope.hue = (user) ->
|
||||
hue = (user) ->
|
||||
if !user?
|
||||
return 0
|
||||
else
|
||||
return ColorManager.getHueForUserId(user.id)
|
||||
|
||||
$scope.getMessageStyle = (user) ->
|
||||
"border-color" : "hsl(#{ hue(user) }, 70%, 70%)"
|
||||
"background-color" : "hsl(#{ hue(user) }, 60%, 97%)"
|
||||
|
||||
$scope.getArrowStyle = (user) ->
|
||||
"border-color" : "hsl(#{ hue(user) }, 70%, 70%)"
|
||||
]
|
Loading…
Reference in a new issue