Skip to content
This repository has been archived by the owner on Aug 8, 2018. It is now read-only.

Views for universe:files package for uploading files/images and You can crop avatar

License

Notifications You must be signed in to change notification settings

vazco/universe-files-blaze-ui

Repository files navigation

vazco/Universe Files Blaze UI

 

-- Abandonware. This package is deprecated! --

 

Using as standalone

for file:

<template name="myFile">
     {{> universeUploadButton name='file' value=doc.avatar class='img-circle'}}
 </template>
Template.myFile.events({
    fileUploaded (e, tmpl, result) {
        console.log('uploaded', result);
    },
    fileError (e, tmpl, error) {
         console.error('uploaded', error);
    }
});

for image:

<template name="myImage">
     {{> universeUploadButton name='image' isImage=true value=doc.avatar class='img-circle'}}
 </template>
  • parameter isImage=true will activate making sizes for uploaded image (default: small, medium, large)
Template.myImage.events({
    fileUploaded (e, tmpl, result) {
        console.log('uploaded', result);
    },
    fileError (e, tmpl, error) {
         console.error('uploaded', error);
    }
});

for avatar:

<template name="myAvatar">
     {{> universeAvatar name='avatar' value=doc.avatar class='img-circle'}}
 </template>
Template.myAvatar.events({
    fileUploaded (e, tmpl, result) {
        console.log('uploaded', result);
    },
    fileError (e, tmpl, error) {
         console.error('uploaded', error);
    }
});

Using with AutoForms

for file:

import {getFileSchemaField} from 'meteor/universe:files-blaze-ui';
// adding to schema:
const mySchema = new SimpleSchema(Object.assign({
        title: {
            type: String
        }
    },
    getFileSchemaField({
        name: 'file',
        isImage: false
    })
));
<template name="myTemplate">
    {{#autoForm schema=getSchema id="myForm"}}
        {{> afQuickField name='title'}}
        {{> afQuickField name='file' class='img-circle' label=false}}
        <button type="submit">Submit</button>
    {{/autoForm}}
</template>

for avatar

import {getFileSchemaField} from 'meteor/universe:files-blaze-ui';
// adding to schema:
const mySchema = new SimpleSchema(Object.assign({
        title: {
            type: String
        }
    },
    getAvatarSchemaField({
        name: 'logo'
    })
));
<template name="myTemplate">
    {{#autoForm schema=getMySchema id="myLogo"}}
        {{> afQuickField name='title'}}
        {{> afQuickField name='logo'  label=false}}
        <button type="submit">Submit</button>
    {{/autoForm}}
</template>

License

Like every package maintained by Vazco, Universe Files Blaze UI is MIT licensed.

About

Views for universe:files package for uploading files/images and You can crop avatar

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •