0.1.96 • Published 8 years ago

ember-cli-filepicker v0.1.96

Weekly downloads
108
License
MIT
Repository
github
Last release
8 years ago

Ember-cli-filepicker

npm version Build Status Ember Observer Score

Installation

  • ember install:addon ember-cli-filepicker

Usage

  • Create your filepicker.io key using the following URL: https://www.filepicker.io/.
  • Add your filepicker.io key in your config/environment.js
//config/environment.js
module.exports = function(environment) {
  var ENV = {
    //...
    filepickerKey: '<your-filepicker-key>'
  };
  //...
}
  • Use the filepicker.io documentation for options like extensions and services.
  • In your template:
{{ember-filepicker pickerOptions=pickerOptions onSelection='fileSelected' onClose='onClose' onError='onError'}}
  • The above will use the pick method.
  • You should pass pickerOptions with the pick options (mimetype, services, etc).

  • If you want to use pickAndStore, also pass storeOptions (location, etc):

{{ember-filepicker pickerOptions=pickerOptions storeOptions=storeOptions onSelection='fileSelected' onClose='onClose' onError='onError'}}
  • If you want to use pickMultiple files (without storing them), pass multiple=true :
{{ember-filepicker pickerOptions=pickerOptions multiple=true onSelection='fileSelected' onClose='onClose' onError='onError'}}

Notes

In order to have access to the filepicker instance you can:

  • If Ember.inject.service is supported then in your object you can use:
export default Ember.Component.extend({
	//injecting the filepicker object
	filepicker: Ember.inject.service(),

	someFunction: function(){
		//Use the promise in case you are not sure that your component will be surly initialized after filepicker has been loaded
		this.get('filepicker.promise').then(function(filepicker){
			//do something with filepicker
		});

		//OR if you are sure filepicker has already been loaded use:
		this.get('filepicker.instance')
	}
});
  • Otherwise, you can use the lookup method:
export default Ember.Component.extend({
	//injecting the filepicker object
	filepicker: Ember.inject.service(),

	someFunction: function(){
		var filepicker = this.container.lookup('service:filepicker');
		//do something with the filepicker.instance or filepicker.promise
	}
});

Running

Running Tests

  • npm test (Runs ember try:testall to test your addon against multiple Ember versions)
  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit http://ember-cli.com/.

0.1.96

8 years ago

0.1.95

9 years ago

0.1.9

9 years ago

0.1.8

9 years ago

0.1.7

9 years ago

0.1.6

9 years ago

0.1.5

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago

0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago