1
0
mirror of https://github.com/nerzhul/ocsms.git synced 2025-06-07 16:06:15 +00:00

migrate all remaining settings setters

This commit is contained in:
Loic Blot 2017-12-28 18:51:57 +01:00
parent 8f017bc20a
commit 2b6e52205e
No known key found for this signature in database
GPG Key ID: EFAA458E8C153987
3 changed files with 24 additions and 21 deletions

View File

@ -50,23 +50,6 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile'
$scope.selectedContact = {}; $scope.selectedContact = {};
$scope.lastSearch = ''; $scope.lastSearch = '';
$scope.setNotificationSetting = function () {
$.post(Sms.generateURL('/set/notification_state'),
{
'notification': SmsSettings.enableNotifications ? 1 : 0
}
);
};
$scope.setContactOrderSetting = function () {
$.post(Sms.generateURL('/set/contact_order'),
{
'attribute': SmsSettings.contactOrderBy,
'reverse': SmsSettings.reverseContactOrder
}
);
};
// Conversations // Conversations
$scope.loadConversation = function (contact) { $scope.loadConversation = function (contact) {
OC.Util.History.pushState('phonenumber=' + contact.nav); OC.Util.History.pushState('phonenumber=' + contact.nav);

View File

@ -33,6 +33,10 @@ var SmsSettings = {
}, },
sendMessageLimit: function () { sendMessageLimit: function () {
if (this.messageLimit === null) {
return;
}
var self = this; var self = this;
$.post(Sms.generateURL('/set/msglimit'), $.post(Sms.generateURL('/set/msglimit'),
{ {
@ -40,7 +44,23 @@ var SmsSettings = {
} }
); );
}, },
sendNotificationFlag: function () {
var self = this;
$.post(Sms.generateURL('/set/notification_state'),
{
'notification': self.enableNotifications ? 1 : 0
}
);
},
sendContactOrder: function () {
var self = this;
$.post(Sms.generateURL('/set/contact_order'),
{
'attribute': self.contactOrderBy,
'reverse': self.reverseContactOrder
}
);
},
sendCountry: function () { sendCountry: function () {
$.post(Sms.generateURL('/set/country'), $.post(Sms.generateURL('/set/country'),
{ {

View File

@ -40,17 +40,17 @@ use \OCA\OcSms\Lib\CountryCodes;
<div> <div>
<label for="setting_contact_order">Contact ordering</label> <label for="setting_contact_order">Contact ordering</label>
<select name="setting_contact_order" ng-model="vsettings.contactOrderBy" ng-change="setContactOrderSetting()"> <select name="setting_contact_order" ng-model="vsettings.contactOrderBy" ng-change="vsettings.sendContactOrder()">
<option value="lastmsg">Last message</option> <option value="lastmsg">Last message</option>
<option value="label">Label</option> <option value="label">Label</option>
</select> </select>
<label for "setting_contact_order_reverse">Reverse ?</label> <label for "setting_contact_order_reverse">Reverse ?</label>
<input type="checkbox" ng-model="vsettings.reverseContactOrder" ng-change="setContactOrderSetting()" /> <input type="checkbox" ng-model="vsettings.reverseContactOrder" ng-change="vsettings.sendContactOrder()" />
</div> </div>
<div> <div>
<label for"setting_notif">Notification settings</label> <label for"setting_notif">Notification settings</label>
<select name="setting_notif" ng-model="vsetting.enableNotifications" ng-change="setNotificationSetting()"> <select name="setting_notif" ng-model="vsetting.enableNotifications" ng-change="vsettings.sendNotificationFlag()">
<option value="1">Enable</option> <option value="1">Enable</option>
<option value="0">Disable</option> <option value="0">Disable</option>
</select> </select>