Q4Widgets API Documentation

q4.downloads

This widget fetches and displays downloads (also known as "Content Assets") from the Q4 API's.

Below is an example of a download list widget.
- It uses the template option as there is no need for a year/item separation or filter in this example.
- Since it is a past events widget, showFuture is set to false.
- The template will loop through each year, and each item inside that year and render the values of the variabels within.

Script link
q4.api.1.13.6.min.js
Source file
q4.api.js, line 1627

This widget extends the q4.api widget. It has all the options and methods of the parent widget, in addition to those below. See the parent widget's documentation for details.

Examples

<div class="module_container module_container--widget"></div>
<script>
$('.module-awards .module_container--widget').downloads({
     downloadType: 'Company Awards',
     dateFormat: 'MM d, yy',
     loadingMessage: '<p class="loading">Loading...</p>',
     template: (
         '{{#years}}' +
             '<div class="module_container--content">' +
                 '{{#items}}' +
                     '<div class="module_item">' +
                         '<h4>{{title}}</h4>' +
                         '<img src="{{thumb}}" />' +
                         '<p>{{description}}</p>' +
                     '</div>' +
                 '{{/items}}' +
             '</div>' +
         '{{/years}}'
     )
 });
</script>

Options

template string
A Mustache.js template for the download list widget.
  • All the notes documented in the q4.api parent widget are applicable here.
  • This widget supports template, itemTemplate and yearTemplate options.
The template or itemTemplate may contain the following mustache variables:
  • {{title}} - The title of the download item.
  • {{description}} - The download description.
  • {{url}} - The URL of the document.
  • {{date}} - The date of the download.
  • {{type}} - The download list category (ex. Governance Documents, Factsheets).
  • {{fileType}} - The file type.
  • {{size}} - The file size.
  • {{icon}} - The URL of the document's icon.
  • {{thumb}} - The URL of the document's thumbnail image.
  • {{#tags}} - An array of tags for this download item.
    • {{.}} - Tag word
downloadType string
The download list category to pull from. This option is unique to the download list widget.
Default value
null
Example
"Governance Documents"