Sha256: 8e6ae5f1e3723fb3bdb747a2f0c7aeb2234af73e39e4e66205b22c36f3b4d7a2
Contents?: true
Size: 1.66 KB
Versions: 1
Compression:
Stored size: 1.66 KB
Contents
module AuxiliaryAddons module ListHelper # ::Rails.logger.error("...") # # Common pagin and sorting helpers # # def checkable_field_header(options = {}) # Here is old implementation # output = check_box_tag "ids[]", 0, false, {:id => "ids_", :onclick => "checkedAll('list',this.checked);"} # output check_box_tag "ids[]", 0, false, options end def sortable_field_header (header_name, field_name, form_name = nil) url_params = Hash.new if form_name.nil? if @orderby == field_name url_params[:orderby] = field_name + " desc" else url_params[:orderby] = field_name end else if @orderby[form_name] == field_name url_params["orderby[#{form_name}]"] = field_name + " desc" else url_params["orderby[#{form_name}]"] = field_name end @orderby.each do |form, sorter| unless form.to_s == form_name.to_s url_params["orderby[#{form}]"] = sorter end end end # sort links should preserve GET parameters if request.get? request.params.each do |key, value| next if key == 'controller' next if key == 'action' next if key == 'orderby' next if key.starts_with?('orderby[') url_params[key] = value end end url_params.delete("page") output = link_to header_name, url_params output += raw(" " + image_tag("arrows/arrow_down.png")) if @orderby == field_name output += raw(" " + image_tag("arrows/arrow_up.png")) if @orderby == field_name + " desc" output end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
auxiliary_addons-0.5.7 | lib/auxiliary_addons/list_helper.rb |