
.center.row.need-container

  .row.col-md-9.gutter

    =render collection: @needs, partial: 'need_item', as: :need

    .clear
    -if @needs.num_pages > 1
      .pagination= paginate @needs

  .row.col-md-3
    .white.side-menu
      =link_to "Proposer un nouveau besoin", new_public_need_path,style:'display:block', class: 'btn btn-primary'
      %br
      = semantic_form_for :search, :html => {id: :search_form, :method => :get } do |f|
        = f.inputs do
          =f.input :q,  :as => :search, label: "Recherche", input_html: {value: params[:q], :name => 'q' }, placeholder: "Rechercher un besoin"
        .clear
        = f.inputs do
          = f.input :o, as: :order, selected:  params[:o],  input_html: {:name => 'o' }, label: "Ordre d'affichage", :include_blank => false , :as => :select, :collection => @orders
        .clear
        = f.inputs do
          = f.input :r, as: :result, selected:  params[:r],  input_html: {:name => 'r' }, label: 'Résultats par page', :include_blank => false , :as => :select, :collection => [6,12,24,48]
        .clear
        = f.inputs do
          = f.input :c, as: :category, selected:  params[:c],  input_html: {:name => 'c' }, label: 'Filtrer par catégorie', :include_blank => "Toute catégorie" , :as => :select, :collection =>  @tree.map{|c| [((c.level > 0 ? ('&nbsp;&nbsp;&nbsp;' * (c.level - 1)) + "|- ": "").html_safe + c.name if true),  c.id]}
        .clear
        = f.inputs do
          = f.input :s, as: :state, selected:  params[:s],  input_html: {:name => 's' }, label: 'Filter par état', :include_blank => "Tous les états" , :as => :select, :collection => [["En sondage","verified"],["En négociation","negociating"],["Négocié","negociated"]]
        .clear

:javascript
  $('#search_o').change(function(){$('#search_form').submit()})
  $('#search_r').change(function(){$('#search_form').submit()})
  $('#search_c').change(function(){$('#search_form').submit()})
  $('#search_s').change(function(){$('#search_form').submit()})
