Module: TableSortable::Controller::ClassMethods

Defined in:
lib/table_sortable/controller.rb

Instance Method Summary collapse

Instance Method Details

#define_column(*args) ⇒ Object



27
28
29
30
31
# File 'lib/table_sortable/controller.rb', line 27

def define_column(*args)
  before_action do
    define_column *args
  end
end

#define_column_offset(offset) ⇒ Object



39
40
41
42
43
# File 'lib/table_sortable/controller.rb', line 39

def define_column_offset(offset)
  before_action do
    define_column_offset offset
  end
end

#define_column_order(order) ⇒ Object



33
34
35
36
37
# File 'lib/table_sortable/controller.rb', line 33

def define_column_order(order)
  before_action do
    define_column_order order
  end
end

#define_columns(*args) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/table_sortable/controller.rb', line 13

def define_columns(*args)
  options = args.extract_options!
  column_offset = options[:offset] || 0
  translation_key = options[:translation_key]
  columns   = args
  before_action(options) do
    define_translation_key translation_key
    define_column_offset column_offset
    columns.each do |column|
      define_column column, translation_key: translation_key
    end
  end
end

#define_translation_key(key) ⇒ Object



45
46
47
48
49
# File 'lib/table_sortable/controller.rb', line 45

def define_translation_key(key)
  before_action do
    define_translation_key key
  end
end