MerlinWP icon indicating copy to clipboard operation
MerlinWP copied to clipboard

Install plugins button looks empty when :active

Open JiveDig opened this issue 7 years ago • 13 comments

Haven't had a chance to debug but leaving this in case anyone else sees it or has a fix.

screen shot 2018-10-29 at 4 39 20 pm

JiveDig avatar Oct 29 '18 20:10 JiveDig

What browser and OS were you using when this issue occurred, I cannot reproduce this in Firefox?

aurora-hq avatar Oct 30 '18 00:10 aurora-hq

Hmm I was wondering if it was gremlins in my system. I’m Mac/Chrome. Honestly haven’t tested anything else.

JiveDig avatar Oct 30 '18 02:10 JiveDig

Pretty sure it's from:

.merlin__button--loading .merlin__button--loading__text {
	opacity: 0;

FWIW this happens when the plugin are already installed but not active, then I hit this step, click and it disappears.

JiveDig avatar Oct 30 '18 15:10 JiveDig

Works fine for me, I see the spinner inside the button fine. I tested it on both Chrome (Win and Mac). Here's a screenshot:

2018-10-30_11-27-30 I've not tampered with any of the core Merlin CSS, so if you have might be a good place to start checking. It also doesn't matter if the button is active meaning has the blue border around it or not, the spinner always shows for me while the plugins are being installed/updated/activated.

aurora-hq avatar Oct 30 '18 16:10 aurora-hq

Hmmm, did you test with all the plugins already installed? Now that I see your screenshot I realize the issue is that i'm missing the spinner. I wonder if having the plugins installed makes it happen so fast the spinner never shows up.

JiveDig avatar Oct 30 '18 16:10 JiveDig

Add a heavy plugin like WooCommerce to the list of plugins to install this way it will have enough time to show itself. Yes, I did test it with all plugins installed but not activated.

aurora-hq avatar Oct 30 '18 17:10 aurora-hq

This happens when Merlin is installed inside of a plugin because it uses get_template_part to get the SVG here https://github.com/richtabor/MerlinWP/blob/master/class-merlin.php#L686

The only workaround I could find is to extend the Merlin class and override the loading_spinner method.

It would be better if there was a filter which allowed plugins to return an SVG in a string instead of using get_template_part. E.g:

/**
 * Loading merlin-spinner.
 */
public function loading_spinner() {

	// Define the spinner file.
	$spinner = $this->directory . '/assets/images/spinner';

	// Retrieve the spinner.
	return apply_filters( 'merlin_loading_spinner_svg', get_template_part( apply_filters( 'merlin_loading_spinner', $spinner ) ) );
}

Obviously not pretty but you get the idea.

seothemes avatar Mar 31 '19 04:03 seothemes

Ah yes, that would do it. Good find Lee. If Rich was interested in a PR and a new release, this would be a nice fix for me. No users really complained, but my button is empty every time they use our importer.

JiveDig avatar Apr 02 '19 12:04 JiveDig

I think it's a good idea @JiveDig 👍

richtabor avatar Apr 03 '19 00:04 richtabor

sends smoke signals to my buddy @seothemes so I don't have to do it 😜

JiveDig avatar Apr 03 '19 01:04 JiveDig

Found another solution using the dynamic get_template_part_{$slug} hook. No need for another filter:

add_action('get_template_part_merlin-wp/assets/images/spinner', function() {
	require_once 'path/to/merlin-wp/assets/images/spinner.php';
});

seothemes avatar Apr 04 '19 09:04 seothemes

@richtabor this one can probably be closed.

seothemes avatar Apr 08 '19 04:04 seothemes

@seothemes you got it to work with an action hook? That's wild, hooked into that template part and loaded it via the plugin? Great idea, never would have thought about doing that.

JiveDig avatar Apr 08 '19 15:04 JiveDig