<% if !settings[:checkboxes].blank? && settings[:checkboxes] %> <% end %> <% if !settings[:row].blank? && !settings[:row][:functions].blank? %> <% end %> <% order_by_arr = settings[:params][:order_by].downcase.split(",") unless settings[:params][:order_by].blank? %> <% settings[:columns].each do |col| %> <% end %> <% if !settings[:checkboxes].blank? && settings[:checkboxes] %> <% end %> <% if !settings[:row].blank? && !settings[:row][:functions].blank? %> <% end %> <% order_by_arr = settings[:params][:order_by].downcase.split(",") unless settings[:params][:order_by].blank? %> <% settings[:columns].each do |col| %> <% order_id = (col[:table].blank? || col[:name].blank?) ? "" : (col[:table] + "___" + col[:name] + "") %> <% order_asc_id = (col[:table].blank? || col[:name].blank?) ? "" : (col[:table] + "___" + col[:name] + "___asc") %> <% order_desc_id = (col[:table].blank? || col[:name].blank?) ? "" : (col[:table] + "___" + col[:name] + "___desc") %> <% sorted_class = "" if col[:column_method].blank? && col[:row_method].blank? && !col[:name].blank? sorted_class += "sorting_th " sorting_onclick = "TableSorting.force_toggled_change_sorting('#{settings[:form_id]}','#{col[:table] + "." +col[:name]}', this); return false;" sorting_mouseover = "TableSorting.mouse_over_hover_sorting('#{settings[:form_id]}','#{col[:table] + "." +col[:name]}', this); return false;" sorting_mouseout = "TableSorting.mouse_out_hover_sorting('#{settings[:form_id]}','#{col[:table] + "." +col[:name]}', this); return false;" if (order_by_arr.include?(col[:table] + "." + col[:name] + " desc")) sorted_class +="sorted sorted_desc" elsif (order_by_arr.include?(col[:table] + "." + col[:name] + " asc")) sorted_class +="sorted sorted_asc" end end %> <% end %> <% unless settings[:template].blank? %> <%= render :partial => settings[:template], :locals => {:settings => settings} %> <% end %>
<% if settings[:display_method].blank? %> <% case col[:filter] %> <% when :find %>
<% saved_param = (!settings[:params].blank? && !settings[:params]['find'].blank? && !settings[:params]['find']["#{col[:table]}.#{col[:name]}"].blank?) ? settings[:params]['find']["#{col[:table]}.#{col[:name]}"] : "" %> <%= text_field_tag "find[#{col[:table]}.#{col[:name]}]", saved_param, {:class => "text first #{settings[:form_id] + '_column_find'}"} %>
<% when :find_exact %>
<% saved_param = (!settings[:params].blank? && !settings[:params]['find_exact'].blank? && !settings[:params]['find_exact']["#{col[:table]}.#{col[:name]}"].blank?) ? settings[:params]['find_exact']["#{col[:table]}.#{col[:name]}"] : "" %> <%= text_field_tag "find_exact[#{col[:table]}.#{col[:name]}]", saved_param, {:class => "text first #{settings[:form_id] + '_column_find'}"} %>
<% when :multichoice %>
<% saved_param = (!settings[:params].blank? && !settings[:params]['multichoice'].blank? && !settings[:params]['multichoice']["#{col[:table]}.#{col[:name]}"].blank?) ? settings[:params]['multichoice']["#{col[:table]}.#{col[:name]}"] : [] %> <%= select_tag("multichoice[#{col[:table]}.#{col[:name]}]", options_for_select(col[:filter_data], saved_param), :onchange => "form_submit_watcher('#{settings[:form_id]}')", :multiple => true, :class => "multiselect_class") %>
<% when :number %>
<% saved_param = (!settings[:params].blank? && !settings[:params]['number_from'].blank? && !settings[:params]['number_from']["#{col[:table]}.#{col[:name]}"].blank?) ? settings[:params]['number_from']["#{col[:table]}.#{col[:name]}"] : "" %> <%= text_field_tag "number_from[#{col[:table]}.#{col[:name]}]", saved_param, {:class => "text first #{settings[:form_id] + '_column_find'}", :onchange => "form_submit_watcher('#{settings[:form_id]}')", :placeholder => "min.", :title => "Hodnota musí být vetší nebo rovna zadané hodnotě"} %> <% saved_param = (!settings[:params].blank? && !settings[:params]['number_to'].blank? && !settings[:params]['number_to']["#{col[:table]}.#{col[:name]}"].blank?) ? settings[:params]['number_to']["#{col[:table]}.#{col[:name]}"] : "" %> <%#= label_tag "date_to[#{col[:table]}.#{col[:name]}]", "Do", :class => "datetime_class_label" %> <%= text_field_tag "number_to[#{col[:table]}.#{col[:name]}]", saved_param, {:class => "text #{settings[:form_id] + '_column_find'}", :onchange => "form_submit_watcher('#{settings[:form_id]}')", :placeholder => "max.", :title => "Hodnota musí být menší nebo rovna zadané hodnotě"} %>
<% when :date %>
<% saved_param = (!settings[:params].blank? && !settings[:params]['date_from'].blank? && !settings[:params]['date_from']["#{col[:table]}.#{col[:name]}"].blank?) ? settings[:params]['date_from']["#{col[:table]}.#{col[:name]}"] : "" %> <%#= label_tag "date_from[#{col[:table]}.#{col[:name]}]", "Od", :class => "datetime_class_label" %> <%= text_field_tag "date_from[#{col[:table]}.#{col[:name]}]", saved_param, {:class => "text datetime_class first", :onchange => "form_submit_watcher('#{settings[:form_id]}')", :placeholder => "od", :title => "Datum od"} %> <% saved_param = (!settings[:params].blank? && !settings[:params]['date_to'].blank? && !settings[:params]['date_to']["#{col[:table]}.#{col[:name]}"].blank?) ? settings[:params]['date_to']["#{col[:table]}.#{col[:name]}"] : "" %> <%#= label_tag "date_to[#{col[:table]}.#{col[:name]}]", "Do", :class => "datetime_class_label" %> <%= text_field_tag "date_to[#{col[:table]}.#{col[:name]}]", saved_param, {:class => "text datetime_class", :onchange => "form_submit_watcher('#{settings[:form_id]}')", :placeholder => "do", :title => "Datum do"} %>
<% else %> <% end %> <% end %>
<%= col[:label].html_safe %>