Browse Source

Added send settings

master
Igor Zhukov 11 years ago
parent
commit
9a24b87d95
  1. 7
      app/css/app.css
  2. 6
      app/index.html
  3. 18
      app/js/controllers.js
  4. 13
      app/js/directives.js
  5. 15
      app/partials/settings_modal.html

7
app/css/app.css

@ -1463,6 +1463,13 @@ img.img_fullsize { @@ -1463,6 +1463,13 @@ img.img_fullsize {
background-color: #FFF;
}
.settings_send_choose_form input {
margin-top: 2px;
}
.settings_send_choose_form {
margin-bottom: 20px;
}
.settings_user_phone,
.settings_version {
color: #999;

6
app/index.html

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
<link rel="stylesheet" href="vendor/angular/angular-csp.css"/>
<link rel="stylesheet" href="vendor/bootstrap/css/bootstrap.css"/>
<link rel="stylesheet" href="vendor/jquery.nanoscroller/nanoscroller.css"/>
<link rel="stylesheet" href="css/app.css?19"/>
<link rel="stylesheet" href="css/app.css?20"/>
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<meta property="og:title" content="Webogram">
@ -53,9 +53,9 @@ @@ -53,9 +53,9 @@
<script type="text/javascript" src="js/util.js"></script>
<script type="text/javascript" src="js/app.js?14"></script>
<script type="text/javascript" src="js/services.js?16"></script>
<script type="text/javascript" src="js/controllers.js?23"></script>
<script type="text/javascript" src="js/controllers.js?24"></script>
<script type="text/javascript" src="js/filters.js?3"></script>
<script type="text/javascript" src="js/directives.js?15"></script>
<script type="text/javascript" src="js/directives.js?16"></script>
</body>
</html>

18
app/js/controllers.js

@ -162,7 +162,7 @@ angular.module('myApp.controllers', []) @@ -162,7 +162,7 @@ angular.module('myApp.controllers', [])
$scope.isLoggedIn = true;
$scope.openSettings = function () {
$modal.open({
templateUrl: 'partials/settings_modal.html?1',
templateUrl: 'partials/settings_modal.html?2',
controller: 'SettingsModalController',
scope: $rootScope.$new(),
windowClass: 'settings_modal_window'
@ -587,7 +587,7 @@ angular.module('myApp.controllers', []) @@ -587,7 +587,7 @@ angular.module('myApp.controllers', [])
});
})
.controller('SettingsModalController', function ($scope, $timeout, AppUsersManager, AppChatsManager, MtpApiManager, AppConfigManager, NotificationsManager) {
.controller('SettingsModalController', function ($rootScope, $scope, $timeout, AppUsersManager, AppChatsManager, MtpApiManager, AppConfigManager, NotificationsManager) {
$scope.profile = {};
@ -600,10 +600,13 @@ angular.module('myApp.controllers', []) @@ -600,10 +600,13 @@ angular.module('myApp.controllers', [])
});
$scope.notify = {};
$scope.send = {};
AppConfigManager.get(['notify_nodesktop', 'notify_nosound']).then(function (settings) {
AppConfigManager.get(['notify_nodesktop', 'notify_nosound', 'send_ctrlenter']).then(function (settings) {
$scope.notify.sound = !settings.notify_nosound;
$scope.notify.desktop = !settings.notify_nodesktop;
$scope.send.enter = settings.send_ctrlenter ? '' : '1';
console.log($scope.send.enter);
});
$scope.$watch('notify.sound', function(newValue) {
@ -623,6 +626,15 @@ angular.module('myApp.controllers', []) @@ -623,6 +626,15 @@ angular.module('myApp.controllers', [])
}
});
$scope.$watch('send.enter', function(newValue) {
if (newValue) {
AppConfigManager.remove('send_ctrlenter');
} else {
AppConfigManager.set({send_ctrlenter: true});
}
$rootScope.$broadcast('settings_changed');
});
$scope.error = {};
$scope.save = function () {
MtpApiManager.invokeApi('account.updateProfile', {

13
app/js/directives.js

@ -255,7 +255,7 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -255,7 +255,7 @@ angular.module('myApp.directives', ['myApp.filters'])
})
.directive('mySendForm', function ($timeout) {
.directive('mySendForm', function ($timeout, AppConfigManager) {
return {
link: link,
@ -305,7 +305,16 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -305,7 +305,16 @@ angular.module('myApp.directives', ['myApp.filters'])
});
});
var sendOnEnter = true;
var sendOnEnter = true,
updateSendSettings = function () {
AppConfigManager.get('send_ctrlenter').then(function (sendOnCtrl) {
sendOnEnter = !sendOnCtrl;
});
};
scope.$on('settings_changed', updateSendSettings);
updateSendSettings();
$(editorElement).on('keydown', function (e) {
if (e.keyCode == 13) {
var submit = false;

15
app/partials/settings_modal.html

@ -26,6 +26,21 @@ @@ -26,6 +26,21 @@
</div>
</form>
<form class="settings_send_choose_form">
<div class="radio">
<label>
<input type="radio" value="1" ng-model="send.enter">
<strong>Enter</strong> - send message, <strong>Shift + Enter</strong> - new line
</label>
</div>
<div class="radio">
<label>
<input type="radio" value="" ng-model="send.enter">
<strong>Ctrl + Enter</strong> - send message, <strong>Enter</strong> - new line
</label>
</div>
</form>
<p>
<strong>Sound: </strong>
<a ng-click="notify.sound = !notify.sound">{{notify.sound ? 'ON' : 'OFF'}}</a>

Loading…
Cancel
Save