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",
"list": "Liste",
"download_space": "Space Herunterladen",
"download_as_pdf": "Space als PDF herunterladen",
"duplicate_destination_folder": "Zielordner für Duplikat",
"type": "Typ",
"promote": "Befördern",

View File

@@ -308,6 +308,7 @@
"list": "Export List",
"link": "Link",
"download_space": "Download Space",
"download_as_pdf": "Download Space as PDF",
"type": "Type",
"download": "Download",
"Previous Zone": "Previous Zone",
@@ -321,4 +322,4 @@
"mute_present": "Unfollow",
"follow_present_help": "If someone else is presenting this Space, the other members automatically follow the presentation. Switch following on or off with this button.",
"export": "export"
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -156,6 +156,7 @@
<div class="dropdown-menu" role="menu">
<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="delete_space(item)"><span><span class="icon icon-sm icon-trash"></span><%= __('delete') %></span></li>
</ul>