the-events-calendar / the-events-calendar-category-colors

Plugin add-on for The Events Calendar to colorize categories
https://wordpress.org/plugins/the-events-calendar-category-colors
45 stars 19 forks source link

Reworked options page to use slideUp/slideDown transition #7

Closed afragen closed 11 years ago

afragen commented 11 years ago

@WebBaker I played around a bit with the optionsform.php and such to remove parts of the table, replace with divs, adjust the CSS and change the transition. It's running on http://drfragen.info

What do you think?

WebBaker commented 11 years ago

That's perfect, far smoother than my previous attempt.

afragen commented 11 years ago

Did I implement the CSS from the separate file correctly? It ends up inserting in the middle of the page, while aesthetically unpleasant it works. Is there some better way to add that view code to the header of that specific page or does it really matter?

Harder is trying to do a transition for 'Transparent' as the class would have to be category specific. Writing that to div is easy. Writing it to js harder, unless we can "write" some of the js programmatically. Something for another time.

WebBaker commented 11 years ago

I didn't actually notice that, but you're right, and I seem to remember there was a style element being inserted in amongst the form mark-up in the previous iteration, too. My understanding is that that is a no-no, style elements should only exist as children of the head element.

That said, it seems to work and I've seen code from Modern Tribe doing the same thing.

What we could do on a future iteration though is put it into the head. I can't remember the exact hook but it's along the lines of _admin_printstyles-{page-name} which is nice because it will only be applied on the TECCC options page and not throughout the admin/dashboard environment.

Harder is trying to do a transition for 'Transparent' as the class would have to be category specific.

Do you mean an opacity effect in addition to slideUp and slideDown?

Not sure if that's what you mean but I do quite like the current sliding effect you've put in place as is and I'm not sure if it needs much more embellishment.

afragen commented 11 years ago

I'll have to see about that hook. I'd like to be able to insert the style element into head.

Re:Transparent effect, I'm referring to a similar JS transition to show/hide color picker based upon transparent checked state.

afragen commented 11 years ago

http://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_scripts http://pippinsplugins.com/loading-scripts-correctly-in-the-wordpress-admin/

We might want to use this to load the teccc–admin.js also.

Is there something more specific for $hook than 'edit.php'? That will load on every admin setting page.

afragen commented 11 years ago

Is $hook = teccc_category_colors ?

WebBaker commented 11 years ago

$hook is the string returned when the options page was registered (by the core plugin, in this case). Something like this would restrict things to our options page only ... not sure if we can safely obtain that hook for future-proofness, though.

afragen commented 11 years ago

I think I got this working correctly in this commit.