From 99d86d74e07f2e054f168dc1494acdf448e2597a Mon Sep 17 00:00:00 2001 From: Felix Niklas Date: Thu, 6 Nov 2014 16:18:22 +0100 Subject: [PATCH] rewrite avatar first param: 40, 50 or 80 depricated avatar class: 'big' new avatar classes: size-40 (default, equal to no additional avatar class), size-50 and size-80 --- .../app/controllers/layout_ref.js.coffee | 16 ++++++++++++- .../javascripts/app/models/user.js.coffee | 16 ++++++------- .../layout_ref/communication_overview.jst.eco | 2 +- .../app/views/layout_ref/content.jst.eco | 24 ++++++++++++++++--- .../layout_ref/content_sidebar_right.jst.eco | 6 ----- .../app/views/profile/avatar-holder.jst.eco | 2 +- .../app/views/profile/avatar.jst.eco | 6 ++--- .../javascripts/app/views/ticket_zoom.jst.eco | 2 +- .../views/ticket_zoom/article_view.jst.eco | 2 +- .../app/views/ticket_zoom/edit.jst.eco | 2 +- .../javascripts/app/views/widget/user.jst.eco | 2 +- app/assets/stylesheets/zammad.css.scss | 19 +++++++++++---- 12 files changed, 68 insertions(+), 31 deletions(-) diff --git a/app/assets/javascripts/app/controllers/layout_ref.js.coffee b/app/assets/javascripts/app/controllers/layout_ref.js.coffee index 7e5831f3e..e446e71a0 100644 --- a/app/assets/javascripts/app/controllers/layout_ref.js.coffee +++ b/app/assets/javascripts/app/controllers/layout_ref.js.coffee @@ -24,7 +24,10 @@ class Content extends App.ControllerContent for avatar in @$('.user.avatar') avatar = $(avatar) - size = if avatar.hasClass('big') then 50 else 40 + size = switch + when avatar.hasClass('size-80') then 80 + when avatar.hasClass('size-50') then 50 + else 40 @createUniqueAvatar avatar, size, avatar.data('firstname'), avatar.data('lastname'), avatar.data('userid') createUniqueAvatar: (holder, size, firstname, lastname, id) -> @@ -576,4 +579,15 @@ class ImportWizard extends App.ControllerContent App.Config.set( 'layout_ref/import_wizard', ImportWizard, 'Routes' ) +class UserZoom extends App.ControllerContent + + constructor: -> + super + @render() + + render: -> + @html App.view('layout_ref/user_zoom')() + +App.Config.set( 'layout_ref/user_zoom', UserZoom, 'Routes' ) + App.Config.set( 'LayoutRef', { prio: 1700, parent: '#current_user', name: 'Layout Reference', target: '#layout_ref', role: [ 'Admin' ] }, 'NavBarRight' ) diff --git a/app/assets/javascripts/app/models/user.js.coffee b/app/assets/javascripts/app/models/user.js.coffee index 19625a39c..0734eefea 100644 --- a/app/assets/javascripts/app/models/user.js.coffee +++ b/app/assets/javascripts/app/models/user.js.coffee @@ -52,24 +52,24 @@ class App.User extends App.Model else return '??' - avatar: (big = false, placement = '', cssClass = '') -> - if big - cssClass += ' big' + avatar: (size = 40, placement = '', cssClass = '') -> + cssClass += " size-#{ size }" + if placement placement = "data-placement=\"#{placement}\"" if @image is 'none' - return @uniqueAvatar(big, placement, cssClass) + return @uniqueAvatar(size, placement, cssClass) else "" - uniqueAvatar: (big = false, placement = '', cssClass = '') -> - if big - cssClass += ' big' + uniqueAvatar: (size = 40, placement = '', cssClass = '') -> + if size and !cssClass + cssClass += " size-#{ size }" width = 300 height = 226 - size = if big then 50 else 40 + size = parseInt(size, 10) rng = new Math.seedrandom(@id) x = rng() * (width - size) diff --git a/app/assets/javascripts/app/views/layout_ref/communication_overview.jst.eco b/app/assets/javascripts/app/views/layout_ref/communication_overview.jst.eco index 5f5448bb1..7fb82e5ab 100644 --- a/app/assets/javascripts/app/views/layout_ref/communication_overview.jst.eco +++ b/app/assets/javascripts/app/views/layout_ref/communication_overview.jst.eco @@ -32,7 +32,7 @@