Sha256: b35a2f419abbc5549f2d1860ad7b16a1661a31502da06bbf13d165b54d95c83b
Contents?: true
Size: 976 Bytes
Versions: 2
Compression:
Stored size: 976 Bytes
Contents
module SortableHelper def search_form_fields(table_name = nil, &block) searching_field = hidden_field_tag :searching, true table_name_field = hidden_field_tag :table_name, table_name unless table_name.nil? sort_field = hidden_field_tag :sort, params[:sort] || :updated_at direction_field = hidden_field_tag :direction, params[:direction] || :desc searching_field.concat(sort_field) searching_field.concat(direction_field) searching_field.concat(table_name_field) searching_field end def th(options, &block) css_class = options[:table_name] == sort_column ? "current #{sort_direction}" : nil # direction = options[:table_name] == sort_column && sort_direction == 'asc' ? 'desc' : 'asc' content_tag :th, class: options[:class], style: options[:style] do link_to '#', { class: css_class, onclick: "sortable(event, '#{options[:table_name]}')" } do block.call unless block.nil? end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
opale-0.1.1 | lib/helpers/sortables_helper.rb |
opale-0.1.0 | lib/helpers/sortables_helper.rb |