From ecf187393becc7dc613b4fd1322e40eb58f9f0fd Mon Sep 17 00:00:00 2001 From: kondou Date: Fri, 30 Aug 2013 09:00:37 +0200 Subject: Finish cropper, Get rid of TODOs, Improve \OCP\Avatar and "fix" unitests --- core/js/jquery.avatar.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'core/js/jquery.avatar.js') diff --git a/core/js/jquery.avatar.js b/core/js/jquery.avatar.js index f6181e1c9e2..bd57a542fa7 100644 --- a/core/js/jquery.avatar.js +++ b/core/js/jquery.avatar.js @@ -6,17 +6,17 @@ */ (function ($) { - $.fn.avatar = function(user, height) { - // TODO there has to be a better way … - if (typeof(height) === 'undefined') { - height = this.height(); - } - if (height === 0) { - height = 64; + $.fn.avatar = function(user, size) { + if (typeof(size) === 'undefined') { + if (this.height() > 0) { + size = this.height(); + } else { + size = 64; + } } - this.height(height); - this.width(height); + this.height(size); + this.width(size); if (typeof(user) === 'undefined') { this.placeholder('x'); @@ -25,12 +25,12 @@ var $div = this; - //$.get(OC.Router.generate('core_avatar_get', {user: user, size: height}), function(result) { // TODO does not work "Uncaught TypeError: Cannot use 'in' operator to search for 'core_avatar_get' in undefined" router.js L22 - $.get(OC.router_base_url+'/avatar/'+user+'/'+height, function(result) { + //$.get(OC.Router.generate('core_avatar_get', {user: user, size: size}), function(result) { // TODO does not work "Uncaught TypeError: Cannot use 'in' operator to search for 'core_avatar_get' in undefined" router.js L22 + $.get(OC.router_base_url+'/avatar/'+user+'/'+size, function(result) { if (typeof(result) === 'object') { $div.placeholder(result.user); } else { - $div.html(''); + $div.html(''); } }); }; -- cgit v1.2.3