Class: ActionController::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/jquery/jquery_json_response.rb,
lib/jquery/secret_sauce/controller/ui_grid_controls.rb,
lib/jquery/secret_sauce/controller/ui_dialog_controls.rb

Instance Method Summary collapse

Instance Method Details

#render_close_dialog(dialog_id) ⇒ Object



4
5
6
# File 'lib/jquery/secret_sauce/controller/ui_dialog_controls.rb', line 4

def render_close_dialog(dialog_id)
  render :js => close_dialog
end

#render_close_dialog_and_refresh_gridObject



8
9
10
# File 'lib/jquery/secret_sauce/controller/ui_grid_controls.rb', line 8

def render_close_dialog_and_refresh_grid
  render :js => close_dialog("#{params["controller"]}_#{params["action"]}_dialog")+refresh_grid("#{params[:controller]}_table")
end

#render_json_response(type, hash) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/jquery/jquery_json_response.rb', line 6

def render_json_response(type, hash)
  unless [:ok, :redirect, :error].include?(type)
    raise "Invalid json response type: #{type}"
  end

  # To keep the structure consistent, we'll build the json 
  # structure with the default properties.
  #
  # This will also help other developers understand what 
  # is returned by the server by looking at this method.
  default_json_structure = {
      :status => type,
      :html => nil,
      :message => nil,
      :to => nil}.merge(hash)

  render_options = {:json => default_json_structure}
  render_options[:status] = 400 if type == :error

  render(render_options)
end

#render_refresh_gridObject



4
5
6
# File 'lib/jquery/secret_sauce/controller/ui_grid_controls.rb', line 4

def render_refresh_grid
  render :js => refresh_grid("#{params[:controller]}_table")
end