diff options
author | Johannes Zellner <johannes@cloudron.io> | 2020-01-05 19:27:30 +0100 |
---|---|---|
committer | Johannes Zellner <johannes@cloudron.io> | 2020-01-05 19:27:30 +0100 |
commit | f97b51a9151d0d886e2a4703c91494de55e6d5ef (patch) | |
tree | 534d7e50e1408b92a7b9319d5e94f2d1540e28fd /frontend | |
parent | 383f72f7f5459d85042c6a7e8d1f471052cc01e6 (diff) | |
download | Surfer-f97b51a9151d0d886e2a4703c91494de55e6d5ef.tar.gz Surfer-f97b51a9151d0d886e2a4703c91494de55e6d5ef.tar.zst Surfer-f97b51a9151d0d886e2a4703c91494de55e6d5ef.zip |
Show preview drawer instead of directly opening files in a new tab
Diffstat (limited to 'frontend')
-rw-r--r-- | frontend/css/style.css | 4 | ||||
-rw-r--r-- | frontend/index.html | 12 | ||||
-rw-r--r-- | frontend/js/app.js | 8 |
3 files changed, 23 insertions, 1 deletions
diff --git a/frontend/css/style.css b/frontend/css/style.css index 7be973a..1046e50 100644 --- a/frontend/css/style.css +++ b/frontend/css/style.css | |||
@@ -89,6 +89,10 @@ a:hover, a:focus { | |||
89 | transition: background-color .1s ease; | 89 | transition: background-color .1s ease; |
90 | } | 90 | } |
91 | 91 | ||
92 | .el-drawer__header { | ||
93 | margin-bottom: 10px; | ||
94 | } | ||
95 | |||
92 | /* welcome and 404 page */ | 96 | /* welcome and 404 page */ |
93 | .container-center { | 97 | .container-center { |
94 | display: flex; | 98 | display: flex; |
diff --git a/frontend/index.html b/frontend/index.html index 95fe31b..41b4749 100644 --- a/frontend/index.html +++ b/frontend/index.html | |||
@@ -121,6 +121,18 @@ | |||
121 | </center> | 121 | </center> |
122 | </div> | 122 | </div> |
123 | 123 | ||
124 | <el-drawer :title="activeEntry.filePath":with-header="false" :visible.sync="previewDrawerVisible" direction="rtl" size="50%"> | ||
125 | <div style="display: flex; flex-direction: column; height: 100%;"> | ||
126 | <iframe :src="activeEntry.fullPath" style="width: 100%; height: 100%; border: none; margin: 10px;"></iframe> | ||
127 | <center> | ||
128 | <el-button size="small" icon="el-icon-download" style="margin: 10px;" @click.stop="onDownload(activeEntry)">Download</el-button> | ||
129 | <a :href="activeEntry.fullPath" target="_blank"> | ||
130 | <el-button size="small" icon="el-icon-link" style="margin: 10px;">Open</el-button> | ||
131 | </a> | ||
132 | </center> | ||
133 | </div> | ||
134 | </el-drawer> | ||
135 | |||
124 | </el-main> | 136 | </el-main> |
125 | <el-footer v-show="uploadStatus.busy"> | 137 | <el-footer v-show="uploadStatus.busy"> |
126 | <el-row v-if="uploadStatus.uploadListCount"> | 138 | <el-row v-if="uploadStatus.uploadListCount"> |
diff --git a/frontend/js/app.js b/frontend/js/app.js index d99a91e..9ce073e 100644 --- a/frontend/js/app.js +++ b/frontend/js/app.js | |||
@@ -146,7 +146,11 @@ function open(row, column, event) { | |||
146 | return; | 146 | return; |
147 | } | 147 | } |
148 | 148 | ||
149 | window.open(encode(path)); | 149 | app.activeEntry = row; |
150 | app.activeEntry.fullPath = encode(sanitize(app.path + '/' + row.filePath)); | ||
151 | app.previewDrawerVisible = true | ||
152 | |||
153 | // window.open(encode(path)); | ||
150 | } | 154 | } |
151 | 155 | ||
152 | function uploadFiles(files) { | 156 | function uploadFiles(files) { |
@@ -280,6 +284,8 @@ var app = new Vue({ | |||
280 | password: '', | 284 | password: '', |
281 | busy: false | 285 | busy: false |
282 | }, | 286 | }, |
287 | previewDrawerVisible: false, | ||
288 | activeEntry: {}, | ||
283 | entries: [], | 289 | entries: [], |
284 | accessTokens: [], | 290 | accessTokens: [], |
285 | accessTokensDialogVisible: false | 291 | accessTokensDialogVisible: false |