Update user account removeFn

As I did not realise both groups and users call the same
coverPhoto lib, the removeFn has to be in the user client js,
and not in the coverPhoto lib.

... of course, it *could* be in there, but it would be hacky.
v1.18.x
Julian Lam 9 years ago
parent 04894b549a
commit 92be63ebe6

@ -68,7 +68,8 @@ define('forum/account/header', [
uploader.open(RELATIVE_PATH + '/api/user/' + ajaxify.data.userslug + '/uploadcover', { uid: yourid }, 0, function(imageUrlOnServer) {
components.get('account/cover').css('background-image', 'url(' + imageUrlOnServer + ')');
});
}
},
removeCover
);
}
@ -132,5 +133,17 @@ define('forum/account/header', [
});
}
function removeCover() {
socket.emit('user.removeCover', {
uid: ajaxify.data.uid
}, function(err) {
if (!err) {
ajaxify.refresh();
} else {
app.alertError(err.message);
}
});
}
return AccountHeader;
});

@ -10,7 +10,7 @@ define('coverPhoto', [
saveFn: null
};
coverPhoto.init = function(coverEl, saveFn, uploadFn) {
coverPhoto.init = function(coverEl, saveFn, uploadFn, removeFn) {
coverPhoto.coverEl = coverEl;
coverPhoto.saveFn = saveFn;
@ -23,7 +23,7 @@ define('coverPhoto', [
units: 'percent'
});
});
coverEl.find('.remove').on('click', coverPhoto.remove);
coverEl.find('.remove').on('click', removeFn);
coverEl
.on('dragover', coverPhoto.onDragOver)
@ -80,17 +80,5 @@ define('coverPhoto', [
});
};
coverPhoto.remove = function() {
socket.emit('user.removeCover', {
uid: ajaxify.data.uid
}, function(err) {
if (!err) {
ajaxify.refresh();
} else {
app.alertError(err.message);
}
});
};
return coverPhoto;
});
Loading…
Cancel
Save