Use a getterSetter to manage int values in settings.

This commit is contained in:
Paulo Reis 2017-06-20 17:08:53 +01:00
parent 669c705d32
commit ddee75e479
2 changed files with 7 additions and 1 deletions

View file

@ -136,7 +136,8 @@ aside#left-menu.full-size(
label(for="fontSize") #{translate("font_size")} label(for="fontSize") #{translate("font_size")}
select( select(
name="fontSize" name="fontSize"
ng-model="settings.fontSize" ng-model="fontSizeAsStr"
ng-model-options="{ getterSetter: true }"
) )
each size in ['10','11','12','13','14','16','20','24'] each size in ['10','11','12','13','14','16','20','24']
option(value=size) #{size}px option(value=size) #{size}px

View file

@ -8,6 +8,11 @@ define [
if $scope.settings.pdfViewer not in ["pdfjs", "native"] if $scope.settings.pdfViewer not in ["pdfjs", "native"]
$scope.settings.pdfViewer = "pdfjs" $scope.settings.pdfViewer = "pdfjs"
$scope.fontSizeAsStr = (newVal) ->
if newVal?
$scope.settings.fontSize = newVal
return $scope.settings.fontSize.toString()
$scope.$watch "settings.theme", (theme, oldTheme) => $scope.$watch "settings.theme", (theme, oldTheme) =>
if theme != oldTheme if theme != oldTheme
settings.saveSettings({theme: theme}) settings.saveSettings({theme: theme})