Files
habitica/public/js/controllers/userCtrl.js
Tyler Renelle aad034564e [#1459] add profile-editing (note, it requires bluring the input fields for
changes to go through - this is a pretty assuming solution, but I doubt it
will cause problems)
2013-09-08 12:28:06 -04:00

22 lines
679 B
JavaScript

"use strict";
habitrpg.controller("UserCtrl", ['$scope', '$location', 'User',
function($scope, $location, User) {
$scope.profile = User.user;
$scope.hideUserAvatar = function() {
$(".userAvatar").hide();
};
$scope.toggleHelm = function(val){
User.log({op:'set', data:{'preferences.showHelm':val}});
}
$scope.addWebsite = function(){
if (!User.user.profile.websites) User.user.profile.websites = [];
User.user.profile.websites.push($scope._newWebsite);
User.set('profile.websites', User.user.profile.websites);
$scope._newWebsite = '';
}
$scope.removeWebsite = function($index){
User.user.profile.websites.splice($index,1);
}
}]);