mirror of https://github.com/nextcloud/contacts
Auto hide sidebar if mobile
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
db3843566f
commit
391b2f4d48
|
@ -11,7 +11,7 @@ angular.module('contactsApp')
|
|||
ctrl.import = ContactService.import.bind(ContactService);
|
||||
ctrl.loading = true;
|
||||
ctrl.importText = ctrl.t.importText;
|
||||
ctrl.status = '';
|
||||
ctrl.importing = false;
|
||||
ctrl.loadingClass = 'icon-upload';
|
||||
|
||||
AddressBookService.getAll().then(function(addressBooks) {
|
||||
|
|
|
@ -9,17 +9,28 @@ angular.module('contactsApp')
|
|||
|
||||
reader.addEventListener('load', function () {
|
||||
scope.$apply(function () {
|
||||
// Indicate the user we started something
|
||||
ctrl.importText = ctrl.t.importingText;
|
||||
ctrl.loadingClass = 'icon-loading-small';
|
||||
ctrl.importing = true;
|
||||
|
||||
ContactService.import.call(ContactService, reader.result, file.type, ctrl.selectedAddressBook, function (progress, user) {
|
||||
if (progress === 1) {
|
||||
ctrl.importText = ctrl.t.importText;
|
||||
ctrl.loadingClass = 'icon-upload';
|
||||
ctrl.importing = false;
|
||||
ImportService.importPercent = 0;
|
||||
ImportService.importing = false;
|
||||
ImportService.importedUser = '';
|
||||
ImportService.selectedAddressBook = '';
|
||||
} else {
|
||||
ctrl.importText = ctrl.t.importingText;
|
||||
ctrl.loadingClass = 'icon-loading-small';
|
||||
// Ugly hack, hide sidebar on import & mobile
|
||||
// Simulate click since we can't directly access snapper
|
||||
if($(window).width() <= 768 && $('body').hasClass('snapjs-left')) {
|
||||
$('#app-navigation-toggle').click();
|
||||
$('body').removeClass('snapjs-left');
|
||||
}
|
||||
|
||||
ImportService.importPercent = parseInt(Math.floor(progress * 100));
|
||||
ImportService.importing = true;
|
||||
ImportService.importedUser = user;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<input type="file" id="contact-import" class="hidden-visually" multiple/>
|
||||
<label for="contact-import" class="button {{ctrl.loadingClass}}" ng-class="{'no-select': ctrl.addressBooks.length === 1}" id="upload">
|
||||
{{ctrl.importText}}
|
||||
<span ng-if="ctrl.addressBooks.length === 1">{{ctrl.addressBooks[0].displayName}}</span>
|
||||
<span ng-if="ctrl.addressBooks.length === 1 && !ctrl.importing" ng-class="{'icon-loading-small': ctrl.loading}">{{ctrl.selectedAddressBook.displayName}}</span>
|
||||
</label>
|
||||
<ui-select ng-model="ctrl.selectedAddressBook" ng-if="ctrl.addressBooks.length > 1" search-enabled="ctrl.addressBooks.length > 4"
|
||||
theme="select2" class="form-control" title="{{ctrl.t.selectAddressbook}}"
|
||||
|
|
Loading…
Reference in New Issue