.qi_header
  .right
    =link_to "export CSV", export_admin_petitions_path(:format => :csv), :class => "btn"
    = link_to 'Ajouter une pétition', new_admin_petition_path(), :class => "btn btn-primary"
  %h1 
    Pétitions
    
.qi_row
  .qi_pannel.qi_plain.padding
    %table.stat_table.table.table-striped
      %tr
        %th Nom
        %th Url
        %th Nbr sign.
        %th
    


      - @petitions.each do |petition| 
        -petition_lang = petition.petition_langs[0]
        %tr
          %td= petition_lang.title
          %td
            =link_to petition_lang.lang_site.name, petition_path(:slug => petition_lang.slug, :lang => petition_lang.lang_site.slug), :target => "_blank" if petition.petition_langs[0].slug?
            =link_to petition.petition_langs[1].lang_site.name, petition_path(:slug => petition.petition_langs[1].slug, :lang => petition.petition_langs[1].lang_site.slug), :target => "_blank" if petition.petition_langs[1].slug?
        
          %td
            =petition.confirmed_signators_number
            ="("+(petition.signators_number-petition.confirmed_signators_number).to_s+" en attente)" if petition.signators_number-petition.confirmed_signators_number > 0
          %td.actions{:style => "width:150px;"}
            = link_to i(:"trash-o"), [:admin, petition], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cette petition ? Les signatures seront également supprimées.' } 
            = link_to i(:pencil), edit_admin_petition_path(petition)
            = link_to i(:info), [:admin, petition]
            = link_to i(:"bar-chart"), stats_admin_petition_path(petition)
    
