Oh I gotcha, CSS classes, yes definitely, totally agree on that point regarding the visual aspect. ...my mind usually gravitates towards the data first, that's why I was thinking JS pseudo-classes / objects! :)
I use lowpro.js<http://www.danwebb.net/2006/9/3/low-pro-unobtrusive-scripting-for-prototype>also, it's very cool. (I wonder if they will build that into the prototype.js core someday? Anyone know?) cheers! Mark On 6/7/07, Alex Duffield <[EMAIL PROTECTED]> wrote: > > Mark, in regards to my comments of classes for visual information, I try > to keep the class names for things like "Booked", "InCart" "Selected" on the > calendar. Those are all things that give the user visual feedback. I also > use classes for unobtrusive javascript (I use lowpro.js) so I will use > <div class="addtocart"></div> and then attach the behavior to that. but when > you start having namevalue pairs in a class like in my original comments: > class="blockid33 minday7 arivalFriday", then that is definitely taking class > values a little far. > Ya, I really like the idea of sending a data object along with the > calendar and indexing it by the date id I am already using. That would add > give me the ability to add some cool features like you suggested using > periodic updaters to keep the data current even if the user hasn't updated > the page.. Probably the better solution for me in the long run for this > particular project (on the next update) But the ability to access custom > attributes in enumerable would still be a welcome addition!! > > Cheers, and thanks for your suggestions! > > ______________________________________________________________________ > > *Alex Duffield * * ❖* * Principal* * ❖* * InControl Solutions* * .* * > http://www.incontrolsolutions.com* <http://www.incontrolsolutions.com/> > > > > > On 7-Jun-07, at 10:18 AM, Mark Holton wrote: > > I really like the idea. I'm planning on doing something similar with > statistics for a variety of categories, and would like to experiment with > this. I'd be interested to see any snippets of code you want to share, and > likewise, I'll share mine. > > Can you explain your point about "class should really be used for visual > information"? If you are speaking of a JS pseudo class, I'm not sure I'm > convinced that's true, but would like to hear what you mean. > > What about storing the data in a js object that represented a date and all > of your calendar properties for that date? (You could then obviously set the > prototype for that object to contain the methods related to changing these > properties, etc.) This way, you could retrieve sets of data from the server > during Ajax calls during events, then populate these JS objects via JSON > callbacks. It would also enable you to use PeriodicalUpdater to populate > dates that had been updated by other users since the last time you loaded > your page. As the user changed certain properties (E.g. weekly view, > instead of monthly view, for instance), the Ajax request would populate > those set of "day" objects accordingly. I suppose you would be doing the > same thing by placing these values into the custom HTML, but it would seem > that would be slower than staying in native JS. But I do not know that for a > fact. > > Not sure if that works in the context of what you're doing, but figured > I'd throw it out there for thought. > > > On 6/7/07, Alex Duffield <[EMAIL PROTECTED]> wrote: > > > > One of the projects I am currently working on involves a booking > > calendar, that displays dates, availability and rates for vacation rental > > properties. > > I wanted each day in the calendar to contain quite a bit of information > > about its availability. Some dates are only available as a "block" for > > example weekly. Blocks can have a fixed arrival date, (Friday) each date > > would have a minimum stay etc etc.. you get the point. > > > > I started off using class to store all this information class="blockid33 > > minday7 arivalFriday" > > > > I really dont like this idea as class should really be used for visual > > information... > > > > And to get to that data in the class-names, I have to strip out the > > "blockid" or "minday" > > > > Since XHTML lets me define custom attributes, that seems the better way > > to go... > > > > I would have each day in my calendar as a div > > > > <div id="YYYY-MM-DD" blockid="33" minstay="7" arrival="friday" > > class="booked">DD</div> > > > > This way I can have all my data on hand quickly and easily. > > > > I found a great article talking about just this issue and suggesting > > some modifications to prototype with > > > > document.getEllementsByAttribute and some changes to Enumerables to have > > access to custom attributes.. > > > > http://unspace.ca/discover/attributes > > > > This all seems to make a lot of sense to me. Has there been any other > > discussion of this sort of functionality making it into prototype.js? > > > > Cheers. > > > > > > ______________________________________________________________________ > > > > *Alex Duffield * * ❖* * Principal* * ❖* * InControl Solutions* * .* * > > http://www.incontrolsolutions.com* <http://www.incontrolsolutions.com/> > > > > > > > > > > > > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---