Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2010-06-26 02:19:05
- masa
- Member
- From: Asturias, Spain
- Registered: 2005-11-25
- Posts: 1,091
Categories tab: batch assign parent category
As sites grow and more and more categories get added, organizing them into parent categories becomes crucial. Today I spent quite a while sorting a long list of existing categories one by one (open, select parent and save).
It would be mighty handy to be able to select any number of categories from the main listing and then change their parent category in a single operation in the drop-down select at the bottom.
Offline
Re: Categories tab: batch assign parent category
masa wrote:
It would be mighty handy to be able to select any number of categories from the main listing and then change their parent
Been on my wish list for ages this one. I think I got partway through an implementation somewhere and then got sidetracked (story of my life!)
If I can find it I’ll see how far I got and work out if it’s feasible to sneak it in.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#3 2010-06-27 00:01:55
- masa
- Member
- From: Asturias, Spain
- Registered: 2005-11-25
- Posts: 1,091
Re: Categories tab: batch assign parent category
Bloke wrote:
If I can find it I’ll see how far I got and work out if it’s feasible to sneak it in.
Well, no pressure. It’s reassuring to know, that it’s been on your radar though.
It might not be something used very often. But when you need it, you need it badly, as I can attest from my “embarrassing oversight” :)
Offline
Re: Categories tab: batch assign parent category
Right, now I remember why I didn’t get very far last time I tried this. TXP has a little javascript function called poweredit()
which handles what happens when you choose a multi-select option. That has an onchange
handler which fires when you pick certain functions — the actions are all configured as the page loads, based on which tab you’re currently viewing.
Look on every page that has a muti-edit box. Notice there’s one multi-edit dropdown? Now look at the Category tab: there are 4 of the buggers. The multi-edit on this tab has been custom coded because it doesn’t fit in the same vein as the other tabs.
Long story short, the poweredit()
function uses some old-skool javascript to add a DOM node to a known ID on the page — which is next to the multi-edit dropdown. That’s fine if you have one dropdown but when there are 4, we can’t have 4 IDs of the same name so things fall apart.
So, two choices:
- hard-code another custom hack to the category tab to cater for its different layout
- do it properly
I’m leaning towards option #2 which is less immediate (read: TXP 5+) but will probably use jQuery and also allow me to scratch one more personal Textpattern itch: the ability to open up the multi-edit tool to plugin authors who want to add their own custom actions (or employ the TXP multi-edit tool in their plugins without having to write tonnes of duplicate code to do it).
Ideally this would involve setting the whole multi_edit/poweredit area up as a callback system. The core would use the callbacks to populate the functions it needs to offer (change cats, assign assets, delete, etc) and then plugins could add their own or — potentially, not sure on this yet — override or even remove the existing functions, using a system like the awesome pluggable_ui()
.
That’s a biiiig change for what appears on the surface (at least from a TXP user perspective) to be zero gain — nobody except plugin authors will notice any difference because all the engineering time brings us to where we are now, just with a better engine under the hood. Going forward, this would open up some really cool possibilities of course but to get there requires significant effort.
So I think we’re going to have to park this one for now. Perhaps some clever person can come up with a patch to save my poor brain from figuring it all out. If that happens it might appear sooner than we all expect, but until then, sorry, we’re stuck with just ‘delete’ on the category tab :-(
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Categories tab: batch assign parent category
‘ave it!. Better late than never, eh? Only possible because of Gocom’s awesome new multi-edit tool, so the kudos is all his.
Last edited by Bloke (2012-06-29 21:01:25)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#6 2012-06-29 21:02:57
- masa
- Member
- From: Asturias, Spain
- Registered: 2005-11-25
- Posts: 1,091
Re: Categories tab: batch assign parent category
Superb!
Offline
Re: Categories tab: batch assign parent category
+1 for the batch edit! Is it possible to hide a bunch of categories too? So you’ll have options to Delete, Change Parent, Hide and Show All?
Better than that, but probably more work for you guys, I’d like to see a Group or Set option as well as a Parent. Parents (eg. fruit) and automatically their children (eg. apples, pears) could be assigned to the Fresh group, as could Veg. But Cheese and its children edam, cheddar, low-fat, cottage could be assigned to the Fridge group. This would make it easier for Sally to look after her group and Wally to look after his group if those groups could be toggled between hidden or shown.
I am using the parent/child attributes of categories quite literally, for ancestors, and even with just 100 categories it’s getting difficult to handle. Several hundred will be needed eventually. And that’s just family trees. There are also lots of categories needed for historical records and other docs. I don’t think I’m unique in my needs either, for example a quite small car firm might have 50 car makes and 200 models plus 100 categories of spare parts.
Any possibility? BTW, thanks for the nightly builds and all the great work you’re doing. TXP just keeps getting better!
Oh, and of course, if Groups are possible, then an option to mirror the displayed group(s) in the Write tab Categories would also be very desirable. TXP v5.9 perhaps?
Offline