Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2016-05-20 06:07:55

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Applying a class to a partial

This being my first foray into admin themes, I’m fumbling around in the dark – but thanks to wet’s example I’m getting somewhere.

However, here’s my problem:

  1. I’m using some jQuery, injected into html_head(), to add a class to existing elements.
  2. The elements in question are the links inside p.txp-actions on the Write tab – i.e. Duplicate & View.
  3. It works great on the first visit to the Write tab, but after clicking Save the class disappears.

I’m guessing that it’s something to do with the fact that the elements I’m targeting are inside a partial-ajax-thingy (please insert correct terminology) and they’re being reset.

So my question is … is there a way of making classes stick?

Offline

#2 2016-05-20 08:51:52

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,138
Website

Re: Applying a class to a partial

Do you really need another class? Each of those links already has a class (txp-new, txp-clone, txp-article-view). You can also use descendant selectors to target them.

No idea on your actual question, though.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#3 2016-05-20 12:05:10

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: Applying a class to a partial

phiw13 wrote #299169:

Do you really need another class?

It’s the simplest way of styling the links as buttons, by applying a class of txp-button, which then brings in the standard Hive button style.

Offline

#4 2016-05-20 14:24:28

etc
Developer
Registered: 2010-11-11
Posts: 5,134
Website GitHub

Re: Applying a class to a partial

gomedia wrote #299167:

I’m guessing that it’s something to do with the fact that the elements I’m targeting are inside a partial-ajax-thingy (please insert correct terminology) and they’re being reset.

That would be my guess too. You have to make your jQuery snippet to reapply the class on article saves.

Offline

Board footer

Powered by FluxBB