class RailsAdminNestable::Configuration

Constants

LIST_DEFAULT_OPTIONS
TREE_DEFAULT_OPTIONS

Public Class Methods

new(abstract_model) click to toggle source
# File lib/rails_admin_nestable/configuration.rb, line 7
def initialize(abstract_model)
  @abstract_model = abstract_model
end

Public Instance Methods

list?() click to toggle source
# File lib/rails_admin_nestable/configuration.rb, line 15
def list?
  list.present? && !tree?
end
options() click to toggle source
# File lib/rails_admin_nestable/configuration.rb, line 19
def options
  @nestable_options ||= begin
    options = self.tree_options if tree?
    options = self.list_options if list?
    options || {}
  end
end
tree?() click to toggle source
# File lib/rails_admin_nestable/configuration.rb, line 11
def tree?
  tree.present?
end

Protected Instance Methods

list() click to toggle source
# File lib/rails_admin_nestable/configuration.rb, line 41
def list
  @nestable_list ||= ::RailsAdmin::Config.model(@abstract_model.model).nestable_list
end
list_options() click to toggle source
# File lib/rails_admin_nestable/configuration.rb, line 33
def list_options
  LIST_DEFAULT_OPTIONS.merge(list.class == Hash ? list : {})
end
tree() click to toggle source
# File lib/rails_admin_nestable/configuration.rb, line 37
def tree
  @nestable_tree ||= ::RailsAdmin::Config.model(@abstract_model.model).nestable_tree
end
tree_options() click to toggle source
# File lib/rails_admin_nestable/configuration.rb, line 29
def tree_options
  tree.class == Hash ? TREE_DEFAULT_OPTIONS.merge(tree) : TREE_DEFAULT_OPTIONS
end