Revision history [back]
Sure, we have actually tried this too, for two different purposes.
https://github.com/andryuha/askbot-devel/commits/ab-tag-menu (to show tag followers)
https://github.com/ASKBOT/askbot-categorizetags (to categorize tags) - the tag category feature uses mptt algorithm (django mptt), there is an editable category menu and the tag hovercard into which admin can type categories (no docs yet, will help if anyone asks about it).
Whether the tag category feature is desirable - a separate question :). Anyway we found building widgets like these in javascript quite involved, especially if they are to add functionality in the future. For myself I've decided that Closure library is the way to go. To use it you'd definitely need to buy a book by Michael Bolin - a former Google employee who worked I believe on Gmail and Google Tasks.
In the branches linked above a pattern similar to Closure was used, but jquery still does the dom manipulation, with the idea that eventually that code will be easier to port to Closure library. Please take a look and tell what you think... I will be happy to explain what it is about.
The main component is WrappedElement
"class", which is a wrapper around jQuery object representing a DOM element, where the getElement()
method calls createDom()
responsible for building the DOM structure for the widget and sets event handlers. (In Closure event handlers are set by a separate function).
Sure, we have actually tried this too, for two different purposes.
https://github.com/andryuha/askbot-devel/commits/ab-tag-menu (to show tag followers)
https://github.com/ASKBOT/askbot-categorizetags (to categorize tags) - the tag category feature uses mptt algorithm (django mptt), there is an editable category menu and the tag hovercard into which admin can type categories (no docs yet, will help if anyone asks about it).hovercard.
Whether the tag category feature is desirable - a separate question :). Anyway we found building widgets like these in javascript quite involved, especially if they are to add functionality in the future. For myself I've decided that Closure library is the way to go. To use it you'd definitely need to buy a book by Michael Bolin - a former Google employee who worked I believe on Gmail and Google Tasks.
In the branches linked above a pattern similar to Closure was used, but jquery still does the dom manipulation, with the idea that eventually that code will be easier to port to Closure library. Please take a look and tell what you think... I will be happy to explain what it is about.
The main component is WrappedElement
"class", which is a wrapper around jQuery object representing a DOM element, where the getElement()
method calls createDom()
responsible for building the DOM structure for the widget and sets event handlers. (In Closure event handlers are set by a separate function).