mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
initial grunt support, gzip enabled
This commit is contained in:
39
public/js/controllers/settingsCtrl.js
Normal file
39
public/js/controllers/settingsCtrl.js
Normal file
@@ -0,0 +1,39 @@
|
||||
'use strict';
|
||||
|
||||
// Make user and settings available for everyone through root scope.
|
||||
habitrpg.controller('SettingsCtrl',
|
||||
['$scope', 'User', '$rootScope', '$http', 'API_URL',
|
||||
function($scope, User, $rootScope, $http, API_URL) {
|
||||
|
||||
// FIXME we have this re-declared everywhere, figure which is the canonical version and delete the rest
|
||||
// $scope.auth = function (id, token) {
|
||||
// User.authenticate(id, token, function (err) {
|
||||
// if (!err) {
|
||||
// alert('Login successful!');
|
||||
// $location.path("/habit");
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
$scope.saveDayStart = function(){
|
||||
var dayStart = +User.user.preferences.dayStart;
|
||||
if (dayStart < 0 || dayStart > 24) {
|
||||
dayStart = 0;
|
||||
}
|
||||
User.log({'op':'set', data:{'preferences.dayStart': dayStart}});
|
||||
}
|
||||
|
||||
$scope.reroll = function(){
|
||||
|
||||
$http.post(API_URL + '/api/v1/user/reroll')
|
||||
.success(function(){
|
||||
window.location.href = '/';
|
||||
// FIXME, I can't get the tasks to update in the browser, even with _.extend(user,data). refreshing for now
|
||||
})
|
||||
.error(function(data){
|
||||
alert(data.err)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
]);
|
||||
Reference in New Issue
Block a user