Module: RPlatform::Rails::ViewExtensions

Defined in:
lib/rplatform_rails/view_extensions.rb

Instance Method Summary collapse

Instance Method Details

#facebook_debug_panel(options = {}) ⇒ Object

renders the RFacebook debug panel



82
83
84
85
# File 'lib/rplatform_rails/view_extensions.rb', line 82

def facebook_debug_panel(options={}) # :nodoc:
  RAILS_DEFAULT_LOGGER.info "** RFACEBOOK DEPRECATION WARNING: 'facebook_debug_panel' is deprecated in ActionViews"
  return @controller.facebook_debug_panel(options)
end

#fbparamsObject

returns the current fb_sig_params (only if they validated properly)



57
58
59
# File 'lib/rplatform_rails/view_extensions.rb', line 57

def fbparams
  @controller.fbparams
end

#fbsessionObject

returns the current user’s Facebook session (an instance of FacebookWebSession)



62
63
64
# File 'lib/rplatform_rails/view_extensions.rb', line 62

def fbsession
  @controller.fbsession
end

#image_path(*params) ⇒ Object

overrides the path_to_image method to ensure that all images are written with absolute paths



68
69
70
71
72
73
74
# File 'lib/rplatform_rails/view_extensions.rb', line 68

def image_path(*params)
  path = super(*params)
  if ((in_facebook_canvas? or in_mock_ajax? or in_ajax?) and !(/(\w+)(\:\/\/)([\w0-9\.]+)([\:0-9]*)(.*)/.match(path)))
    path = "#{request.protocol}#{request.host_with_port}#{path}"
  end
  return path
end

#in_ajax?Boolean

returns true if the render is using mock ajax

Returns:

  • (Boolean)


52
53
54
# File 'lib/rplatform_rails/view_extensions.rb', line 52

def in_ajax?
  @controller.in_ajax?
end

#in_facebook_canvas?Boolean

returns true if the user is viewing the canvas

Returns:

  • (Boolean)


37
38
39
# File 'lib/rplatform_rails/view_extensions.rb', line 37

def in_facebook_canvas?
  @controller.in_facebook_canvas?
end

#in_facebook_frame?Boolean

returns true if the user is in an iframe

Returns:

  • (Boolean)


42
43
44
# File 'lib/rplatform_rails/view_extensions.rb', line 42

def in_facebook_frame?
  @controller.in_facebook_frame?
end

#in_mock_ajax?Boolean

returns true if the render is using mock ajax

Returns:

  • (Boolean)


47
48
49
# File 'lib/rplatform_rails/view_extensions.rb', line 47

def in_mock_ajax?
  @controller.in_mock_ajax?
end