56 lines
1.1 KiB
Ruby
Executable File
56 lines
1.1 KiB
Ruby
Executable File
module QiSortingHelper
|
|
|
|
def boolean_search_field(attribute, label=nil, include_nil=false)
|
|
|
|
r = ""
|
|
r += "<td>"
|
|
r += label.to_s
|
|
|
|
options = [[""], "Oui", "Non"]
|
|
|
|
r +=select_tag("search[#{attribute}]", options_for_select(options, params[:search][attribute.to_sym]))
|
|
r += "</td>"
|
|
|
|
raw r
|
|
|
|
end
|
|
|
|
|
|
def text_search_field(attribute, label=nil, include_nil=false)
|
|
|
|
r = ""
|
|
r += "<td>"
|
|
|
|
|
|
r +=text_field_tag("search[#{attribute}]", params[:search][attribute.to_sym],:class => "form-control", :placeholder => label.to_s)
|
|
|
|
r += "</td>"
|
|
|
|
raw r
|
|
|
|
end
|
|
|
|
|
|
def option_search_field(attribute, label, collection, for_label, include_nil=false)
|
|
|
|
r = ""
|
|
r += "<td>"
|
|
r += label.to_s
|
|
|
|
options = []
|
|
options << [""]
|
|
options << ["Aucune","null"]
|
|
options = options + collection.map{|a| [eval("a.#{for_label}"), a.id]}
|
|
|
|
|
|
|
|
r +=select_tag("search[#{attribute}]", options_for_select(options, params[:search][attribute.to_sym]))
|
|
r += "</td>"
|
|
|
|
raw r
|
|
|
|
end
|
|
|
|
|
|
end
|