Sha256: 1c750bda2d7e7e6ccff4d9cb20d06bb4181d7543f3d1ea3629febb66532f04b3

Contents?: true

Size: 881 Bytes

Versions: 12

Compression:

Stored size: 881 Bytes

Contents

class Kaui::AccountCustomFieldsController < Kaui::EngineController

  def index
    cached_options_for_klient = options_for_klient
    account = Kaui::Account::find_by_id_or_key(params.require(:account_id), true, true, cached_options_for_klient)
    custom_fields = account.all_custom_fields(nil, 'NONE', cached_options_for_klient)


    formatter = lambda do |custom_field|
      url_for_object = view_context.url_for_object(custom_field.object_id, custom_field.object_type)
      [
          url_for_object ? view_context.link_to(custom_field.object_id, url_for_object) : custom_field.object_id,
          custom_field.object_type,
          custom_field.name,
          custom_field.value
      ]
    end
    @custom_fields_json = []
    custom_fields.each { |page| @custom_fields_json << formatter.call(page) }

    @custom_fields_json = @custom_fields_json.to_json
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
kaui-2.1.0 app/controllers/kaui/account_custom_fields_controller.rb
kaui-2.0.4 app/controllers/kaui/account_custom_fields_controller.rb
kaui-2.0.3 app/controllers/kaui/account_custom_fields_controller.rb
kaui-2.0.2 app/controllers/kaui/account_custom_fields_controller.rb
kaui-2.0.1 app/controllers/kaui/account_custom_fields_controller.rb
kaui-2.0.0 app/controllers/kaui/account_custom_fields_controller.rb
kaui-1.4.1 app/controllers/kaui/account_custom_fields_controller.rb
kaui-1.4.0 app/controllers/kaui/account_custom_fields_controller.rb
kaui-1.3.0 app/controllers/kaui/account_custom_fields_controller.rb
kaui-1.2.0 app/controllers/kaui/account_custom_fields_controller.rb
kaui-1.1.0 app/controllers/kaui/account_custom_fields_controller.rb
kaui-1.0.0 app/controllers/kaui/account_custom_fields_controller.rb