Sha256: 7e8762b0e981f21c11f0c36f8bd0de8b62233c28d3e3afa01e43be7c4629bcc9

Contents?: true

Size: 913 Bytes

Versions: 2

Compression:

Stored size: 913 Bytes

Contents

class Apotomo::DeepLinkWidget < Apotomo::StatefulWidget
  
  transition :from => :setup, :to => :process
  transition :in   => :process
  
  def setup
    root.respond_to_event :externalChange, :on => 'deep_link', :with => :process
    root.respond_to_event :internalChange, :on => 'deep_link', :with => :process
    
    render
  end
  
  def process
    # find out what changed in the deep link
      # find the update root (### DISCUSS: this might be more than one root, as in A--B)
    #path = param(:deep_link)  # path is #tab=users/icon=3
    
    update_root = root.find {|w| w.responds_to_url_change? and w.responds_to_url_change_for?(url_fragment)}  ### DISCUSS: we just look for one root here.
    
    if update_root
      controller.logger.debug "deep_link#process: `#{update_root.name}` responds to :urlChange"
      update_root.trigger(:urlChange)
    end
    
    render :nothing => true
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
apotomo-0.1.2 app/cells/apotomo/deep_link_widget.rb
apotomo-0.1.1 app/cells/apotomo/deep_link_widget.rb