Skip to content

Commit 76add9e

Browse files
ramiresvianao1egl
authored andcommitted
feat: open file option on preview
1 parent c63cc5a commit 76add9e

File tree

3 files changed

+55
-7
lines changed

3 files changed

+55
-7
lines changed

frontend/src/css/styles.css

+28
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,34 @@ main .spinner .bounce2 {
205205
height: 100%;
206206
}
207207

208+
#previewer .preview .info {
209+
position: absolute;
210+
top: 50%;
211+
left: 50%;
212+
transform: translate(-50%, -50%);
213+
font-size: 1.5em;
214+
color: #fff;
215+
}
216+
#previewer .preview .info .title {
217+
margin-bottom: 1em;
218+
}
219+
#previewer .preview .info .title i {
220+
display: block;
221+
margin-bottom: .1em;
222+
font-size: 4em;
223+
}
224+
#previewer .preview .info .button {
225+
display: inline-block;
226+
}
227+
#previewer .preview .info .button:hover {
228+
background-color: rgba(255, 255, 255, 0.2)
229+
}
230+
#previewer .preview .info .button i {
231+
display: block;
232+
margin-bottom: 4px;
233+
font-size: 1.3em;
234+
}
235+
208236
#previewer .pdf {
209237
width: 100%;
210238
height: 100%;

frontend/src/i18n/en.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@
6363
"size": "Size",
6464
"sortByLastModified": "Sort by last modified",
6565
"sortByName": "Sort by name",
66-
"sortBySize": "Sort by size"
66+
"sortBySize": "Sort by size",
67+
"noPreview": "Preview is not available for this file."
6768
},
6869
"help": {
6970
"click": "select file or directory",

frontend/src/views/files/Preview.vue

+25-6
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,31 @@
8989
class="pdf"
9090
:data="raw"
9191
></object>
92-
<a v-else-if="req.type == 'blob'" :href="downloadUrl">
93-
<h2 class="message">
94-
{{ $t("buttons.download") }}
95-
<i class="material-icons">file_download</i>
96-
</h2>
97-
</a>
92+
<div v-else-if="req.type == 'blob'" class="info">
93+
<div class="title">
94+
<i class="material-icons">feedback</i>
95+
{{ $t("files.noPreview") }}
96+
</div>
97+
<div>
98+
<a target="_blank" :href="downloadUrl" class="button button--flat">
99+
<div>
100+
<i class="material-icons">file_download</i
101+
>{{ $t("buttons.download") }}
102+
</div>
103+
</a>
104+
<a
105+
target="_blank"
106+
:href="downloadUrl + '&inline=true'"
107+
class="button button--flat"
108+
v-if="!req.isDir"
109+
>
110+
<div>
111+
<i class="material-icons">open_in_new</i
112+
>{{ $t("buttons.openFile") }}
113+
</div>
114+
</a>
115+
</div>
116+
</div>
98117
</div>
99118
</template>
100119

0 commit comments

Comments
 (0)