Module: Cheveret::Table::Locale

Included in:
Base
Defined in:
lib/cheveret/table/locale.rb

Instance Method Summary collapse

Instance Method Details

#render_th(column, options = {}) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/cheveret/table/locale.rb', line 31

def render_th(column, options={})
  unless options[:title]
    scope = self.class.to_s.sub(/Table\Z/, '').underscore
    hint  = ::I18n.translate("cheveret.hints.#{scope}.#{column.name}",
                             :default => '')

    options[:title] = hint.squish unless hint.blank?
  end

  super
end

#table_header_for(column) ⇒ Object



46
47
48
49
50
# File 'lib/cheveret/table/locale.rb', line 46

def table_header_for(column)
  scope  = self.class.to_s.sub(/Table\Z/, '').underscore
  header = ::I18n.translate("cheveret.headers.#{scope}.#{column.name}",
                            :default => column.name.to_s.humanize).squish
end