]> git.immae.eu Git - perso/Immae/Projets/Nodejs/Surfer.git/commitdiff
Show preview drawer instead of directly opening files in a new tab
authorJohannes Zellner <johannes@cloudron.io>
Sun, 5 Jan 2020 18:27:30 +0000 (19:27 +0100)
committerJohannes Zellner <johannes@cloudron.io>
Sun, 5 Jan 2020 18:27:30 +0000 (19:27 +0100)
frontend/css/style.css
frontend/index.html
frontend/js/app.js

index 7be973a429d98b45b2d416995cc0298c065cf3d3..1046e50c12a58c1bcf8fb622d99dc1f00e4a15a5 100644 (file)
@@ -89,6 +89,10 @@ a:hover, a:focus {
     transition: background-color .1s ease;
 }
 
+.el-drawer__header {
+    margin-bottom: 10px;
+}
+
 /* welcome and 404 page */
 .container-center {
     display: flex;
index 95fe31b45fab43632db335d49f96c800568d7f9c..41b474957716cef80e1d03cc5dce2f04fbe85c3c 100644 (file)
       </center>
     </div>
 
+    <el-drawer :title="activeEntry.filePath":with-header="false" :visible.sync="previewDrawerVisible" direction="rtl" size="50%">
+      <div style="display: flex; flex-direction: column; height: 100%;">
+        <iframe :src="activeEntry.fullPath" style="width: 100%; height: 100%; border: none; margin: 10px;"></iframe>
+        <center>
+          <el-button size="small" icon="el-icon-download" style="margin: 10px;" @click.stop="onDownload(activeEntry)">Download</el-button>
+          <a :href="activeEntry.fullPath" target="_blank">
+            <el-button size="small" icon="el-icon-link" style="margin: 10px;">Open</el-button>
+          </a>
+        </center>
+      </div>
+    </el-drawer>
+
   </el-main>
   <el-footer v-show="uploadStatus.busy">
     <el-row v-if="uploadStatus.uploadListCount">
index d99a91e05f0b20bcb73ca1db072dc09f74614a93..9ce073e39383afa76c0a2ad189bfeabdce131e33 100644 (file)
@@ -146,7 +146,11 @@ function open(row, column, event) {
         return;
     }
 
-    window.open(encode(path));
+    app.activeEntry = row;
+    app.activeEntry.fullPath = encode(sanitize(app.path + '/' + row.filePath));
+    app.previewDrawerVisible = true
+
+    // window.open(encode(path));
 }
 
 function uploadFiles(files) {
@@ -280,6 +284,8 @@ var app = new Vue({
             password: '',
             busy: false
         },
+        previewDrawerVisible: false,
+        activeEntry: {},
         entries: [],
         accessTokens: [],
         accessTokensDialogVisible: false