Fixed  ACP "Templates" link doesn't work after selected style is deleted

Dominion

Active member
I created a child of "Default Style (called "Default Style for Japanese)" to hold CSS tweaks for my Japanese translation. I selected that as the current style on the ACP "Appearance" page, and I also selected it as the default style to view when I clicked on the "Templates" link in the ACP sidebar.

This morning I decided I didn't need the style anymore. I opened the ACP "Appearance" page and selected "Default Style" as the current style for my test site, then I went to the "Styles" page and deleted "Default Style for Japanese".

Now whenever I click on the "Templates" link in the ACP sidebar I get the following message:
Error

The requested style could not be found.
To view the templates in the "Default Style" I now have click on the "Styles" link instead, then click on the "Templates" link for "Default Style". It's a tad irritating.

I suspect this is happening because I didn't bother to open the "Templates" page and change the default style to view there before deleting my style.

It seems the "Templates" page needs a better way of updating its default style selection in cases such as this. Perhaps this updating could be done whenever the user clicks a "Templates" link next to a style in the "Styles" page?
 
The code looked like it handled this properly - it tried to check the style was valid before using it, so if you click the "templates" link based on that, it should never error.

However, it was using a "permanent" redirect for this - that's obviously incorrect. I can only guess that the browser was seeing the permanent redirect and not making the request to the server. I've changed this to a temporary redirect and I believe that should fix it. (I can't get the templates link to be broken.)
 
Thank you, Mike. Is there a way I can whack the program now and get that link working? (If it isn't something you can explain in a line or two, please don't trouble yourself. I can wait until the fix comes out. :) )
 
I would think that it would just start working again at some point. If you close your browser and restart, that should presumably cause it to reload the link. (Caching the link isn't something I've run into, though it can change based on some browser settings.)

If you still have the issue after that, maybe there's something else wrong. What URL do you end up on when you click the link?
 
Aha, you're right. I had rebooted my Mac since filing the bug, but hadn't checked that link. It is working now!

Thanks again!
 
Top Bottom