-
-
Notifications
You must be signed in to change notification settings - Fork 237
Template Helpers
There are two types of UI helpers available. First, some of the FS.File
instance methods will work when called in templates, too. These are available
to you automatically and are documented here. Second, some additional useful helpers are provided
in the optional cfs-ui package.
These make it easy to render a delete button or an upload progress bar
and more. Refer to the cfs-ui
readme.
Some of the FS.File API methods are designed to be usable as UI helpers.
Returns the HTTP file URL for the current FS.File.
Use with an FS.File
instance as the current context.
Specify a store
attribute to get the URL for a specific store. If you don't
specify the store name, the URL will be for the copy in the first defined store.
{{#each images}}
URL: {{this.url}}
<img src="{{this.url store='thumbnail'}}" alt="thumbnail">
{{/each}}
This is actually using the url method, which is added to the FS.File
prototype by the cfs:access-point
package. You can use any of the options mentioned in the API documentation, and you can call it from client and server code.
Returns true if the copy of this file in the specified store has an image content type. If the file object is unmounted or was not saved in the specified store, the content type of the original file is checked instead.
Use with an FS.File
instance as the current context.
{{#if isImage}}
{{/if}}
{{#if isImage store='thumbnail'}}
{{/if}}
Returns true if the copy of this file in the specified store has an audio content type. If the file object is unmounted or was not saved in the specified store, the content type of the original file is checked instead.
Use with an FS.File
instance as the current context.
{{#if isAudio}}
{{/if}}
{{#if isAudio store='thumbnail'}}
{{/if}}
Returns true if the copy of this file in the specified store has a video content type. If the file object is unmounted or was not saved in the specified store, the content type of the original file is checked instead.
Use with an FS.File
instance as the current context.
{{#if isVideo}}
{{/if}}
{{#if isVideo store='thumbnail'}}
{{/if}}
Returns true if all the data for the file has been successfully received on the server. It may not have been stored yet.
Use with an FS.File
instance as the current context.
{{#with fileObj}}
{{#if isUploaded}}
{{/if}}
{{/with}}
footer25555555