Class: RailsAdmin::Config::Sections::List

Inherits:
Base
  • Object
show all
Defined in:
lib/rails_admin/config/sections/list.rb

Overview

Configuration of the list view

Constant Summary

Constants inherited from Base

Base::NAMED_INSTANCE_VARIABLES

Instance Attribute Summary

Attributes inherited from Base

#abstract_model, #parent, #root

Attributes included from HasDescription

#description

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from HasDescription

#desc

Methods included from HasGroups

#group, #visible_groups

Methods included from HasFields

#_fields, #all_fields, #configure, #exclude_fields, #field, #fields, #fields_of_type, #include_all_fields, #include_fields, #visible_fields

Methods included from Inspectable

#inspect

Methods included from Configurable

#has_option?, #register_deprecated_instance_option, #register_instance_option

Methods included from Proxyable

#bindings, #bindings=, #with

Constructor Details

This class inherits a constructor from RailsAdmin::Config::Sections::Base

Instance Method Details

#sidescroll_frozen_columnsObject


51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/rails_admin/config/sections/list.rb', line 51

def sidescroll_frozen_columns
  global_config = RailsAdmin::Config.sidescroll
  model_config = sidescroll
  enabled = model_config.nil? ? global_config : model_config
  if enabled
    num_frozen = model_config[:num_frozen_columns] if model_config.is_a?(Hash)
    unless num_frozen
      num_frozen = global_config[:num_frozen_columns] if global_config.is_a?(Hash)
      num_frozen ||= 3 # by default, freeze checkboxes, links & first property (usually primary key / id?)
      num_frozen -= 1 unless checkboxes? # model config should be explicit about this, only adjust if using global config
    end
    num_frozen
  end
end