The Open Source kanban (built with Meteor). Keep variable/table/field names camelCase. For translations, only add Pull Request changes to wekan/i18n/en.i18n.json , other translations are done at https://transifex.com/wekan/wekan only.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
wekan/packages/wekan-cfs-collection/internal.api.md

9.8 KiB

Public and Private API

API documentation automatically generated by docmeteor.


File: "common.js" Where: {client|server}


#############################################################################

COLLECTION FS

#############################################################################

new fs.Collection(name, options)  Anywhere

This method Collection is defined in FS

Arguments

  • name {string}

A name for the collection

  • options {Object}

    An array of stores in which files should be saved. At least one is required.

    • filter {Object} (Optional)

    Filter definitions

    • chunkSize {Number} (Optional, Default = 131072)

    Override the chunk size in bytes for uploads and downloads

Returns {undefined}

FS.Collection = function(name, options) { ... common.js:17


File: "api.common.js" Where: {client|server}


fsCollection.insert(fileRef, [callback])  Anywhere

This method insert is defined in prototype of FS.Collection

Arguments

File data reference

  • callback {function} (Optional)

Callback function(error, fileObj)

Returns {FS.File} The file object Meteor docs

FS.Collection.prototype.insert = function(fileRef, callback) { ... api.common.js:8

fsCollection.update(selector, modifier, [options], [callback])  Anywhere

This method update is defined in prototype of FS.Collection

Arguments

  • selector {FS.File|object}
  • modifier {object}
  • options {object} (Optional)
  • callback {function} (Optional) Meteor docs

FS.Collection.prototype.update = function(selector, modifier, options, callback) { ... api.common.js:71

fsCollection.remove(selector, [callback])  Anywhere

This method remove is defined in prototype of FS.Collection

Arguments

FS.Collection.prototype.remove = function(selector, callback) { ... api.common.js:92

fsCollection.findOne(selector)  Anywhere

This method findOne is defined in prototype of FS.Collection

Arguments

var images = new FS.Collection( ... );
// Get the file object
var fo = images.findOne({ _id: 'NpnskCt6ippN6CgD8' });

FS.Collection.prototype.findOne = function(selector) { ... api.common.js:122

fsCollection.find(selector)  Anywhere

This method find is defined in prototype of FS.Collection

Arguments

var images = new FS.Collection( ... );
// Get the all file objects
var files = images.find({ _id: 'NpnskCt6ippN6CgD8' }).fetch();

FS.Collection.prototype.find = function(selector) { ... api.common.js:138

fsCollection.allow(options)  Anywhere

This method allow is defined in prototype of FS.Collection

Arguments

  • options {object}

    • download {function}

    Function that checks if the file contents may be downloaded

    • insert {function}
    • update {function}
    • remove {function}

    Functions that look at a proposed modification to the database and return true if it should be allowed

    • fetch {[string]} (Optional)

    Optional performance enhancement. Limits the fields that will be fetched from the database for inspection by your update and remove functions

Meteor docs Example:

var images = new FS.Collection( ... );
// Get the all file objects
var files = images.allow({
insert: function(userId, doc) { return true; },
update: function(userId, doc, fields, modifier) { return true; },
remove: function(userId, doc) { return true; },
download: function(userId, fileObj) { return true; },
});

FS.Collection.prototype.allow = function(options) { ... api.common.js:164

fsCollection.deny(options)  Anywhere

This method deny is defined in prototype of FS.Collection

Arguments

  • options {object}

    • download {function}

    Function that checks if the file contents may be downloaded

    • insert {function}
    • update {function}
    • remove {function}

    Functions that look at a proposed modification to the database and return true if it should be denyed

    • fetch {[string]} (Optional)

    Optional performance enhancement. Limits the fields that will be fetched from the database for inspection by your update and remove functions

Meteor docs Example:

var images = new FS.Collection( ... );
// Get the all file objects
var files = images.deny({
insert: function(userId, doc) { return true; },
update: function(userId, doc, fields, modifier) { return true; },
remove: function(userId, doc) { return true; },
download: function(userId, fileObj) { return true; },
});

FS.Collection.prototype.deny = function(options) { ... api.common.js:200


File: "api.client.js" Where: {client}


_eventCallback(templateName, selector, dataContext, evt, temp, fsFile)  Client

This method is private

Arguments

  • templateName {string}

Name of template to apply events on

  • selector {string}

The element selector eg. "#uploadField"

  • dataContext {object}

The event datacontext

  • evt {object}

The event object { error, file }

  • temp {object}

The template instance

File that triggered the event

var _eventCallback = function fsEventCallback(templateName, selector, dataContext, evt, temp, fsFile) { ... api.client.js:10

_eachFile(files, metadata, callback)  Client

This method is private

Arguments

  • files {array}

List of files to iterate over

  • metadata {object}

Data to attach to the files

  • callback {function}

Function to pass the prepared FS.File object

var _eachFile = function(files, metadata, callback) { ... api.client.js:36

fsCollection.acceptDropsOn(templateName, selector, [metadata])  Client

This method acceptDropsOn is defined in FS.Collection

Arguments

  • templateName {string}

Name of template to apply events on

  • selector {string}

The element selector eg. "#uploadField"

  • metadata {object|function} (Optional)

Data/getter to attach to the file objects

Using this method adds an uploaded and uploadFailed event to the template events. The event object contains { error, file }

Example:

.dropzone {
border: 2px dashed silver;
height: 5em;
padding-top: 3em;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
-ms-border-radius: 8px;
-o-border-radius: 8px;
border-radius: 8px;
}
<template name="hello">
Choose file to upload:<br/>
<div id="dropzone" class="dropzone">
<div style="text-align: center; color: gray;">Drop file to upload</div>
</div>
</template>
Template.hello.events({
'uploaded #dropzone': function(event, temp) {
console.log('Event Uploaded: ' + event.file._id);
}
});
images.acceptDropsOn('hello', '#dropzone');

FS.Collection.prototype.acceptDropsOn = function(templateName, selector, metadata) { ... api.client.js:99

fsCollection.acceptUploadFrom(templateName, selector, [metadata])  Client

This method acceptUploadFrom is defined in FS.Collection

Arguments

  • templateName {string}

Name of template to apply events on

  • selector {string}

The element selector eg. "#uploadField"

  • metadata {object|function} (Optional)

Data/getter to attach to the file objects

Using this method adds an uploaded and uploadFailed event to the template events. The event object contains { error, file }

Example:

<template name="hello">
Choose file to upload:<br/>
<input type="file" id="files" multiple/>
</template>
Template.hello.events({
'uploaded #files': function(event, temp) {
console.log('Event Uploaded: ' + event.file._id);
}
});
images.acceptUploadFrom('hello', '#files');

FS.Collection.prototype.acceptUploadFrom = function(templateName, selector, metadata) { ... api.client.js:156