how does Apotomo handle Ajax and JavaScript? framework abstraction with JavascriptGenerator no manual AJAX-routes for dozens of controllers, one generic route to rule them all = Apotomo Apotomo is a stateful widget component framework for Rails. It is good for you if you It is perfect for building AJAXed Rich Client Applications. It is suitable for iGoogle-like widgets, dashboards, portals, or even full-blown interactive web apps. * Development Teams, where separate teams can work on separate components == Widgets === Widget Trees == Events === Event Handlers == AJAX == Statefulness vs. Stateless A stateful WHAT? Well, you know that. In Rails, people tend to have fat controllers. One controller action renders the complete page. While many programmers try to separate their code into helpers, controller actions, RJS logic and partials, it is still the controller that has to care about when to update what, and how! In Apotomo, it is the opposite. Widgets are small, autonomous components that look and feel like controllers. These tiny monsters listen to events and thus keep updating themselves on the page via AJAX. However, there's no JavaScript for you - they're pure Ruby. == Man, gimme code! Let's use the famous and tiresome counter example. class CounterCell < Apotomo::StatefulWidget transition :from => :display, :to => :increment def display respond_to_event :counterClick, :with => :increment @count = 0 render # renders display.html.erb end def increment @count += 1 # @count is simply there - that's stateful. render :view => :display end end Since this widget calls render it surely needs a view.
<%= render_widget 'my_first_counter' %>
Ok, so this renders the widget in our controller page.
When clicking the link it updates automatically on the screen showing the incremented value. Wow.
== That's cool!
Yes, it is.
== Is there more?
Apotomo got a load of features.
[Composability] Widgets can range from small standalone components to nested widget trees like dashboards or forms. Remember that each widget can have any number of children.
[Bubbling events] Widgets can trigger events and watch out for them. While events bubble up from their triggering source to root they can be observed, providing a way to implement loosely coupled, distributable components.
[Deep Linking] Apotomo deals with deep links (or url fragments) out-of-the-box while using SWFAddress. Components that register for deep linking will update as soon as the deep link changes. That makes your application back-button-safe!
[Testing] Needless to say that it is simply easier to test small components instead of fat do-it-all controllers.
Give it a try- you will love the power and simplicity of real stateful components!
== Bugs, Community
Please visit http://apotomo.de, the official project page with lots of examples.
Join the mailing list and visit us in the IRC channel. More information is
here[http://apotomo.de/download].
== License
Copyright (c) 2007-2010 Nick Sutterer