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

Gallery fields don't show on first load #45

Closed
MickeyKay opened this issue Jan 6, 2015 · 2 comments
Closed

Gallery fields don't show on first load #45

MickeyKay opened this issue Jan 6, 2015 · 2 comments

Comments

@MickeyKay
Copy link

When creating a new gallery, the default template's associated fields don't show. If you change the template select input to another template, and then change it back, the fields do appear, however they don't when the page first loads. Seems like whatever function is getting triggered by the select change also needs to get triggered when the page loads.

Here's a .gif to illustrate: http://recordit.co/zDFasgpjZs

@MickeyKay
Copy link
Author

Looks like the issue starts here (line 26 of admin-foogallery.js):

FOOGALLERY.initSettings = function() {
    $('#FooGallerySettings_GalleryTemplate').change(function() {
        var $this = $(this),
            selectedTemplate = $this.val(),
            selectedPreviewCss = $this.find(":selected").data('preview-css');

        //hide all template fields
        $('.foogallery-metabox-settings .gallery_template_field').not('.gallery_template_field_selector').hide();

        //show all fields for the selected template only
        $('.foogallery-metabox-settings .gallery_template_field-' + selectedTemplate).show();

        //include a preview CSS if possible
        FOOGALLERY.includePreviewCss();

        //trigger a change so custom template js can do something
        FOOGALLERY.triggerTemplateChangedEvent();
    });

    //include our selected preview CSS
    FOOGALLERY.includePreviewCss();

    //trigger this onload too!
    FOOGALLERY.triggerTemplateChangedEvent();
};

The hiding/showing is only triggered on $('#FooGallerySettings_GalleryTemplate').change(), but it needs to be triggered on load as well.

@bradvin
Copy link
Member

bradvin commented Jan 6, 2015

@MickeyKay good catch - thanks for letting me knwo - I will release an update with a fix ASAP

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

No branches or pull requests

2 participants