Implemented new avatars.

This commit is contained in:
Martin Edenhofer 2014-09-20 01:10:06 +02:00
parent 72a25356fa
commit 0eb7680f3b
10 changed files with 40 additions and 13 deletions

View file

@ -49,7 +49,7 @@ class App.DashboardActivityStream extends App.Controller
@html html @html html
# start user popups # start user popups
@userPopups('right') @userPopups('left')
# update time # update time
@frontendTimeUpdate() @frontendTimeUpdate()

View file

@ -3,8 +3,9 @@ App.Config.set( 'User', {
parent: '', parent: '',
callback: -> callback: ->
item = {} item = {}
item['name'] = App.Session.get( 'login' ) item['name'] = App.Session.get( 'login' )
item['image'] = App.Session.get( 'imageUrl' ) item['image'] = App.Session.get( 'imageUrl' )
item['avatar'] = App.User.fullLocal( App.Session.get('id') ).avatar()
return item return item
target: '#current_user', target: '#current_user',
class: 'user' class: 'user'

View file

@ -36,6 +36,28 @@ class App.User extends App.Model
icon: (user) -> icon: (user) ->
"user icon" "user icon"
initials: ->
@firstname[0] + @lastname[0]
avatar: (big = false, placement = '', cssClass = '') ->
if big
cssClass = ' big'
if placement
placement = "data-placement=\"#{placement}\""
if @image is 'none'
width = 300
height = 226
size = if big then 50 else 40
rng = new Math.seedrandom(@id)
x = rng() * (width - size)
y = rng() * (height - size)
"<span class=\"avatar unique user-popover #{cssClass}\" data-id=\"#{@id}\" style=\"background-position: -#{ x }px -#{ y }px;\" #{placement}>#{ @initials() }</span>"
else
"<span class=\"avatar user-popover #{cssClass}\" data-id=\"#{@id}\" style=\"background-image: url(#{ @imageUrl })\" #{placement}></span>"
@_fillUp: (data) -> @_fillUp: (data) ->
# set socal media links # set socal media links

View file

@ -1,8 +1,8 @@
<h2 class="can-move"><%- @T( @head ) %></h2> <h2 class="can-move"><%- @T( @head ) %></h2>
<% for item in @items: %> <% for item in @items: %>
<div class="activity-entry horizontal"> <div class="activity-entry horizontal">
<a class="activity-avatar user-popover" data-id="<%= item.created_by_id %>" href="<%- item.created_by.uiUrl() %>"> <a class="activity-avatar" href="<%- item.created_by.uiUrl() %>">
<span class="avatar" style="background-image: url(<%- item.created_by.imageUrl %>)"></span> <%- item.created_by.avatar() %>
</a> </a>
<a href="<%- item.link %>" class="activity-body flex horizontal"> <a href="<%- item.link %>" class="activity-body flex horizontal">
<span class="activity-message flex"> <span class="activity-message flex">

View file

@ -4,7 +4,7 @@
<a class="list-button horizontal centered dropdown-toggle" data-toggle="dropdown" href="<%= item.target %>" title="<%- @T( item.name ) %>"> <a class="list-button horizontal centered dropdown-toggle" data-toggle="dropdown" href="<%= item.target %>" title="<%- @T( item.name ) %>">
<span class="dropdown-nose"></span> <span class="dropdown-nose"></span>
<% if item.class is 'user': %> <% if item.class is 'user': %>
<span class="user avatar" style="background-image: url(<%- item.image %>)"></span> <%- item.avatar %>
<% else: %> <% else: %>
<span class="green plus icon"></span> <span class="green plus icon"></span>
<span class="white plus icon"></span> <span class="white plus icon"></span>

View file

@ -4,7 +4,7 @@
<div class="ticketZoom"> <div class="ticketZoom">
<div class="page-header horizontal"> <div class="page-header horizontal">
<div class="flex vertical center"> <div class="flex vertical center">
<div class="big avatar user-popover" data-id="<%- @ticket.customer.id %>" style="background-image: url(<%- @ticket.customer.imageUrl %>)"></div> <%- @ticket.customer.avatar(true) %>
<div class="ticket-title"></div> <div class="ticket-title"></div>
</div> </div>
<div class="page-header-meta"> <div class="page-header-meta">

View file

@ -34,7 +34,12 @@
</div> </div>
<div class="article-content zIndex-1 horizontal<%= ' reverse' if article.sender.name isnt 'Agent' %>"> <div class="article-content zIndex-1 horizontal<%= ' reverse' if article.sender.name isnt 'Agent' %>">
<div class="avatar user-popover" data-placement="<% if article.sender.name isnt 'Agent': %>left<% else: %>right<% end %>" data-id="<%= article.created_by_id %>" style="background-image: url(<%= article.created_by.imageUrl %>)"></div> <% if article.sender.name isnt 'Agent': %>
<% position = 'left' %>
<% else: %>
<% position = 'right' %>
<% end %>
<%- article.created_by.avatar(false, position) %>
<div class="flex bubble-gap internal-border"> <div class="flex bubble-gap internal-border">
<div class="text-bubble"><div class="bubble-arrow"></div><%- article.html %></div> <div class="text-bubble"><div class="bubble-arrow"></div><%- article.html %></div>
</div> </div>

View file

@ -1,7 +1,7 @@
<form class="ticket-update <% if @formChanged: %>form-changed<% end %>"> <form class="ticket-update <% if @formChanged: %>form-changed<% end %>">
<div class="bubble-grid horizontal"> <div class="bubble-grid horizontal">
<div class="vertical center edit-controls"> <div class="vertical center edit-controls">
<div class="avatar user-popover zIndex-5" data-id="<%= @S('id') %>" style="background-image: url(<%- @S('imageUrl') %>)"></div> <%- App.User.fullLocal( @S('id') ).avatar(false, 'right', 'zIndex-5') %>
<div class="dark pop-select zIndex-7 edit-control-item"> <div class="dark pop-select zIndex-7 edit-control-item">
<div class="pop-selected u-clickable centered"> <div class="pop-selected u-clickable centered">
<div class="gray <%- @type %> channel icon"></div> <div class="gray <%- @type %> channel icon"></div>

View file

@ -1,7 +1,7 @@
<% for item in @items: %> <% for item in @items: %>
<div class="activity-entry horizontal"> <div class="activity-entry horizontal">
<a class="activity-avatar user-popover" data-id="<%= item.created_by_id %>" href="<%- item.created_by.uiUrl() %>"> <a class="activity-avatar user-popover" data-id="<%= item.created_by_id %>" href="<%- item.created_by.uiUrl() %>">
<span class="avatar" style="background-image: url(<%- item.created_by.imageUrl %>)"></span> <%- item.created_by.avatar() %>
</a> </a>
<a href="<%- item.link %>" class="activity-body flex horizontal"> <a href="<%- item.link %>" class="activity-body flex horizontal">
<span class="activity-message flex"> <span class="activity-message flex">

View file

@ -1,8 +1,7 @@
<div class="user-info"> <div class="user-info">
<% if @user.imageUrl: %> <%- @user.avatar(true) %>
<div class="big avatar" style="background-image: url(<%- @user.imageUrl %>)"></div>
<% end %>
<div class="customer-info" title="<%- @Ti( 'Name') %>"><%= @user.displayName() %></div> <div class="customer-info" title="<%- @Ti( 'Name') %>"><%= @user.displayName() %></div>
<% for row in @userData: %> <% for row in @userData: %>
<% if @user[row.name] || row.name is 'note': %> <% if @user[row.name] || row.name is 'note': %>