Substantially improved item libraries UI, locked behind Patreon tier 5

This commit is contained in:
Stefan Zermatten
2019-05-06 14:51:48 +02:00
parent d4864dda5f
commit 81a3ede86e
24 changed files with 493 additions and 248 deletions

View File

@@ -0,0 +1,38 @@
const librarySubs = new SubsManager();
Template.libraries.helpers({
libraries(){
let userId = Meteor.userId();
let subs = Meteor.user() && Meteor.user().profile.librarySubscriptions;
return Libraries.find({
$or: [
{readers: userId},
{writers: userId},
{owner: userId},
{_id: {$in: subs}}
],
}, {
sort: {name: 1},
});
},
});
Template.libraries.events({
"click #addLibrary": function(event, instance){
var libraryId = Libraries.insert({
name: "New Library",
owner: Meteor.userId(),
});
pushDialogStack({
template: "libraryDialog",
data: {libraryId},
element: event.currentTarget,
returnElement: () => instance.find(`.library[data-id='${libraryId}']`),
callback(data){
if (data && data.delete){
Libraries.remove(libraryId);
}
}
});
},
})