This is really cool, thanks for the post. I extended the InPlaceEditor before with a popup calendar but maybe this would have been easier. I extend other things occasionally as well and imagine this will come in handy because the onxxx options that most sau and prototype stuff has isn't always flexible enough. And then there are non-prototypish things like calendars that have even less flexibility :)
Colin John Beppu wrote: > Hi prototype and scriptaculous fans. > > I've come up with a clever bit of Javascript that allows one to add > 'before' and 'after' hooks to any method of an object. I've named it > actsAsDecorator in the spirit of all the acts_as_* plugins for > ActiveRecord, and I've published it on my blog at: > http://beppu.lbox.org/articles/2006/08/22/the-decorator-pattern-for-javascript > . > > OO purists will note that's it's not a true implementation of the GoF > Decorator pattern, but it has similar functionality (and I think it's > a lot more straight-forward to do in Javascript, because you can > change things around at runtime instead of having to wrap everything > in classes.) > > I also find that it works particularly well with Ajax.InPlaceEditor, > because it lets me add hooks to various methods and lets me implement > the functionality that I need without having to bug the > script.aculo.us maintainers about adding yet another parameter to > Ajax.InPlaceEditor's options. I find it to be really useful, and I > think some of you out there will like it, too, so check it out. > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---
