mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-03-20 13:55:58 +00:00
Improve folder subscription widget
This commit is contained in:
@@ -197,6 +197,7 @@
|
||||
dropdownCss.top = $window.innerHeight - dropdownHeight - 5;
|
||||
if (dropdownHeight > $window.innerHeight) {
|
||||
// Resize height of dropdown to fit window
|
||||
dropdownCss.top = 5;
|
||||
dropdownCss.height = ($window.innerHeight - 10) + 'px';
|
||||
}
|
||||
}
|
||||
@@ -273,10 +274,7 @@
|
||||
};
|
||||
}],
|
||||
link: function(scope, element, attrs, controller) {
|
||||
// NOTE: We could also make these modifications in the wox template
|
||||
element.addClass('joyride-tip-guide');
|
||||
angular.element(element.children()[0]).addClass('joyride-content-wrapper');
|
||||
element.prepend('<span class="joyride-nub left"></span>');
|
||||
}
|
||||
};
|
||||
}])
|
||||
|
||||
@@ -187,7 +187,6 @@
|
||||
User.$$resource.userResource(this.uid).fetch(null, 'foldersSearch', param).then(function(data) {
|
||||
_this.$$folders = data;
|
||||
deferred.resolve(data);
|
||||
console.debug(JSON.stringify(data, undefined, 2));
|
||||
return data;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -59,9 +59,10 @@
|
||||
var sibling, i;
|
||||
|
||||
addressbook.isOwned = this.activeUser.isSuperUser || addressbook.owner == this.activeUser.login;
|
||||
addressbook.isSubscription = addressbook.owner != this.activeUser.login;
|
||||
sibling = _.find(this.$addressbooks, function(o) {
|
||||
return (o.isRemote || (o.id != 'personal'
|
||||
&& o.isOwned == addressbook.isOwned
|
||||
&& o.isSubscription === addressbook.isSubscription
|
||||
&& o.name.localeCompare(addressbook.name) === 1));
|
||||
});
|
||||
i = sibling ? _.indexOf(_.pluck(this.$addressbooks, 'id'), sibling.id) : 1;
|
||||
@@ -81,7 +82,8 @@
|
||||
// Instanciate AddressBook objects
|
||||
angular.forEach(this.$addressbooks, function(o, i) {
|
||||
_this.$addressbooks[i] = new AddressBook(o);
|
||||
// Add 'isOwned' attribute based on active user (TODO: add it server-side?)
|
||||
// Add 'isOwned' and 'isSubscription' attributes based on active user (TODO: add it server-side?)
|
||||
_this.$addressbooks[i].isSubscription = _this.$addressbooks[i].owner != _this.activeUser.login;
|
||||
_this.$addressbooks[i].isOwned = _this.activeUser.isSuperUser
|
||||
|| _this.$addressbooks[i].owner == _this.activeUser.login;
|
||||
});
|
||||
@@ -196,10 +198,10 @@
|
||||
d = AddressBook.$q.defer(),
|
||||
promise;
|
||||
|
||||
if (this.isOwned)
|
||||
promise = AddressBook.$$resource.remove(this.id);
|
||||
else
|
||||
if (this.isSubscription)
|
||||
promise = AddressBook.$$resource.fetch(this.id, 'unsubscribe');
|
||||
else
|
||||
promise = AddressBook.$$resource.remove(this.id);
|
||||
|
||||
promise.then(function() {
|
||||
var i = _.indexOf(_.pluck(AddressBook.$addressbooks, 'id'), _this.id);
|
||||
|
||||
@@ -165,7 +165,18 @@
|
||||
}
|
||||
};
|
||||
$scope.confirmDelete = function() {
|
||||
if ($scope.addressbook.isOwned) {
|
||||
if ($scope.addressbook.isSubscription) {
|
||||
// Unsubscribe without confirmation
|
||||
$rootScope.addressbook.$delete()
|
||||
.then(function() {
|
||||
$rootScope.addressbook = null;
|
||||
}, function(data, status) {
|
||||
Dialog.alert(l('An error occured while deleting the addressbook "%{0}".',
|
||||
$rootScope.addressbook.name),
|
||||
l(data.error));
|
||||
});
|
||||
}
|
||||
else {
|
||||
Dialog.confirm(l('Warning'), l('Are you sure you want to delete the addressbook <em>%{0}</em>?',
|
||||
$scope.addressbook.name))
|
||||
.then(function(res) {
|
||||
@@ -181,18 +192,6 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
// Unsubscribe without confirmation
|
||||
$rootScope.addressbook.$delete()
|
||||
.then(function() {
|
||||
$rootScope.addressbook = null;
|
||||
}, function(data, status) {
|
||||
Dialog.alert(l('An error occured while deleting the addressbook "%{0}".',
|
||||
$rootScope.addressbook.name),
|
||||
l(data.error));
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
$scope.importCards = function() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user