class Acts::DataTable::SortableColumns::Renderers::Default

Public Class Methods

new(sortable, action_view) click to toggle source
# File lib/acts_as_data_table/sortable_columns/renderers/default.rb, line 19
def initialize(sortable, action_view)
  @action_view = action_view
  @sortable    = sortable
end

Public Instance Methods

caption() click to toggle source

@return [String] The column header’s caption

# File lib/acts_as_data_table/sortable_columns/renderers/default.rb, line 35
def caption
  @sortable.caption
end
direction_indicator() click to toggle source

@return [String] an indicator about the sorting direction for the current column.

The direction is either 'ASC' or 'DESC'
# File lib/acts_as_data_table/sortable_columns/renderers/default.rb, line 28
def direction_indicator
  @sortable.direction == 'ASC' ? 'Δ' : '∇'
end
to_html() click to toggle source

Generates the actual HTML (= caption and direction links) to be embedded into the view

@return [String] the generated HTML code

# File lib/acts_as_data_table/sortable_columns/renderers/default.rb, line 71
def to_html
  if @sortable.active
    caption_link + ' ' + direction_link
  else
    caption_link
  end
end