Skip to content

Commit

Permalink
feat: open file option on preview
Browse files Browse the repository at this point in the history
  • Loading branch information
ramiresviana authored and o1egl committed Aug 20, 2021
1 parent c63cc5a commit 76add9e
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 7 deletions.
28 changes: 28 additions & 0 deletions frontend/src/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,34 @@ main .spinner .bounce2 {
height: 100%;
}

#previewer .preview .info {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 1.5em;
color: #fff;
}
#previewer .preview .info .title {
margin-bottom: 1em;
}
#previewer .preview .info .title i {
display: block;
margin-bottom: .1em;
font-size: 4em;
}
#previewer .preview .info .button {
display: inline-block;
}
#previewer .preview .info .button:hover {
background-color: rgba(255, 255, 255, 0.2)
}
#previewer .preview .info .button i {
display: block;
margin-bottom: 4px;
font-size: 1.3em;
}

#previewer .pdf {
width: 100%;
height: 100%;
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@
"size": "Size",
"sortByLastModified": "Sort by last modified",
"sortByName": "Sort by name",
"sortBySize": "Sort by size"
"sortBySize": "Sort by size",
"noPreview": "Preview is not available for this file."
},
"help": {
"click": "select file or directory",
Expand Down
31 changes: 25 additions & 6 deletions frontend/src/views/files/Preview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,31 @@
class="pdf"
:data="raw"
></object>
<a v-else-if="req.type == 'blob'" :href="downloadUrl">
<h2 class="message">
{{ $t("buttons.download") }}
<i class="material-icons">file_download</i>
</h2>
</a>
<div v-else-if="req.type == 'blob'" class="info">
<div class="title">
<i class="material-icons">feedback</i>
{{ $t("files.noPreview") }}
</div>
<div>
<a target="_blank" :href="downloadUrl" class="button button--flat">
<div>
<i class="material-icons">file_download</i
>{{ $t("buttons.download") }}
</div>
</a>
<a
target="_blank"
:href="downloadUrl + '&inline=true'"
class="button button--flat"
v-if="!req.isDir"
>
<div>
<i class="material-icons">open_in_new</i
>{{ $t("buttons.openFile") }}
</div>
</a>
</div>
</div>
</div>
</template>

Expand Down

0 comments on commit 76add9e

Please sign in to comment.