Replaced toggleCustomDayStartInfo function with angular magic. (#5006)

This commit is contained in:
Kathryn Norris 2015-04-14 14:49:45 -07:00
parent 8c45ab8dc4
commit 6a461be0a4
2 changed files with 3 additions and 16 deletions

View file

@ -75,19 +75,6 @@ habitrpg.controller('SettingsCtrl',
User.set({'preferences.dayStart': dayStart}); User.set({'preferences.dayStart': dayStart});
} }
$scope.toggleCustomDayStartInfo = function(){
var infoElement = window.document.getElementById('customDayStartInfo');
var currentDisplay = infoElement.currentStyle ? infoElement.currentStyle.display : getComputedStyle(infoElement, null).display;
var linkElement = window.document.getElementById('customDayStartLink');
if (currentDisplay === 'none') {
infoElement.style.display = 'block';
linkElement.innerHTML = window.env.t('customDayStartInfo3');
} else {
infoElement.style.display = 'none';
linkElement.innerHTML = window.env.t('customDayStartInfo2');
}
}
$scope.language = window.env.language; $scope.language = window.env.language;
$scope.avalaibleLanguages = window.env.avalaibleLanguages; $scope.avalaibleLanguages = window.env.avalaibleLanguages;

View file

@ -76,9 +76,9 @@ script(type='text/ng-template', id='partials/options.settings.settings.html')
div.alert.alert-warning(style='padding:2px;margin-top:7px') div.alert.alert-warning(style='padding:2px;margin-top:7px')
h5=env.t('customDayStart') h5=env.t('customDayStart')
h5=env.t('customDayStartInfo1') h5=env.t('customDayStartInfo1')
a(id='customDayStartLink' ng-click='toggleCustomDayStartInfo()')=env.t('customDayStartInfo2') a(ng-show='!showCustomDayStartInfo' ng-click='showCustomDayStartInfo = !showCustomDayStartInfo')=env.t('customDayStartInfo2')
h5(id='customDayStartInfo' style='display:none') a(ng-show='showCustomDayStartInfo' ng-click='showCustomDayStartInfo = !showCustomDayStartInfo')=env.t('customDayStartInfo3')
!=env.t('customDayStartInfo4') h5(ng-if='showCustomDayStartInfo')!=env.t('customDayStartInfo4')
.form-group .form-group
.input-group .input-group
input.form-control(type='number', min='0', max='23', ng-model='user.preferences.dayStart', ng-blur='saveDayStart()') input.form-control(type='number', min='0', max='23', ng-model='user.preferences.dayStart', ng-blur='saveDayStart()')