views:

203

answers:

1

Hi All,

Quickish issue. I'm currently working with RoR with a great deal of Javascript for a project. I have a particular entity that has a "color" property. Of course I want to do this as "snazzily" (yup that's a word) as possible, however, I'm not sure how to go about it. I've seen a million and one different "Color Pickers" but none seem to fit the overall bill.

My current paradigm involves editing the entities from the "Index" page instead of having to click "Edit" for each and every one. I've got that working for several fields. What I need to implement now is a quality ColorPicker that doesn't take up too much screen real estate and/or hides itself after being presented.

So, all that said, can someone point me to some quality JS techniques for dealing with "pop-ups" and/or window return values? I'd like to really understand what needs to occur as well, so a tutorial would be nice.

Much appreciated.

A: 

Did you look at jquery and the jquery-ui tools?

This is one of the jquery-plugins http://www.eyecon.ro/colorpicker/

Lichtamberg
Yes, I did, thanks. But this is one of those "more trouble than it's worth" implementations, and it doesn't provide quality "hide/show" capabilities for multiple on-screen items. Thanks for the post though.
humble_coder
Did you mean jquery or the plugin with ""more trouble than it's worth" implementations"?
Lichtamberg
No, not directed at jQuery -- simply that particular implementation. It is based on ID, not class which means I'd have to add an entry in JS for each and every "index" item. Not very desirable. Currently, I'm looking into JSColor (http://jscolor.com/)
humble_coder
Hm.... You can also select class-identified-entities:you only have to insert a point as first char:$(".myClass").css("border","3px solid red");.For using the plugin you could call:$('.class-named-identity').ColorPicker({
Lichtamberg
}). See http://docs.jquery.com/Selectors/class#class for jQuery-Selectors...
Lichtamberg
Understood. I'm familiar with the fact that jQuery supports that, it's simply that the majority of the libraries that exist seem to be stuck on using IDs instead of Classes to acquire the desired entities. That said, does anyone know of a mechanism in jQuery by which to add a "toggle" to a subentity? For instance, I have several class "TOGGLER"s with ID = "TOGGLER-ID-1","TOGGLER-ID-2",etc. and each has a "SUB-TOGGLE-1", "SUB-TOGGLE-2", etc. depending on its parent "TOGGLER". How do I, purely in Javascript (i.e. without replying on RAILS, PHP, etc) add that functionality to each "TOGGLER"?
humble_coder
http://jqueryui.com/demos/toggle/
Lichtamberg
Or maybe you need this? http://jqueryui.com/demos/accordion/
Lichtamberg
Did that help you?
Lichtamberg
I believe I understand what you are saying, but I was trying to avoid rolling my own. As I said, the implementation I 'm using "requires" the use of IDs, not general classes. Thanks though.
humble_coder