The Concepts : View Step

A View Step is mainly used to render a view to the user. It’s default behavior facilitates this process. But it can do much more than that. Read the View Step API for more details.

Here are examples of view steps. More are included in the demo application.

class MyController < ActionFlow::Base
 
  def initialize
 
    # Basic step mapping.
    # This step would only try to render a file named ''minimalist_step.rhtml''
    # and then return the ''render'' event to the controller to show it's rendering
    # result.
    view_step :minimalist_step
 
    # Simple step mapping.
    # This step would only try to render a file named ''minimalist_step.rhtml''
    # and then return the ''render'' event to the controller to show it's rendering
    # result. If the view then sends either of the 'next' or 'cancel' event,
    # the correct step name associated to the event would be called.
    view_step :simple_step do
 
      on :next => :some_other_step
      on :cancel => :quit_step
 
    end
 
    # Complex step mapping.
    # This step maps events the same way the 'simple_step' does but adds two things.
    # It uses the Flow Step 'method' instruction to tell the controller to execute
    # a method named 'my_step_definition' instead of 'complex_step'.
    # It also tells the controller to execute a given block of code right after the
    # execution of the implementation via the 'to_render' instruction.
    view_step :complex_step do
 
      on :next => :some_other_step
      on :cancel => :quit_step
 
      # Use this step implementation method instead of 'complex_step'
      method :my_step_definition
    
      # Define a block to execute after the step definition
      to_render :next do
        render :partial => true, :action => :some_action_name
        event :render
      end
 
    end
 
  end
 
end

~~DISCUSSION~~

 
view_step.txt · Last modified: 2007/06/06 16:21 by lucboudreau
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki

Creative Commons License
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License.