Jump to content

Hide/expand individual FieldtypeFiles file entries meta in admin


psy
 Share

Recommended Posts

AFAIK, a PageFiles field shows all files, including file descriptions, tags, etc. The visibility option is for the entire field.

It would be helpful to minimise the file list in admin to filename or custom fields, eg {basename} {modified}, only in the admin area similar to repeaters. A down arrow could expand individual file meta.

When a page has lots of attached files, it's cumbersome to scroll through all the files with descriptions & tags when the field visibility is "Open".

  • Like 2
Link to comment
Share on other sites

Sounds good. In the meantime it's easy to do with a little custom CSS and JS.

.InputfieldFileData { display:none; }
.data-open + .InputfieldFileData { display:block; }

 

$(document).on('click', '.InputfieldFileInfo', function() {
    $(this).toggleClass('data-open');
});

image.gif.c7f7c7223cb9f495c27b842ec8b611a5.gif

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

And the final piece of the puzzle, again thanks to  @Robin S, in site/templates/admin.php, see this post:

 

$wire->addHookAfter('AdminTheme::getExtraMarkup', function(HookEvent $event) {
    $scripts = wire('files')->render('inc/admin-tpl-hook');
    $parts = $event->return;
    $parts['head'] .= $scripts;
    $event->return = $parts;
});

 

Link to comment
Share on other sites

@psy in admin.php you can do this (important!) before the final require() statement:

$config->scripts->add($config->urls->templates . 'admin.js');

I think this should be the default: https://github.com/processwire/processwire-requests/issues/552

And if anybody created an admin tweak for it anybody could install it with a single checkbox: https://github.com/baumrock/RockAdminTweaks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...