Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ module.exports = {
'@apostrophecms/color-field': {},
'@apostrophecms/oembed-field': {},
'@apostrophecms/video-widget': {},
'@apostrophecms/file-widget': {},
'@apostrophecms/ui': {},
'@apostrophecms/user': {},
'@apostrophecms/settings': {},
Expand Down
18 changes: 18 additions & 0 deletions modules/@apostrophecms/file-widget/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
extend: '@apostrophecms/widget-type',
options: {
label: 'apostrophe:file',
icon: 'file-document-icon'
},
fields: {
add: {
_file: {
type: 'relationship',
label: 'apostrophe:file',
max: 1,
required: true,
withType: '@apostrophecms/file'
}
}
}
};
16 changes: 16 additions & 0 deletions modules/@apostrophecms/file-widget/views/widget.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{% if data.options.className %}
{% set className = data.options.className %}
{% elif data.manager.options.className %}
{% set className = data.manager.options.className %}
{% endif %}

{% set file = data.widget._file[0] %}
<div
{% if className %} class="{{ className }}"{% endif %}
>
{% if file %}
<a href="{{ file._url }}" download>{{ file.title }}</a>
{% else %}
{{ __t('apostrophe:noFileSelected') }}
{% endif %}
</div>
1 change: 1 addition & 0 deletions modules/@apostrophecms/i18n/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@
"nextPage": "Nächste Seite",
"no": "Nein",
"noDraftSubmissions": "Keine Entwürfe",
"noFileSelected": "Keine Datei ausgewählt",
"noItemsAdded": "Keine Elemente hinzugefügt",
"noItemsSelected": "Keine Elemente ausgewählt",
"noJustSwitchLocales": "Nein, nur die Sprache wechseln",
Expand Down
1 change: 1 addition & 0 deletions modules/@apostrophecms/i18n/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@
"nextPage": "Next Page",
"no": "No",
"noDraftSubmissions": "No Draft Submissions to Manage",
"noFileSelected": "No file selected",
"noItemsAdded": "No Items Added",
"noItemsSelected": "No Items Selected",
"noJustSwitchLocales": "No, just switch locales",
Expand Down
1 change: 1 addition & 0 deletions modules/@apostrophecms/i18n/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@
"nextPage": "Siguiente Página",
"no": "No",
"noDraftSubmissions": "Ninguna Propuesta de Borrador a Administrar",
"noFileSelected": "No hay ningún archivo seleccionado",
"noItemsAdded": "No se añadieron elementos",
"noItemsSelected": "Ningún Elemento Seleccionado",
"noJustSwitchLocales": "No, sólo cambiar de configuración regional",
Expand Down
1 change: 1 addition & 0 deletions modules/@apostrophecms/i18n/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@
"nextPage": "Page suivante",
"no": "Non",
"noDraftSubmissions": "Pas de soumission de brouillon à gérer",
"noFileSelected": "Aucun fichier sélectionné",
"noItemsAdded": "Aucun élément ajouté",
"noItemsSelected": "Pas d'élément sélectionné",
"noJustSwitchLocales": "Non, changer seulement de paramètre régional",
Expand Down
1 change: 1 addition & 0 deletions modules/@apostrophecms/i18n/i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@
"nextPage": "Pagina successiva",
"no": "No",
"noDraftSubmissions": "Nessuna proposta in bozza da gestire",
"noFileSelected": "Nessun file selezionato",
"noItemsAdded": "Nessun elemento aggiunto",
"noItemsSelected": "Nessun elemento selezionato",
"noJustSwitchLocales": "No, cambia solo il locale",
Expand Down
1 change: 1 addition & 0 deletions modules/@apostrophecms/i18n/i18n/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@
"nextPage": "Próxima Página",
"no": "Não",
"noDraftSubmissions": "Nenhum envio de rascunho para gerenciar",
"noFileSelected": "Nenhum arquivo selecionado",
"noItemsAdded": "Nenhum Item Adicionado",
"noItemsSelected": "Nenhum item selecionado",
"noJustSwitchLocales": "Não, apenas mude de localização",
Expand Down
1 change: 1 addition & 0 deletions modules/@apostrophecms/i18n/i18n/sk.json
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@
"nextPage": "Ďalšia strana",
"no": "Nie",
"noDraftSubmissions": "Žiadne návrhy, ktoré by bolo možné spravovať",
"noFileSelected": "Nie je vybraný žiadny súbor",
"noItemsAdded": "Nebol pridaný žiadny prvok",
"noItemsSelected": "Nie sú vybraté žiadne položky",
"noJustSwitchLocales": "Nie, stačí zmeniť jazykovú mutáciu",
Expand Down
3 changes: 2 additions & 1 deletion modules/@apostrophecms/layout-column-widget/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ module.exports = {
widgets: {
'@apostrophecms/rich-text': {},
'@apostrophecms/image': {},
'@apostrophecms/video': {}
'@apostrophecms/video': {},
'@apostrophecms/file': {}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one of the straightforward core offerings, so I put it in column defaults.

}
}
}
Expand Down