mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-28 03:29:20 +03:00
feat: add addressBook user settings section for nextcloud plugin
This commit is contained in:
parent
957654c746
commit
500b997f91
10 changed files with 232 additions and 73 deletions
36
plugins/nextcloud/js/addressbook.js
Normal file
36
plugins/nextcloud/js/addressbook.js
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
(rl => {
|
||||
if (rl) {
|
||||
class AddressBookSettings /* extends AbstractViewSettings */ {
|
||||
constructor() {
|
||||
this.addressBookList = ko.observableArray();
|
||||
this.selectedAddressBook = ko.observable();
|
||||
|
||||
rl.pluginRemoteRequest((iError, oData) => {
|
||||
if (!iError) {
|
||||
const books = JSON.parse(oData.Result.addressbooks);
|
||||
books.forEach(book => {
|
||||
this.addressBookList.push(book);
|
||||
|
||||
if (book.selected) {
|
||||
this.selectedAddressBook(book.uri);
|
||||
}
|
||||
});
|
||||
|
||||
this.selectedAddressBook.subscribe(value => {
|
||||
rl.pluginRemoteRequest(() => { }, 'NextcloudUpdateAddressBook', {
|
||||
uri: value
|
||||
});
|
||||
});
|
||||
}
|
||||
}, "JsonGetAddressbooks");
|
||||
}
|
||||
}
|
||||
|
||||
rl.addSettingsViewModel(
|
||||
AddressBookSettings,
|
||||
'AddressBookSettings',
|
||||
'NEXTCLOUD/ADDRESS_BOOK',
|
||||
'addressbook'
|
||||
);
|
||||
}
|
||||
})(window.rl);
|
||||
Loading…
Add table
Add a link
Reference in a new issue