Oracle Blog´s: original link
Here's a handy custom component (i.e., a CCA component) for zipping files and downloading them, in an Oracle JET application:
In an application, the above component is rendered as follows:
What happens when "demo" is changed to "sample" in the text field above and then the "Download" button is clicked? Well, when you do that, a download process begins and you'll have a ZIP file, with this content, yes!, a CCA component:
So... what this blog entry is about is... how to create a CCA component for downloading CCA components...
The structure of the CCA component you'll create is as follows:
Here's the JSON file,
Here's the view, in
Here's the business logic in the viewModel,
The above assumes you've set up these two libraries in your application:I.e., somehow, via Bower or otherwise, you've included them like this:
In 'main.js', you should have these references in the 'paths' of 'requirejs.config': 'file-saver': 'libs/file-saver/FileSaver', 'jszip': 'libs/jszip/dist/jszip'
And, to wrap things up, tying everything together, you have "loader.js":
Now, whenever you include the handy custom component, anywhere in your application, the user can click "Download" and then they'll have a ZIP file downloaded with the specified content in the specified files.