diff --git a/assets/js/controllers/settingsCtrl.js b/assets/js/controllers/settingsCtrl.js index 29ff2cb045..63ca4a5d3f 100644 --- a/assets/js/controllers/settingsCtrl.js +++ b/assets/js/controllers/settingsCtrl.js @@ -4,17 +4,23 @@ habitrpg.controller('SettingsCtrl', ['$scope', 'User', '$location', function($scope, User, $location) { - $scope.resetApp = function () { - localStorage.clear(); - location.reload(); - }; - $scope.auth = function (id, token) { - User.authenticate(id, token, function (err) { - if (!err) { - alert('Login successful!'); - $location.path("/habit"); - } - }); + + // 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}}); } } diff --git a/assets/js/directives/directives.js b/assets/js/directives/directives.js index b8e10fcabb..78c7e7e9c2 100644 --- a/assets/js/directives/directives.js +++ b/assets/js/directives/directives.js @@ -28,17 +28,6 @@ habitrpg.directive('habitrpgAdsense', function() { } }) -/** - * Directive that executes an expression when the element it is applied to loses focus. - */ -habitrpg.directive('taskBlur', function() { - return function(scope, elem, attrs) { - elem.bind('blur', function() { - scope.$apply(attrs.taskBlur); - }); - }; -}); - habitrpg.directive('whenScrolled', function() { return function(scope, elm, attr) { var raw = elm[0]; diff --git a/views/options/index.jade b/views/options/index.jade index d864a018d9..48e2e0df86 100644 --- a/views/options/index.jade +++ b/views/options/index.jade @@ -10,7 +10,7 @@ | Profile include ./profile - tab + //-tab tab-heading i.icon-heart | Groups @@ -34,7 +34,7 @@ | Stable app:pets:stable - tab + //-tab tab-heading i.icon-eye-close | Tavern diff --git a/views/options/settings.jade b/views/options/settings.jade index 4db36df884..69a4062ebe 100644 --- a/views/options/settings.jade +++ b/views/options/settings.jade @@ -1,11 +1,10 @@ -.row-fluid +.row-fluid(ng-controller='SettingsCtrl') .personal-options.span6.border-right h2 Settings h4 Custom Day Start .option-group.option-short - input.option-content.option-time(type='number', min='0', max='24', value='{{user.preferences.dayStart}}') + input.option-content.option-time(type='number', min='0', max='24', ng-model='user.preferences.dayStart', ng-change='saveDayStart()') span.input-suffix :00 (24h clock) - span(class='alert alert-warning') Doesn't save yet div small | Habit defaults to check and reset your dailies at midnight in your time zone each day. You can customize the hour here (enter a number between 0 and 24). @@ -19,9 +18,9 @@ derby-auth:changepassword hr h4 Danger Zone - a.btn.btn-danger(data-target='#reset-modal', data-toggle='modal', rel='tooltip', title='Resets your entire account (dangerous).') Reset - a.btn.btn-danger(data-target='#restore-modal', data-toggle='modal', rel='tooltip', title='Restores attributes to your character.') Restore - a.btn.btn-danger(data-target='#delete-modal', data-toggle='modal', rel='tooltip', title='Delete your account.') Delete + a.btn.btn-danger(ng-click='notPorted()', data-target='#reset-modal', data-toggle='modal', tooltip='Resets your entire account (dangerous).') Reset + a.btn.btn-danger(ng-click='notPorted()', data-target='#restore-modal', data-toggle='modal', tooltip='Restores attributes to your character.') Restore + a.btn.btn-danger(ng-click='notPorted()', data-target='#delete-modal', data-toggle='modal', tooltip='Delete your account.') Delete .span6 h2 API small Copy these for use in third party applications.