Sha256: c34b14a51def05aca2aff2ac04a10094e5e4a80eca62cc9044c99ab246718e01

Contents?: true

Size: 1.01 KB

Versions: 9

Compression:

Stored size: 1.01 KB

Contents

module Netzke
  module Form
    module Endpoints
      extend ActiveSupport::Concern

      included do
        # Called when the form gets submitted (e.g. by pressing the Apply button)
        endpoint :submit do |params|
          data = ActiveSupport::JSON.decode(params[:data])
          submit(data, client)
        end

        # Can be called when the form needs to load a record with given ID. E.g.:
        #
        #     someForm.server.load({id: 100});
        endpoint :load do |params|
          @record = model && model_adapter.find_record(params[:id])
          client.netzke_set_form_values js_record_data
        end

        # Returns options for a combobox
        # params receive:
        # +attr+ - column's name
        # +query+ - what's typed-in in the combobox
        # +id+ - selected record id
        endpoint :get_combobox_options do |params|
          attr = fields[params[:attr].to_sym]
          client.data = model_adapter.combo_data(attr, params[:query])
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
netzke-basepack-6.5.0.0 lib/netzke/form/endpoints.rb
netzke-basepack-6.5.0.0.rc2 lib/netzke/form/endpoints.rb
netzke-basepack-6.5.0.0.rc1 lib/netzke/form/endpoints.rb
netzke-basepack-1.0.1.0 lib/netzke/form/endpoints.rb
netzke-basepack-1.0.0.1 lib/netzke/form/endpoints.rb
netzke-basepack-1.0.0.0 lib/netzke/form/endpoints.rb
netzke-basepack-1.0.0.0.pre3 lib/netzke/form/endpoints.rb
netzke-basepack-1.0.0.0.pre2 lib/netzke/form/endpoints.rb
netzke-basepack-1.0.0.0.pre lib/netzke/form/endpoints.rb