Module: ZableHelper

Includes:
Zable::WillPaginate
Defined in:
app/helpers/zable_helper.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
# File 'app/helpers/zable_helper.rb', line 4

def self.included(base)
  base.send :include, Zable::Html
end

Instance Method Details

#current_sort_orderObject



17
18
19
# File 'app/helpers/zable_helper.rb', line 17

def current_sort_order
  params[:sort][:order].downcase.to_sym rescue :asc
end


21
22
23
24
# File 'app/helpers/zable_helper.rb', line 21

def link_sort_order(name)
  return nil unless sorted_column?(name)
  current_sort_order == :desc ? :asc : :desc
end

#sorted_column?(name) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'app/helpers/zable_helper.rb', line 13

def sorted_column?(name)
  params[:sort][:attr] == name.to_s rescue false
end

#zable(collection, args = {}, &block) ⇒ Object



8
9
10
11
# File 'app/helpers/zable_helper.rb', line 8

def zable(collection, args={}, &block)
  table = Zable::View.new(collection, self, args, &block)
  table.render
end