NPM Resource Changed ? Pending

User tests: Successful: Unsuccessful:

avatar Quy
Quy
17 Jan 2022

Summary of Changes

In Media Manager, documents are displayed as PDF icon. This PR displays the respective icon based on mimetype.

Testing Instructions

Go to Media Manager.
Upload files of types txt, pdf, word, excel, powerpoint.

Thanks @dgrammatiko for the code!

avatar Quy Quy - open - 17 Jan 2022
avatar Quy Quy - change - 17 Jan 2022
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 17 Jan 2022
Category Administration com_media NPM Change
avatar dgrammatiko
dgrammatiko - comment - 17 Jan 2022

@Quy please add any meaningful mime type needed here from: https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types

avatar Quy
Quy - comment - 17 Jan 2022

The i icon confirms that the mimetype is correct, but it is still displaying the generic file icon. ???

avatar dgrammatiko
dgrammatiko - comment - 17 Jan 2022

Check that fas fa-file-pdf, etc actually exist, the code in the other PR was a bit of pseudo on terms of the actual font awsome classes

avatar Quy
Quy - comment - 17 Jan 2022

fas fa-file-pdf is correct and same as before the PR. It appears to not be detecting the mimetype thus defaulting to fas fa-file

avatar dgrammatiko
dgrammatiko - comment - 17 Jan 2022

Check what the actual mime type is <span v-bind:class="getFileClass" data-mime="{{ item.mime_type}}"/>
Also add break; after each return <-- No don't do that, that's stupid

avatar Quy
Quy - comment - 17 Jan 2022

<span class="fas fa-file" data-mime="{{item.mime_type}}"></span>

avatar dgrammatiko
dgrammatiko - comment - 17 Jan 2022

Add it to line 16

    <div class="media-browser-item-info">
      {{ item.name }} {{ item.filetype }} {{item.mime_type}}
    </div>
avatar Quy
Quy - comment - 17 Jan 2022

{{ item.filetype }} = empty
{{ item.mime_type }} = application/pdf

avatar dgrammatiko
dgrammatiko - comment - 17 Jan 2022

Change getFileClass: (item) => { to getFileClass() {

avatar Quy
Quy - comment - 18 Jan 2022

ReferenceError: item is not defined

  computed: {
    /* Get the hashed URL */
    getFileClass() {
      switch (item.mime_type) {
        case 'application/pdf':
          return 'fas fa-file-pdf';
        case 'application/msword':
        case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
          return 'fas fa-file-word';
        case 'application/vnd.ms-excel':
        case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
          return 'fas fa-file-excel';
        case 'application/vnd.ms-powerpoint':
        case 'application/vnd.openxmlformats-officedocument.presentationml.presentation':
          return 'fas fa-file-powerpoint';
        default:
          return 'fas fa-file';
      }
    },
  },
avatar dgrammatiko
dgrammatiko - comment - 18 Jan 2022

this.item then

avatar Quy
Quy - comment - 18 Jan 2022

Hallelujah! Thank you!!

avatar Quy Quy - change - 18 Jan 2022
Labels Added: ? NPM Resource Changed
avatar Quy Quy - change - 20 Jan 2022
Title
[4.0] Display doc icon based on mimetype
[4.1] Display doc icon based on mimetype
avatar Quy Quy - edited - 20 Jan 2022
avatar Quy
Quy - comment - 3 Feb 2022

Will redo later.

avatar Quy Quy - close - 3 Feb 2022
avatar Quy Quy - change - 3 Feb 2022
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2022-02-03 14:56:46
Closed_By Quy
Labels Added: ?
Removed: ?

Add a Comment

Login with GitHub to post a comment