Sha256: 3c534eaf3a9804eca442943368db0649ff02f8a2663ad1a92b2bd65152bbab74

Contents?: true

Size: 998 Bytes

Versions: 3

Compression:

Stored size: 998 Bytes

Contents

class Kaui::CustomFieldsController < Kaui::EngineController

  def index
  end

  def pagination
    json = { :sEcho => params[:sEcho], :iTotalRecords => 0, :iTotalDisplayRecords => 0, :aaData => [] }

    search_key = params[:sSearch]
    if search_key.present?
      custom_fields = Kaui::KillbillHelper::search_custom_fields(search_key, params[:iDisplayStart] || 0, params[:iDisplayLength] || 10, options_for_klient)
    else
      custom_fields = Kaui::KillbillHelper::get_custom_fields(params[:iDisplayStart] || 0, params[:iDisplayLength] || 10, options_for_klient)
    end
    json[:iTotalDisplayRecords] = custom_fields.pagination_total_nb_records
    json[:iTotalRecords] = custom_fields.pagination_max_nb_records

    custom_fields.each do |custom_field|
      json[:aaData] << [
                         custom_field.name,
                         custom_field.value
                       ]
    end

    respond_to do |format|
      format.json { render :json => json }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kaui-0.6.6 app/controllers/kaui/custom_fields_controller.rb
kaui-0.6.5 app/controllers/kaui/custom_fields_controller.rb
kaui-0.6.4 app/controllers/kaui/custom_fields_controller.rb