Substantially improved item libraries UI, locked behind Patreon tier 5
This commit is contained in:
38
app/client/views/library/libraries.js
Normal file
38
app/client/views/library/libraries.js
Normal 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);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user