Class: UiBibz::Ui::Ux::Tables::Sortable

Inherits:
Base
  • Object
show all
Defined in:
lib/ui_bibz/ui/ux/tables/extensions/sortable.rb

Instance Attribute Summary

Attributes inherited from Base

#output_buffer

Instance Method Summary collapse

Methods inherited from Base

#generate_id, #i18n_set?, #inject_url

Constructor Details

#initialize(store, options) ⇒ Sortable

Returns a new instance of Sortable.



5
6
7
8
# File 'lib/ui_bibz/ui/ux/tables/extensions/sortable.rb', line 5

def initialize(store, options)
  @store   = store
  @options = options
end

Instance Method Details

#header(column, name = nil) ⇒ Object

header use i18n



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/ui_bibz/ui/ux/tables/extensions/sortable.rb', line 11

def header(column, name = nil)
  @column = column
  @name = name
  if @name.nil?
    defaults = [
      header_name(name),
      translate_headers_by_defaults,
      translate_headers_by_defaults_active_record,
      translate_headers_by_active_record,
      default_header_name(name)
    ].compact

    @name = UiBibz::Utils::Internationalization.new(translate_headers_by_model, default: defaults).translate
  end
  sortable? ? sortable_link : title
end