fix pdf export + add download_as_pdf template string and action (#110)

* fix pdf export
add download_as_pdf template string and action

* after pdf export click
- close dropdown
- open in new tab

* proper fix function
This commit is contained in:
banglashi
2020-11-02 20:07:15 +01:00
committed by GitHub
parent 7c6d5c83db
commit 6257e3410e
8 changed files with 15 additions and 3 deletions

View File

@@ -303,6 +303,7 @@
"sharing": "sharing", "sharing": "sharing",
"list": "Liste", "list": "Liste",
"download_space": "Space Herunterladen", "download_space": "Space Herunterladen",
"download_as_pdf": "Space als PDF herunterladen",
"duplicate_destination_folder": "Zielordner für Duplikat", "duplicate_destination_folder": "Zielordner für Duplikat",
"type": "Typ", "type": "Typ",
"promote": "Befördern", "promote": "Befördern",

View File

@@ -308,6 +308,7 @@
"list": "Export List", "list": "Export List",
"link": "Link", "link": "Link",
"download_space": "Download Space", "download_space": "Download Space",
"download_as_pdf": "Download Space as PDF",
"type": "Type", "type": "Type",
"download": "Download", "download": "Download",
"Previous Zone": "Previous Zone", "Previous Zone": "Previous Zone",

View File

@@ -308,6 +308,7 @@
"list": "Lista para Exportar", "list": "Lista para Exportar",
"link": "Enlace", "link": "Enlace",
"download_space": "Espacio de Descarga", "download_space": "Espacio de Descarga",
"download_as_pdf": "Descargar espacio en PDF",
"type": "Tipo", "type": "Tipo",
"download": "Descarga", "download": "Descarga",
"Previous Zone": "Zona Previa", "Previous Zone": "Zona Previa",

View File

@@ -301,6 +301,7 @@
"goto_folder": "Aller au dossier %s", "goto_folder": "Aller au dossier %s",
"stay_here": "Reste ici", "stay_here": "Reste ici",
"download_space": "télécharger un espace", "download_space": "télécharger un espace",
"download_as_pdf": "télécharger un espace comme PDF",
"type": "Type", "type": "Type",
"Previous Zone": "Zone précédent", "Previous Zone": "Zone précédent",
"Next Zone": "Zone suivante", "Next Zone": "Zone suivante",

View File

@@ -308,6 +308,7 @@
"list": "lista", "list": "lista",
"link": "Ligam", "link": "Ligam",
"download_space": "Telecargar espaci", "download_space": "Telecargar espaci",
"download_space_as_pdf": "Telecargar espaci PDF",
"type": "Tipe", "type": "Tipe",
"download": "Telecargar", "download": "Telecargar",
"Previous Zone": "Zòna precedenta", "Previous Zone": "Zòna precedenta",

View File

@@ -614,10 +614,11 @@ var SpacedeckSpaces = {
}, },
download_space_as_pdf: function(space) { download_space_as_pdf: function(space) {
this.close_dropdown();
this.global_spinner = true; this.global_spinner = true;
get_resource("/spaces/" + space._id + "/pdf", function(o) { get_resource("/spaces/" + space._id + "/pdf", function(o) {
this.global_spinner = false; this.global_spinner = false;
location.href = o.url; window.open(o.url, "_blank");
}.bind(this), function(xhr) { }.bind(this), function(xhr) {
this.global_spinner = false; this.global_spinner = false;
alert("PDF export problem (" + xhr.status + ")."); alert("PDF export problem (" + xhr.status + ").");

View File

@@ -114,7 +114,12 @@ router.get('/pdf', function(req, res, next) {
res.status(201).json({ res.status(201).json({
url: url url: url
}); });
fs.unlink(local_path); fs.unlink(local_path, function(){
if (err) console.log('unlink', err);
else {
console.log('unlink', local_path);
}
});
}); });
}, (err) => { }, (err) => {
res.status(500).json({ res.status(500).json({

View File

@@ -156,6 +156,7 @@
<div class="dropdown-menu" role="menu"> <div class="dropdown-menu" role="menu">
<ul class="select-list"> <ul class="select-list">
<li v-on:click="download_space_as_pdf(item)"><span><span class="icon icon-sm icon-clipboard"></span><%= __('download_as_pdf') %></span></li>
<li v-on:click="rename_space(item)"><span><span class="icon icon-sm icon-tag"></span><%= __('rename') %></span></li> <li v-on:click="rename_space(item)"><span><span class="icon icon-sm icon-tag"></span><%= __('rename') %></span></li>
<li v-on:click="delete_space(item)"><span><span class="icon icon-sm icon-trash"></span><%= __('delete') %></span></li> <li v-on:click="delete_space(item)"><span><span class="icon icon-sm icon-trash"></span><%= __('delete') %></span></li>
</ul> </ul>