diff --git a/ayanova/src/api/gzutil.js b/ayanova/src/api/gzutil.js index 7d31b635..879e5bb0 100644 --- a/ayanova/src/api/gzutil.js +++ b/ayanova/src/api/gzutil.js @@ -213,6 +213,48 @@ export default { default: return null; } + }, + //https://gist.github.com/colemanw/9c9a12aae16a4bfe2678de86b661d922 + getFontAwesomeIconFromMIME: function(mimeType) { + // List of official MIME Types: http://www.iana.org/assignments/media-types/media-types.xhtml + var icon_classes = { + // Media + image: "fa-file-image", + audio: "fa-file-audio", + video: "fa-file-video", + // Documents + "application/pdf": "fa-file-pdf", + "application/msword": "fa-file-word", + "application/vnd.ms-word": "fa-file-word", + "application/vnd.oasis.opendocument.text": "fa-file-word", + "application/vnd.openxmlformats-officedocument.wordprocessingml": + "fa-file-word", + "application/vnd.ms-excel": "fa-file-excel", + "application/vnd.openxmlformats-officedocument.spreadsheetml": + "fa-file-excel", + "application/vnd.oasis.opendocument.spreadsheet": "fa-file-excel", + "application/vnd.ms-powerpoint": "fa-file-powerpoint", + "application/vnd.openxmlformats-officedocument.presentationml": + "fa-file-powerpoint", + "application/vnd.oasis.opendocument.presentation": "fa-file-powerpoint", + "text/plain": "fa-file-text", + "text/html": "fa-file-code", + "application/json": "fa-file-code", + // Archives + "application/gzip": "fa-file-archive", + "application/zip": "fa-file-archive" + }; + + for (var key in icon_classes) { + if (icon_classes.hasOwnProperty(key)) { + if (mimeType.search(key) === 0) { + // Found it + return icon_classes[key]; + } + } else { + return "fa-file"; + } + } } //new functions above here diff --git a/ayanova/src/components/attachment-control.vue b/ayanova/src/components/attachment-control.vue index 757f8cc8..924061ec 100644 --- a/ayanova/src/components/attachment-control.vue +++ b/ayanova/src/components/attachment-control.vue @@ -108,7 +108,7 @@ export default { height: 300, items: [ { - icon: "fa-file", + icon: "fa-file-image", title: "drawings.pdf", subtitle: "2020-01-09" },