=semantic_form_for [:admin, @popup] do |f|

  =f.inputs do
    =f.input :lang_site_id, :label => "Langue :", :as => :select, :collection => LangSite.all, :include_blank => false
    =f.input :enabled, :label => "Publié ?", :as => :boolean
    
    = f.input :start_at, :label => "Date de début : ",:as => :datetime_select
    = f.input :end_at, :label => "Date de fin : ",:as => :datetime_select
    
    = f.input :nbr_occurrences, :label => "Nombre de fois à afficher :"
    
    -if @popup.popup_popupables.count > 0    
      %hr
      Articles et page où la popup apparait :          
      -if @popup.id
        %table.table   
          -@popup.popup_popupables.each do |popup_popupable|
            %tr
      
    
              -if popup_popupable.popupable.class.name == "Article"
                %td Article
                %td=link_to popup_popupable.popupable.lang(@lang.slug).title, edit_admin_article_path(popup_popupable.popupable), :target => "_blank"
      
              -elsif popup_popupable.popupable.class.name == "MenuItem"
                %td Page
                %td=link_to popup_popupable.popupable.menu_item_langs.find_by_lang_site_id(@lang.id).name, edit_admin_menu_item_path(popup_popupable.popupable), :target => "_blank"
      %hr
    
    
    = f.input :logo, :label => "Afficher le logo ?", :as => :boolean
    = f.input :title, :label => "Titre"
    = f.input :description, :label => "Description"
    
    = f.input :version_id, :label => "ID Version :"
   
    
  %p
    %br
    =f.submit "sauvegarder", :class => "btn btn-primary"
  

        
        