mirror of
https://github.com/nextcloud/ocsms.git
synced 2026-08-23 06:13:09 +00:00
Move generateUrl to Sms object, add SmsSettings::init & drop it from angular app
This commit is contained in:
+27
-1
@@ -9,8 +9,34 @@
|
||||
*/
|
||||
|
||||
var SmsSettings = {
|
||||
// Attributes
|
||||
messageLimit: 100,
|
||||
enableNotifications: true,
|
||||
contactOrderBy: 'lastmsg',
|
||||
reverseContactOrder: true
|
||||
reverseContactOrder: true,
|
||||
country: '',
|
||||
|
||||
// Functions
|
||||
init: function () {
|
||||
$.getJSON(Sms.generateURL('/front-api/v1/settings'), function (jsondata, status) {
|
||||
if (jsondata['status'] === true) {
|
||||
this.messageLimit = parseInt(jsondata["message_limit"]);
|
||||
this.enableNotifications = parseInt(jsondata["notification_state"]) !== 0;
|
||||
this.contactOrderBy = jsondata["contact_order"];
|
||||
this.reverseContactOrder = toBool(jsondata["contact_order_reverse"]);
|
||||
this.country = jsondata["country"];
|
||||
|
||||
this.updateView();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// This function should be moved to a renderer or something else
|
||||
updateView: function () {
|
||||
$('#sel_intl_phone').val(this.country);
|
||||
$('input[name=setting_msg_per_page]').val(this.messageLimit);
|
||||
$('select[name=setting_notif]').val(this.enableNotifications ? 1 : 0);
|
||||
$('select[name=setting_contact_order]').val(this.contactOrderBy);
|
||||
$('input[name=setting_contact_order_reverse]').val(this.reverseContactOrder);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user