Improve folder subscription widget
This commit is contained in:
parent
989cb0bca2
commit
ca14a0d4b3
|
@ -5,6 +5,8 @@
|
||||||
xmlns:var="http://www.skyrix.com/od/binding"
|
xmlns:var="http://www.skyrix.com/od/binding"
|
||||||
xmlns:const="http://www.skyrix.com/od/constant"
|
xmlns:const="http://www.skyrix.com/od/constant"
|
||||||
xmlns:uix="OGo:uix"><var:string var:value="doctype" const:escapeHTML="NO" />
|
xmlns:uix="OGo:uix"><var:string var:value="doctype" const:escapeHTML="NO" />
|
||||||
|
<span class="joyride-nub left"><!-- dropdown nub --></span>
|
||||||
|
<div class="joyride-content-wrapper">
|
||||||
<ul>
|
<ul>
|
||||||
<li class="title"><var:string label:value="Subscribe"/></li>
|
<li class="title"><var:string label:value="Subscribe"/></li>
|
||||||
<li class="search">
|
<li class="search">
|
||||||
|
@ -42,4 +44,5 @@
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
</div>
|
||||||
</container>
|
</container>
|
||||||
|
|
|
@ -197,6 +197,7 @@
|
||||||
dropdownCss.top = $window.innerHeight - dropdownHeight - 5;
|
dropdownCss.top = $window.innerHeight - dropdownHeight - 5;
|
||||||
if (dropdownHeight > $window.innerHeight) {
|
if (dropdownHeight > $window.innerHeight) {
|
||||||
// Resize height of dropdown to fit window
|
// Resize height of dropdown to fit window
|
||||||
|
dropdownCss.top = 5;
|
||||||
dropdownCss.height = ($window.innerHeight - 10) + 'px';
|
dropdownCss.height = ($window.innerHeight - 10) + 'px';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -273,10 +274,7 @@
|
||||||
};
|
};
|
||||||
}],
|
}],
|
||||||
link: function(scope, element, attrs, controller) {
|
link: function(scope, element, attrs, controller) {
|
||||||
// NOTE: We could also make these modifications in the wox template
|
|
||||||
element.addClass('joyride-tip-guide');
|
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) {
|
User.$$resource.userResource(this.uid).fetch(null, 'foldersSearch', param).then(function(data) {
|
||||||
_this.$$folders = data;
|
_this.$$folders = data;
|
||||||
deferred.resolve(data);
|
deferred.resolve(data);
|
||||||
console.debug(JSON.stringify(data, undefined, 2));
|
|
||||||
return data;
|
return data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,9 +59,10 @@
|
||||||
var sibling, i;
|
var sibling, i;
|
||||||
|
|
||||||
addressbook.isOwned = this.activeUser.isSuperUser || addressbook.owner == this.activeUser.login;
|
addressbook.isOwned = this.activeUser.isSuperUser || addressbook.owner == this.activeUser.login;
|
||||||
|
addressbook.isSubscription = addressbook.owner != this.activeUser.login;
|
||||||
sibling = _.find(this.$addressbooks, function(o) {
|
sibling = _.find(this.$addressbooks, function(o) {
|
||||||
return (o.isRemote || (o.id != 'personal'
|
return (o.isRemote || (o.id != 'personal'
|
||||||
&& o.isOwned == addressbook.isOwned
|
&& o.isSubscription === addressbook.isSubscription
|
||||||
&& o.name.localeCompare(addressbook.name) === 1));
|
&& o.name.localeCompare(addressbook.name) === 1));
|
||||||
});
|
});
|
||||||
i = sibling ? _.indexOf(_.pluck(this.$addressbooks, 'id'), sibling.id) : 1;
|
i = sibling ? _.indexOf(_.pluck(this.$addressbooks, 'id'), sibling.id) : 1;
|
||||||
|
@ -81,7 +82,8 @@
|
||||||
// Instanciate AddressBook objects
|
// Instanciate AddressBook objects
|
||||||
angular.forEach(this.$addressbooks, function(o, i) {
|
angular.forEach(this.$addressbooks, function(o, i) {
|
||||||
_this.$addressbooks[i] = new AddressBook(o);
|
_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].isOwned = _this.activeUser.isSuperUser
|
||||||
|| _this.$addressbooks[i].owner == _this.activeUser.login;
|
|| _this.$addressbooks[i].owner == _this.activeUser.login;
|
||||||
});
|
});
|
||||||
|
@ -196,10 +198,10 @@
|
||||||
d = AddressBook.$q.defer(),
|
d = AddressBook.$q.defer(),
|
||||||
promise;
|
promise;
|
||||||
|
|
||||||
if (this.isOwned)
|
if (this.isSubscription)
|
||||||
promise = AddressBook.$$resource.remove(this.id);
|
|
||||||
else
|
|
||||||
promise = AddressBook.$$resource.fetch(this.id, 'unsubscribe');
|
promise = AddressBook.$$resource.fetch(this.id, 'unsubscribe');
|
||||||
|
else
|
||||||
|
promise = AddressBook.$$resource.remove(this.id);
|
||||||
|
|
||||||
promise.then(function() {
|
promise.then(function() {
|
||||||
var i = _.indexOf(_.pluck(AddressBook.$addressbooks, 'id'), _this.id);
|
var i = _.indexOf(_.pluck(AddressBook.$addressbooks, 'id'), _this.id);
|
||||||
|
|
|
@ -165,7 +165,18 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$scope.confirmDelete = function() {
|
$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>?',
|
Dialog.confirm(l('Warning'), l('Are you sure you want to delete the addressbook <em>%{0}</em>?',
|
||||||
$scope.addressbook.name))
|
$scope.addressbook.name))
|
||||||
.then(function(res) {
|
.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() {
|
$scope.importCards = function() {
|
||||||
|
|
||||||
|
|
|
@ -594,8 +594,6 @@ $column-gutter: 0;
|
||||||
.sg-dropdown-content {
|
.sg-dropdown-content {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
height: 300px;
|
height: 300px;
|
||||||
overflow: hidden;
|
|
||||||
overflow-y: auto;
|
|
||||||
&.joyride-tip-guide {
|
&.joyride-tip-guide {
|
||||||
.joyride-nub {
|
.joyride-nub {
|
||||||
&.left {
|
&.left {
|
||||||
|
@ -607,13 +605,15 @@ $column-gutter: 0;
|
||||||
}
|
}
|
||||||
.joyride-content-wrapper {
|
.joyride-content-wrapper {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
margin: 0;
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
overflow-y: auto;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
ul {
|
ul {
|
||||||
list-style-type: none;
|
|
||||||
&.subitems {
|
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
}
|
list-style-type: none;
|
||||||
}
|
}
|
||||||
li {
|
li {
|
||||||
&.title {
|
&.title {
|
||||||
|
|
Loading…
Reference in a new issue