Module: Netzke::Railz::ControllerExtensions

Extended by:
ActiveSupport::Concern
Included in:
NetzkeController
Defined in:
lib/netzke/core/railz/controller_extensions.rb

Overview

Before each request, Netzke::Base.controller and Netzke::Base.session are set, to be accessible from components.

Defined Under Namespace

Modules: ClassMethods Classes: DirectRequest

Instance Method Summary collapse

Instance Method Details

#directObject

Handles Ext.Direct RPC calls



54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/netzke/core/railz/controller_extensions.rb', line 54

def direct
  if params['_json'] # this is a batched request
    response = []
    params['_json'].each do |batch|
      direct_request = DirectRequest.new(batch)
      response << direct_response(direct_request, invoke_endpoint(direct_request))
    end
  else # this is a single request
    direct_request = DirectRequest.new(params)
    response = direct_response(direct_request, invoke_endpoint(direct_request))
  end

  render plain: response.to_json, layout: false
end

#dispatcherObject

Old-way action used at multi-part form submission (endpointUrl)



83
84
85
# File 'lib/netzke/core/railz/controller_extensions.rb', line 83

def dispatcher
  endpoint_dispatch(params[:address])
end

#extObject

On-the-fly generation of public/netzke/ext.



70
71
72
73
74
75
76
77
78
79
80
# File 'lib/netzke/core/railz/controller_extensions.rb', line 70

def ext
  respond_to do |format|
    format.js {
      render js: Netzke::Core::DynamicAssets.ext_js(form_authenticity_token)
    }

    format.css {
      render plain: Netzke::Core::DynamicAssets.ext_css, content_type: 'text/css'
    }
  end
end