From 6b1ea5901fdc1e781d6d49ad09d342ccb00bdd0a Mon Sep 17 00:00:00 2001 From: Simon Eisenmann Date: Sun, 27 Apr 2014 23:57:49 +0200 Subject: [PATCH] Store settings implicitly on close to improve usabilityt. --- static/js/directives/settings.js | 9 +++++---- static/partials/settings.html | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/static/js/directives/settings.js b/static/js/directives/settings.js index 504708cc..92b2c504 100644 --- a/static/js/directives/settings.js +++ b/static/js/directives/settings.js @@ -49,7 +49,8 @@ define(['underscore', 'text!partials/settings.html'], function(_, template) { var localStream = null; - $scope.saveSettings = function(user) { + $scope.saveSettings = function() { + var user = $scope.user; $scope.update(user); $scope.layout.settings = false; if ($scope.rememberSettings) { @@ -150,10 +151,8 @@ define(['underscore', 'text!partials/settings.html'], function(_, template) { }; $scope.forgetUserid = function() { - mediaStream.users.forget(); mediaStream.connector.forgetAndReconnect(); - }; $scope.checkDefaultMediaSources = function() { @@ -177,7 +176,7 @@ define(['underscore', 'text!partials/settings.html'], function(_, template) { $scope.mediaSources.refresh(function() { safeApply($scope, $scope.checkDefaultMediaSources); }); - $scope.$watch("layout.settings", function(showSettings) { + $scope.$watch("layout.settings", function(showSettings, oldValue) { if (showSettings) { $scope.desktopNotify.refresh(); $scope.mediaSources.refresh(function(audio, video) { @@ -196,6 +195,8 @@ define(['underscore', 'text!partials/settings.html'], function(_, template) { } }); }); + } else if (!showSettings && oldValue) { + $scope.saveSettings(); } }); }]; diff --git a/static/partials/settings.html b/static/partials/settings.html index c4f71397..a5691973 100644 --- a/static/partials/settings.html +++ b/static/partials/settings.html @@ -144,9 +144,10 @@
+ +

{{_('Your ID will still be kept - press the log out button above to delete the ID.')}}

- {{_('Apply')}} {{_('Cancel')}} + {{_('Close')}}