Module: QueriesHelper
- Defined in:
- app/helpers/queries_helper.rb
Instance Method Summary collapse
- #sort_link_helper(tab_options, text, order_by, initial_direction, nulls_option = nil, page_name = :page, ajaxify = false, ajax_controller = nil, ajax_action = nil, ajax_id = nil) ⇒ Object
- #sort_th_class_helper(order_by, initial_direction) ⇒ Object
Instance Method Details
#sort_link_helper(tab_options, text, order_by, initial_direction, nulls_option = nil, page_name = :page, ajaxify = false, ajax_controller = nil, ajax_action = nil, ajax_id = nil) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/helpers/queries_helper.rb', line 12 def sort_link_helper(, text, order_by, initial_direction, nulls_option = nil, page_name = :page, ajaxify = false, ajax_controller = nil, ajax_action = nil, ajax_id = nil) ||= {} order_by_direction = initial_direction if params[:order_by] == order_by order_by_direction = "ASC" if params[:order_by_direction] == "DESC" order_by_direction = "DESC" if params[:order_by_direction] == "ASC" end standard_params = params.merge({:order_by => order_by, :order_by_direction => order_by_direction, :tab => [:tab], :nulls_option => nulls_option, page_name => nil}) if ajaxify == true url = url_for(standard_params.merge({:controller => ajax_controller, :action => ajax_action, :id => ajax_id})) else url = url_for(standard_params) end link_to(text, url, :class => ajaxify == true ? "ajax_sort_link" : nil) end |
#sort_th_class_helper(order_by, initial_direction) ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'app/helpers/queries_helper.rb', line 3 def sort_th_class_helper(order_by, initial_direction) result = "" if params[:order_by] == order_by result = "class='sortup'" if params[:order_by_direction] == "ASC" result = "class='sortdown'" if params[:order_by_direction] == "DESC" end return result end |