Browse Source

Store settings implicitly on close to improve usabilityt.

pull/28/head
Simon Eisenmann 11 years ago
parent
commit
6b1ea5901f
  1. 9
      static/js/directives/settings.js
  2. 5
      static/partials/settings.html

9
static/js/directives/settings.js

@ -49,7 +49,8 @@ define(['underscore', 'text!partials/settings.html'], function(_, template) { @@ -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) { @@ -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) { @@ -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) { @@ -196,6 +195,8 @@ define(['underscore', 'text!partials/settings.html'], function(_, template) {
}
});
});
} else if (!showSettings && oldValue) {
$scope.saveSettings();
}
});
}];

5
static/partials/settings.html

@ -144,9 +144,10 @@ @@ -144,9 +144,10 @@
<div class="checkbox" style="padding-bottom:1em">
<label>
<input type="checkbox" ng-model="rememberSettings"> {{_('Remember settings')}}
</label>
</label>
<p class="text-warning" style="margin-top:4px" ng-show="userid &&!rememberSettings"><strong>{{_('Your ID will still be kept - press the log out button above to delete the ID.')}}</strong></p>
</div>
<a ng-click="saveSettings(user)" class="btn btn-primary">{{_('Apply')}}</a> <a ng-click="cancelSettings()" class="btn btn-default">{{_('Cancel')}}</a>
<a ng-click="layout.settings=false" class="btn btn-default">{{_('Close')}}</a>
</div>
</div>

Loading…
Cancel
Save