Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InputfieldImage: images in list view not sized according to slider on page load #419

Closed
Toutouwai opened this issue Oct 27, 2017 · 2 comments

Comments

@Toutouwai
Copy link

Short description of the issue

When images are in list view and the slider is used to adjust the thumbnails to a custom size, that custom size is not retained when the page is reloaded after saving.

Related forum thread: https://processwire.com/talk/topic/17403-bug-in-default-image-grid-mode-vertical-list-verbose/

Suggestion for a possible fix

The problem is here:

setGridSize($inputfield, size, ragged);
        
if($inputfield.hasClass('InputfieldImageEditAll') || mode == 'list') {
    var listSize = getCookieData($inputfield, 'listSize');
    setListSize($inputfield, listSize);
}

It looks like the expectation here is that all thumbnails are sized with setGridSize(), but then this is overridden for images in list view which will be sized with setListSize(). But this doesn't work because setGridSize() includes a setTimeout() which fires again after setListSize().

I think it should be okay to do either setGridSize() or setListSize() based on whether list view is active.

if($inputfield.hasClass('InputfieldImageEditAll') || mode == 'list') {
    var listSize = getCookieData($inputfield, 'listSize');
    setListSize($inputfield, listSize);
} else {
    setGridSize($inputfield, size, ragged);
}

Setup/Environment

  • ProcessWire version: 3.0.80
@ryancramerdesign
Copy link
Member

Thanks! Your debugging skills are awesome. I tested the fix you suggested and all seems to work and this should now be on the dev branch.

ryancramerdesign added a commit to processwire/processwire that referenced this issue Nov 2, 2017
…dImage.js sizing of list mode using fix provided by @Toutouwai
@Toutouwai
Copy link
Author

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants