From ddee75e4795700b9a02ad1eacdc683bc145fbe5a Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Tue, 20 Jun 2017 17:08:53 +0100 Subject: [PATCH] Use a getterSetter to manage int values in settings. --- services/web/app/views/project/editor/left-menu.pug | 3 ++- .../ide/settings/controllers/SettingsController.coffee | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/services/web/app/views/project/editor/left-menu.pug b/services/web/app/views/project/editor/left-menu.pug index 831dc212ae..fd5b7bdd90 100644 --- a/services/web/app/views/project/editor/left-menu.pug +++ b/services/web/app/views/project/editor/left-menu.pug @@ -136,7 +136,8 @@ aside#left-menu.full-size( label(for="fontSize") #{translate("font_size")} select( 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'] option(value=size) #{size}px diff --git a/services/web/public/coffee/ide/settings/controllers/SettingsController.coffee b/services/web/public/coffee/ide/settings/controllers/SettingsController.coffee index bde479991b..b42d07467c 100644 --- a/services/web/public/coffee/ide/settings/controllers/SettingsController.coffee +++ b/services/web/public/coffee/ide/settings/controllers/SettingsController.coffee @@ -8,6 +8,11 @@ define [ if $scope.settings.pdfViewer not in ["pdfjs", "native"] $scope.settings.pdfViewer = "pdfjs" + $scope.fontSizeAsStr = (newVal) -> + if newVal? + $scope.settings.fontSize = newVal + return $scope.settings.fontSize.toString() + $scope.$watch "settings.theme", (theme, oldTheme) => if theme != oldTheme settings.saveSettings({theme: theme})