Grav-plugin-admin: Filepicker and Pagemediaselect displaying the whole list of elements in the folder (even the .md and the subfolders)

Created on 17 Sep 2016  路  7Comments  路  Source: getgrav/grav-plugin-admin

Since the last release of the admin panel I had to take off the pagemediaselect field from my projects because of small bug that makes it unusable.
Here are some screenshots of my problems, I can even give you an access on live projects if it can help.
Here is the bluprint
screen shot 2016-09-17 at 8 12 37 am
Here is the admin screen, as you can see even the subfolders are displayed in the select...
screen shot 2016-09-13 at 9 30 51 am
The most important thing is the following: you cannot close the page edition without forcing because the filepicker continuously detects changes. See the screen bellow.
screen shot 2016-09-13 at 9 32 34 am
Waiting for a fix, I temporary replaced pagemediaselect by a simple text field.
I tested locally, on live sites with MacOS Chrome, Safari and Firefox.

Cheers,
Emmanuel.

The last thing: GRAV ROCKS!!! Your CMS is really addictive, congrats to all of you.

bug

All 7 comments

Thanks, flavio did some work on this field with last release. Assigned to him to investigate.

It might be a separate issue entirely, but it seems the filepicker behaviour depends very much on the context and luck. I have the same problem as OP when I use filepickers inside a "list" type.

Either:

            header.slider:
              type: list
              label: Images
              fields:
                .text:
                  type: text
                  label: Titre
                .image:
                  type: filepicker
                  label: Image
                  folder: 'self@/'
                  preview_images: true
                  acccept:
                    - .png
                    - .jpg
                    - .jpeg
                    - .gif

Or:

            header.slider:
              type: list
              label: Images
              fields:
                .text:
                  type: text
                  label: Titre
                .image:
                  type: filepicker
                  label: Image
                  folder: 'self@/'
                  preview_images: true
                  acccept:
                    - image/*

will show images and normal .md files when the select is activated.

However in my case, a single filepicker in the same page won't display any file if the "accept" property is set to image/* (a list of image extensions works).

            header.bigimage:
              type: filepicker
              label: Image
              folder: 'self@/'
              preview_images: true
              accept:
                - image/*

Should I open a separate issue for the latter?

In the filepicker, accept only allows a list of file extensions, not a mime type, as documented in https://learn.getgrav.org/forms/blueprints/fields-available#the-filepicker-field. The reason is you're not uploading a file, and so you know the mime type of the uploaded file. We could have a mapping of MIME to file extensions, but not sure it's worth it / useful.

In the first example, acccept is spelled wrong, maybe that's the first issue.

Thanks a lot for your help Flavio and indeed I didn't see the spelling mistake. It fixes the first issue. Now I have the list with the thumbnails if I wish.
But I still cannot leave the page without the warning "Changes Detected".
Should we close this issue and open a new one? The title is not accurate anymore.
Cheers,
Emmanuel.

That I believe I fixed this weekend, you could give it a try.

Great :) I'll stay tuned.

@vistamedia should already be working if you use the latest develop branch of Admin, or you can wait for the next release. Reopen if you still have the problem.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Sommerregen picture Sommerregen  路  3Comments

Genenenenaam picture Genenenenaam  路  5Comments

ritchiedalto picture ritchiedalto  路  6Comments

jundiya picture jundiya  路  4Comments

darkroastcreative picture darkroastcreative  路  4Comments