Redo of fullLocal() in fullLocal() of other object to prevent loops. Added instance methode imageUrl() to user object.
This commit is contained in:
parent
7a1749065c
commit
fa3dd90ac6
4 changed files with 12 additions and 9 deletions
|
@ -2,9 +2,8 @@ App.Config.set( 'User', {
|
|||
prio: 1000,
|
||||
parent: '',
|
||||
callback: ->
|
||||
item = {}
|
||||
item['name'] = App.Session.get( 'login' )
|
||||
item['image'] = App.Session.get( 'imageUrl' )
|
||||
item = {}
|
||||
item['name'] = App.Session.get( 'login' )
|
||||
if App.Session.get()
|
||||
item['avatar'] = App.Session.get().avatar()
|
||||
return item
|
||||
|
|
|
@ -27,6 +27,6 @@ class App.Organization extends App.Model
|
|||
data['members'] = []
|
||||
for user_id in data['member_ids']
|
||||
if App.User.exists( user_id )
|
||||
user = App.User.fullLocal( user_id )
|
||||
user = App.User.find( user_id )
|
||||
data['members'].push user
|
||||
data
|
||||
|
|
|
@ -63,7 +63,8 @@ class App.User extends App.Model
|
|||
else
|
||||
if @vip
|
||||
cssClass += " vip"
|
||||
"<span class=\"avatar user-popover #{cssClass}\" data-id=\"#{@id}\" style=\"background-image: url(#{ @imageUrl })\" #{placement}></span>"
|
||||
image = @imageUrl()
|
||||
"<span class=\"avatar user-popover #{cssClass}\" data-id=\"#{@id}\" style=\"background-image: url(#{image})\" #{placement}></span>"
|
||||
|
||||
uniqueAvatar: (size, placement = '', cssClass = '', avatar) ->
|
||||
width = 300
|
||||
|
@ -84,6 +85,12 @@ class App.User extends App.Model
|
|||
cssClass += " vip"
|
||||
"<span class=\"avatar unique #{cssClass}\" #{data} style=\"background-position: -#{ x }px -#{ y }px;\" #{placement}>#{ @initials() }</span>"
|
||||
|
||||
imageUrl: ->
|
||||
return if !@image
|
||||
# set image url
|
||||
@constructor.apiPath + '/users/image/' + @image
|
||||
|
||||
|
||||
@_fillUp: (data) ->
|
||||
|
||||
# set socal media links
|
||||
|
@ -94,9 +101,6 @@ class App.User extends App.Model
|
|||
if account == 'facebook'
|
||||
data['accounts'][account]['link'] = 'https://www.facebook.com/profile.php?id=' + data['accounts'][account]['uid']
|
||||
|
||||
# set image url
|
||||
data.imageUrl = @apiPath + '/users/image/' + data.image
|
||||
|
||||
if data.organization_id
|
||||
data.organization = App.Organization.find(data.organization_id)
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<input type="checkbox" value="<%= ticket.id %>" name="bulk" class="pull-left"/>
|
||||
</td>
|
||||
<td class="span1">
|
||||
<img class="thumbnail user-popover" data-id="<%= ticket.customer_id %>" src="<%= ticket.customer.imageUrl %>" alt="">
|
||||
<img class="thumbnail user-popover" data-id="<%= ticket.customer_id %>" src="<%- ticket.customer.imageUrl() %>" alt="">
|
||||
</td>
|
||||
<td class="span10">
|
||||
<h3><a href="#" data-type="edit"><%= ticket.title %></a> <small><%= ticket.number %> <span class="humanTimeFromNow" data-time="<%= ticket.created_at %>">?</span></small></h3>
|
||||
|
|
Loading…
Reference in a new issue