Disabled user popover for avatar in footer of navbar. Removed vip icon for avatar in footer of navbar.

This commit is contained in:
Martin Edenhofer 2015-09-15 22:36:52 +02:00
parent e8f1f9b3db
commit 333e8fb415
6 changed files with 32 additions and 25 deletions

View file

@ -4,9 +4,7 @@ App.Config.set('User', {
parent: '',
callback: ->
item = {}
item['name'] = App.Session.get( 'login' )
if App.Session.get()
item['avatar'] = App.Session.get().avatar()
item['name'] = App.Session.get('login')
return item
target: '#current_user',
class: 'user'

View file

@ -91,7 +91,7 @@ class App.Navigation extends App.ControllerWidgetPermanent
new App.WidgetAvatar(
el: @$('.js-avatar')
user_id: App.Session.get('id')
noPopups: true
type: 'personal'
)
renderResult: (result = []) =>

View file

@ -3,7 +3,7 @@ class App.WidgetAvatar extends App.Controller
super
# subscribe and reload data / fetch new data if triggered
@subscribeId = App.User.full( @user_id, @render, false, true )
@subscribeId = App.User.full(@user_id, @render, false, true)
release: =>
App.User.unsubscribe(@subscribeId)
@ -13,8 +13,8 @@ class App.WidgetAvatar extends App.Controller
user: user
size: @size
position: @position
type: @type
)
# start user popups
if !@noPopups
@userPopups(@position)
@userPopups(@position)

View file

@ -53,49 +53,58 @@ class App.User extends App.Model
else
return '??'
avatar: (size = 40, placement = '', cssClass = '', unique = false, avatar) ->
avatar: (size = 40, placement = '', cssClass = '', unique = false, avatar, type = undefined) ->
cssClass += " size-#{size}"
if placement
placement = "data-placement=\"#{placement}\""
# use generated avatar
if !@image || @image is 'none' || unique
return @uniqueAvatar(size, placement, cssClass, avatar)
return @uniqueAvatar(size, placement, cssClass, avatar, type)
# use image as avatar
image = @imageUrl()
vip = @vip
if type is 'personal'
vip = false
else
image = @imageUrl()
cssClass += ' user-popover'
# TODO: don't show vip when its the avatar of the logged-in user
if @vip
return "<span class=\"avatar user-popover #{cssClass}\" data-id=\"#{@id}\" style=\"background-image: url(#{image})\" #{placement}><svg class='icon icon-crown'><use xlink:href='#icon-crown'></svg></span>"
else
return "<span class=\"avatar user-popover #{cssClass}\" data-id=\"#{@id}\" style=\"background-image: url(#{image})\" #{placement}></span>"
if vip
return "<span class=\"avatar #{cssClass}\" data-id=\"#{@id}\" style=\"background-image: url(#{image})\" #{placement}><svg class='icon icon-crown'><use xlink:href='#icon-crown'></svg></span>"
"<span class=\"avatar #{cssClass}\" data-id=\"#{@id}\" style=\"background-image: url(#{image})\" #{placement}></span>"
uniqueAvatar: (size, placement = '', cssClass = '', avatar) ->
uniqueAvatar: (size, placement = '', cssClass = '', avatar, type) ->
width = 300
height = 226
size = parseInt(size, 10)
vip = @vip
rng = new Math.seedrandom(@id)
x = rng() * (width - size)
y = rng() * (height - size)
if !avatar
cssClass += " user-popover"
data = "data-id=\"#{@id}\""
if type is 'personal'
vip = false
data = "data-id=\"#{@id}\""
else
cssClass += " user-popover"
data = "data-id=\"#{@id}\""
else
data = "data-avatar-id=\"#{avatar.id}\""
vip = false
data = "data-avatar-id=\"#{avatar.id}\""
if @vip
if vip
return "<span class=\"avatar unique #{cssClass}\" #{data} style=\"background-position: -#{ x }px -#{ y }px;\" #{placement}><svg class='icon icon-crown'><use xlink:href='#icon-crown'></svg>#{ @initials() }</span>"
else
return "<span class=\"avatar unique #{cssClass}\" #{data} style=\"background-position: -#{ x }px -#{ y }px;\" #{placement}>#{ @initials() }</span>"
"<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

View file

@ -1 +1 @@
<%- @user.avatar(@size, @position, @class) %>
<%- @user.avatar(@size, @position, @class, false, false, @type) %>

View file

@ -1,5 +1,5 @@
<div class="avatar-holder">
<span class="avatar size-50" data-avatar-id="<%- @avatar.id %>" style="background-image: url(<%- @src %>)"></span>
<span class="avatar size-80" data-avatar-id="<%- @avatar.id %>" style="background-image: url(<%- @src %>)"></span>
<div class="avatar-delete">
<%- @Icon('diagonal-cross') %>
</div>