class RenderOtherTest::TestController

Public Class Methods

controller_path() click to toggle source
# File test/render_other_test.rb, line 14
def self.controller_path
  'test'
end

Public Instance Methods

delete_with_js() click to toggle source
# File test/render_other_test.rb, line 66
def delete_with_js
  @project_id = 4
end
enum_rjs_test() click to toggle source
# File test/render_other_test.rb, line 33
def enum_rjs_test
  render :update do |page|
    page.select('.product').each do |value|
      page.rjs_helper_method_from_module
      page.rjs_helper_method(value)
      page.sortable(value, :url => { :action => "order" })
      page.draggable(value)
    end
  end
end
partial_as_rjs() click to toggle source
# File test/render_other_test.rb, line 92
def partial_as_rjs
  render :update do |page|
    page.replace :foo, :partial => 'partial'
  end
end
render_alternate_default() click to toggle source
# File test/render_other_test.rb, line 108
def render_alternate_default
  # For this test, the method "default_render" is overridden:
  @alternate_default_render = lambda do
    render :update do |page|
      page.replace :foo, :partial => 'partial'
    end
  end
end
render_custom_code_rjs() click to toggle source
# File test/render_other_test.rb, line 47
def render_custom_code_rjs
  render :update, :status => 404 do |page|
    page.replace :foo, :partial => 'partial'
  end
end
render_explicit_html_template() click to toggle source
# File test/render_other_test.rb, line 44
def render_explicit_html_template
end
render_implicit_html_template() click to toggle source
# File test/render_other_test.rb, line 53
def render_implicit_html_template
end
render_js_with_explicit_action_template() click to toggle source
# File test/render_other_test.rb, line 61
def render_js_with_explicit_action_template
  @project_id = 4
  render :action => 'delete_with_js'
end
render_js_with_explicit_template() click to toggle source
# File test/render_other_test.rb, line 56
def render_js_with_explicit_template
  @project_id = 4
  render :template => 'test/delete_with_js'
end
render_simon_says() click to toggle source
# File test/render_other_test.rb, line 117
def render_simon_says
  render :simon => "foo"
end
respond_to_partial_as_rjs() click to toggle source
# File test/render_other_test.rb, line 98
def respond_to_partial_as_rjs
  respond_to do |format|
    format.js do
      render :update do |page|
        page.replace :foo, :partial => 'partial'
      end
    end
  end
end
rjs_helper_method(value) click to toggle source
# File test/render_other_test.rb, line 28
def rjs_helper_method(value)
  page.visual_effect :highlight, value
end
update_page() click to toggle source
# File test/render_other_test.rb, line 70
def update_page
  render :update do |page|
    page.replace_html 'balance', '$37,000,000.00'
    page.visual_effect :highlight, 'balance'
  end
end
update_page_with_instance_variables() click to toggle source
# File test/render_other_test.rb, line 77
def update_page_with_instance_variables
  @money = '$37,000,000.00'
  @div_id = 'balance'
  render :update do |page|
    page.replace_html @div_id, @money
    page.visual_effect :highlight, @div_id
  end
end
update_page_with_view_method() click to toggle source
# File test/render_other_test.rb, line 86
def update_page_with_view_method
  render :update do |page|
    page.replace_html 'person', pluralize(2, 'person')
  end
end

Private Instance Methods

default_render() click to toggle source
# File test/render_other_test.rb, line 122
def default_render
  @alternate_default_render ||= nil
  if @alternate_default_render
    @alternate_default_render.call
  else
    super
  end
end
determine_layout() click to toggle source
# File test/render_other_test.rb, line 131
def determine_layout
  case action_name
    when "hello_world", "layout_test", "rendering_without_layout",
         "rendering_nothing_on_layout", "render_text_hello_world",
         "render_text_hello_world_with_layout",
         "hello_world_with_layout_false",
         "partial_only", "partial_only_with_layout",
         "accessing_params_in_template",
         "accessing_params_in_template_with_layout",
         "render_with_explicit_template",
         "render_with_explicit_string_template",
         "update_page", "update_page_with_instance_variables"

      "layouts/standard"
    when "action_talk_to_layout", "layout_overriding_layout"
      "layouts/talk_from_action"
    when "render_implicit_html_template_from_xhr_request"
      (request.xhr? ? 'layouts/xhr' : 'layouts/standard')
  end
end