Opened 11 years ago
Closed 11 years ago
#5364 closed defect (bug) (fixed)
Collapsible feature is not working in component single item administration screens
Reported by: | imath | Owned by: | imath |
---|---|---|---|
Milestone: | 2.0 | Priority: | low |
Severity: | normal | Version: | 1.9.1 |
Component: | Administration | Keywords: | has-patch commit |
Cc: |
Description
Sarah (@pollyplummer) alerted me that the collapsible feature was not working on the new "Community Profile" administration screen. I remembered same behavior was happening in single Group Administration screen and in single Activity Administration screen.
I've dived a little in WordPress javascripts we are enqueueing to benefit from this feature. And i've found that the problem was linked to the script comment.js. We enqueue it in Groups single item, Activity single item and Community profile.
comment.js uses this function postboxes.add_postbox_toggles('comment');
and as a result the page argument of the save state function is "comment" instead of the right administration page id.
I think Groups single item and Community profile doesn't need this script, so we might simply avoid enqueueing it to make the collapsible feature work (+ user options saved).
Activity single item Administration screen needs it in order to change the date of the activity. Hopefully the admin.js of this component is loaded after comment.js so we can rerun the postboxes.add_postbox_toggles in favor of the right administration page id.
That's what i've attached in the patch. I've tested and it seems to solve the trouble : collapsible works and the states are saved.
Attachments (1)
Change History (6)
#2
@
11 years ago
Patched as well and it seems fine - however in checking it highlighted a few issues in missing icons for the toggle and for the sortable cursor in the activity single edit screens, looking further noticed that the requisite elements and classes were missing e.g <div class="handlediv" title="click to toggle"><br /></div>
& the ui-sortable classes checked the admin file and realised that the aproach to mixing do_metabox & hardcoded meta box markup is fundamentally flawed so started trying to re-factor things so hardcoded markup was functioned and added to the register_metaboxes, got stuck on trying to get $activity->content pulling in to the wp_editor and then was called to other duities.
Members admin screens also lack the icons so suspect same issues exists for all these admin screens and a could do with a general overhaul.
Not the first time I've have enjoyed messing around with metabox markup - born in the fires of hell! :(
This seems good to me.