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

Try to migrate some settings send function

This commit is contained in:
Loic Blot 2017-12-28 18:42:51 +01:00
parent 6e21e47bf2
commit 8f017bc20a
No known key found for this signature in database
GPG Key ID: EFAA458E8C153987
4 changed files with 20 additions and 12 deletions

2
js/app.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -50,15 +50,6 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile'
$scope.selectedContact = {}; $scope.selectedContact = {};
$scope.lastSearch = ''; $scope.lastSearch = '';
// Settings
$scope.sendCountry = function () {
$.post(Sms.generateURL('/set/country'), {'country': $('select[name=intl_phone]').val()});
};
$scope.setMessageLimit = function () {
$.post(Sms.generateURL('/set/msglimit'), {'limit': SmsSettings.messageLimit});
};
$scope.setNotificationSetting = function () { $scope.setNotificationSetting = function () {
$.post(Sms.generateURL('/set/notification_state'), $.post(Sms.generateURL('/set/notification_state'),
{ {

View File

@ -32,6 +32,23 @@ var SmsSettings = {
}); });
}, },
sendMessageLimit: function () {
var self = this;
$.post(Sms.generateURL('/set/msglimit'),
{
'limit': self.messageLimit
}
);
},
sendCountry: function () {
$.post(Sms.generateURL('/set/country'),
{
'country': $('select[name=intl_phone]').val()
}
);
},
// This function should be moved to a renderer or something else // This function should be moved to a renderer or something else
updateView: function () { updateView: function () {
$('#sel_intl_phone').val(this.country); $('#sel_intl_phone').val(this.country);

View File

@ -25,7 +25,7 @@ use \OCA\OcSms\Lib\CountryCodes;
</div> </div>
<div id="app-settings-content"> <div id="app-settings-content">
<div><label for="setting_msg_per_page">Max messages on tab loading</label> <div><label for="setting_msg_per_page">Max messages on tab loading</label>
<input type="number" min="10" max="10000" name="setting_msg_per_page" ng-model="vsettings.messageLimit" ng-change="setMessageLimit()" to-int /> <input type="number" min="10" max="10000" name="setting_msg_per_page" ng-model="vsettings.messageLimit" ng-change="vsettings.sendMessageLimit()" to-int />
<span class="label-invalid-input" ng-if="vsettings.messageLimit == null || vsettings.messageLimit == undefined">Invalid message limit</span> <span class="label-invalid-input" ng-if="vsettings.messageLimit == null || vsettings.messageLimit == undefined">Invalid message limit</span>
</div> </div>
@ -35,7 +35,7 @@ use \OCA\OcSms\Lib\CountryCodes;
<option><?php p($code); ?></option> <option><?php p($code); ?></option>
<?php } ?> <?php } ?>
</select> </select>
<button class="new-button primary icon-checkmark-white" ng-click="sendCountry();"></button> <button class="new-button primary icon-checkmark-white" ng-click="vsettings.sendCountry();"></button>
</div> </div>
<div> <div>