getgrav / getgrav/grav-plugin-admin

Bad usability adding and selecting media

Open
#1,696 3 comments 4 reactions 0 assignees View on GitHub
enhancement
Dominant language
PHP
Stars
377
Forks
225
Avg merge
11h 51m
Merged PRs (30d)
4

Description

Sorry for the long post, I tried to keep it as short as possible. I've done several sites with this awesome cms and the admin plugin now but there is still one small thing, that keeps frustrating me a lot and its handling media. Let me give you an example: I create a theme, with templates/modules and blueprints for the admin plugin. First thing is a gallery module.

# Using pagemedia
Im using the `pagemedia` field (respectively `header.media_order`) to get all images and gifs(!) in the order that i dragged them inside the admin panel.

```
{% for filename in page.header.media_order | split(',') %}

{% endfor %}
```

**Problem:** I can not limit the filetypes that can be added to the `pagemedia` field (in this case only images and gifs) or the number of files that can be added to the gallery (#998). The only option to limit filetypes in the template is to use e.g. `page.media.images` but thats without gifs, and maybe I want to define a custom fileset.

I understand, that the `pagemedia` field is strictly tied to the page object, so I try to make use of the `file` field instead.

# Using the file field
Now I create a `file` field with limited filetypes and a limited number of files and the destination set to `@self`.

**Probelm:** As soon as I want to delete an image from the gallery/field, there are two icons (trashcan and cross) that are confusing to the client/editor. The cross-icon removes the file from the field, but not from the server/folder (#1497) and as the `file` field is not able to show all available content inside a folder like `pagemedia` does, its causing 'dead files' inside the folder. I get the concept behind the two buttons (#1158) but there might be better ways to achieve the desired feature. (Also the use of cross referenced images over multiple sites might go against gravs intentions?)

# Currently only option
To have a set of media files, that can be limited in filetype, number and can be ordered, is to create a `list` field with a `filepicker` field inside of it. That way I can add, remove and reorder my items through the `list` and select and limit filetypes through the `filepicker`.

**Problem:** I still have to provide the `pagemedia` field to manage my files (remove unused ones, upload new ones). That way I now have two areas in my admin panel, that I need to manages (just) to add, remove or move an image inside a gallery. Now imagine a gallery with 30 items in it, thats one heck of a list and a lot of scrolling back and forth involved to manage your gallery. Often you even need to save the page after changes in the `pagemedia` field to be able to select a newly uploaded file in the `filepicker` as well. It's just not very straightforward, like the rest of grav.

# Suggestion
1. Like #998 there could be an option, to limit filetypes that can be uploaded through the `pagemedia` field, not on a global site level but on a page or template level.
2. Another option would be to extend the functionality of the `file` field to show all available media in a folder and select the desired files through a highlight or drag them to an active and not-active area inside the field. Something like this:

![example](https://user-images.githubusercontent.com/12197549/59491014-55566d00-8e86-11e9-9f5f-c90a079cbf6d.jpg)

This way we even would respect the use of cross referenced media in global folders, that is shared on different pages. I hope i was able to address my problem. Keep up the good work!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.