summaryrefslogtreecommitdiffstats
path: root/core/js
diff options
context:
space:
mode:
Diffstat (limited to 'core/js')
-rw-r--r--core/js/avatar.js4
-rw-r--r--core/js/jquery.avatar.js24
2 files changed, 14 insertions, 14 deletions
diff --git a/core/js/avatar.js b/core/js/avatar.js
index 22ebf295999..afcd7e9f2ce 100644
--- a/core/js/avatar.js
+++ b/core/js/avatar.js
@@ -4,7 +4,7 @@ $(document).ready(function(){
$('#avatar .avatardiv').avatar(OC.currentUser, 128);
// User settings
$.each($('td.avatar .avatardiv'), function(i, data) {
- $(data).avatar($(data).parent().parent().data('uid'), 32); // TODO maybe a better way of getting the current name …
+ $(data).avatar($(data).parent().parent().data('uid'), 32); // TODO maybe a better way of getting the current name … – may be fixed by new-user-mgmt
});
- // TODO when creating a new user, he gets a previously used avatar
+ // TODO when creating a new user, he gets a previously used avatar – may be fixed by new user-mgmt
});
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('<img src="'+OC.Router.generate('core_avatar_get', {user: user, size: height})+'">');
+ $div.html('<img src="'+OC.Router.generate('core_avatar_get', {user: user, size: size})+'">');
}
});
};