Sha256: af3c40619e670da782876501c9918b9c2756e546b91fa524469382f7bb7761aa
Contents?: true
Size: 1.01 KB
Versions: 4
Compression:
Stored size: 1.01 KB
Contents
module Opale 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 end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
opale-0.1.31 | lib/helpers/sortables_helper.rb |
opale-0.1.4 | lib/helpers/sortables_helper.rb |
opale-0.1.3 | lib/helpers/sortables_helper.rb |
opale-0.1.2 | lib/helpers/sortables_helper.rb |