Init addressbook disabling ability

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2017-10-26 18:22:38 +02:00
parent 6dabbc756b
commit cd30af0c40
No known key found for this signature in database
GPG Key ID: FB5ACEED51955BF8
4 changed files with 23 additions and 2 deletions

View File

@ -91,6 +91,9 @@ ul.addressBookList li[addressbook] > span.addressBookName {
white-space: nowrap;
text-overflow: ellipsis;
padding-left: 7px;
&.disabled {
opacity: 0.3;
}
}
ul.addressBookList li[addressbook] > .addressBookShares {

View File

@ -12,10 +12,13 @@ angular.module('contactsApp')
shareInputPlaceHolder: t('contacts', 'Share with users or groups'),
delete: t('contacts', 'Delete'),
canEdit: t('contacts', 'can edit'),
close: t('contacts', 'Close')
close: t('contacts', 'Close'),
enabled: t('contacts', 'Enabled'),
disabled: t('contacts', 'Disabled')
};
ctrl.editing = false;
ctrl.enabled = ctrl.addressBook.enabled;
ctrl.tooltipIsOpen = false;
ctrl.tooltipTitle = ctrl.t.clickToCopy;
@ -178,4 +181,9 @@ angular.module('contactsApp')
});
};
ctrl.toggleState = function() {
window.localStorage.setItem('ctrl.key', !ctrl.enabled);
ctrl.enabled = !ctrl.enabled;
};
});

View File

@ -8,6 +8,10 @@ angular.module('contactsApp')
contacts: [],
groups: data.data.props.groups,
readOnly: data.data.props.readOnly === '1',
// use only owner and url, convert ''/remote.php/dav/addressbooks/users/admin/Test1/'' to 'admin.Test'
key: data.data.href.split('/').splice(-3, 2).join('.'),
enabled: window.localStorage.getItem(this.key) !== false,
getContact: function(uid) {
for(var i in this.contacts) {

View File

@ -2,7 +2,7 @@
<input select-expression="ctrl.editing" placeholder="{{ctrl.t.addressBookName}}" class="renameAddressBookInput" ng-model="ctrl.addressBook.displayName" type="text" />
<input type="submit" value="" class="renameAddressBookSubmit inline-button icon-confirm action pull-right" />
</form>
<span class="addressBookName" title="{{ctrl.addressBook.displayName}}" ng-hide="ctrl.editing">{{ctrl.addressBook.displayName}}</span>
<span class="addressBookName" ng-class="{disabled: !ctrl.enabled}" onloadedmetadata=""title="{{ctrl.addressBook.displayName}}" ng-hide="ctrl.editing">{{ctrl.addressBook.displayName}}</span>
<span class="utils" ng-hide="ctrl.editing">
<span class="action">
<span
@ -44,6 +44,12 @@
<span>{{ctrl.t.renameAddressbook}}</span>
</a>
</li>
<li>
<a ng-click="ctrl.toggleState()">
<input id="state_{{$id}}" type="checkbox" class="checkbox" ng-checked="ctrl.enabled" />
<label for="state_{{$id}}">{{ctrl.enabled ? ctrl.t.enabled : ctrl.t.disabled}}</span>
</a>
</li>
<li ng-if="ctrl.list.length > 1">
<a ng-click="ctrl.deleteAddressBook()">
<span class="icon icon-delete"></span>