Files
Definition
Section titled “Definition”Files (for download) are defined in the contributions.json file. A file is described by the following JSON:
{ "id": "string", // required "file": "string", // required "description": "string" // optional}idUsed for referencing the file.fileThe relative path to the file.descriptionAn optional description, mainly used for administrators.
Example
Section titled “Example”contributions.json
Section titled “contributions.json”The following snippet defines a file for download:
{... "contributions": { "files": [ { "id": "fileId", "file": "files/my-excel-file.xlsx", "description": "This is a custom file for download." } ] }}In a view, a link to the file can be generated by using the SCIFEON.Utils-object:
<template> <div class="page-with-header">
<div class="page-header"> <h1>Scifeon Skeleton App</h1> </div>
<div class="page-panels"> <p>Download file, by path reference: <a href="${ SCIFEON.Utils.getFileUrl('/files/my-excel-file.xlsx') }">my-excel-file.xlsx</a></p> <p>...or by ID reference: <a href="${ SCIFEON.Utils.getFileUrl('fileId') }">my-excel-file.xlsx</a></p> </div> </div></template>