.slide_home_wrapper
  .slide_home.slider

    -@home_slider = HomeSlider.find_by_slug("home2")
    -@date = Time.now
    -if @home_slider
      -@home_slides_simu = @home_slider.home_slider_slides.where(:enabled => true)
      -@home_slides_simu = @home_slides_simu.where("start_at IS NULL or start_at <= ?",@date)
      -@home_slides_simu = @home_slides_simu.where("end_at IS NULL or end_at >= ?",@date)
      -@home_slides_simu = @home_slides_simu.order(:position)
      -@home_slides_simu = @home_slides_simu.joins(:lang_sites).where("lang_sites.id = ?", @lang.id)
      -@home_slides_simu.each do |home_slider_slide|
        -if home_slider_slide.image_file
          =link_to home_slider_slide.url.to_s, :target => ("_blank" if home_slider_slide.popup) do
            %div.with_ratio.slide{:style => "background-image:url('#{home_slider_slide.image_file.file.large.url}');background-size:100%;background-size:cover;", :data => {:ratio => 0.28}}
          
              .description.vertical_center
                %h3
                  -if home_slider_slide.article
                    -lang_article = home_slider_slide.article.lang_articles.find_by_lang_site_id(@lang.id)
                    =lang_article.title
                  -else
                    =home_slider_slide.titre1
              
                -if home_slider_slide.titre2?
                  .sub_title=home_slider_slide.titre2
                -elsif home_slider_slide.article
                  .sub_title
                    -if home_slider_slide.article.category
                      
                      -cats = []
                      -home_slider_slide.article.categories.uniq.each do |cat|
                        -cats << cat.lang(I18n.locale.to_s).name
                      =cats.join(", ")
                      
                      %span.sep
                        ="|"
                      =l(home_slider_slide.article.published_at, :format => :human_date)
                .date
                  =home_slider_slide.description1
          
                .btn
                  =home_slider_slide.cta_text
          
          
          
         
    

:javascript
  $(document).ready(function(){
  $('.slider').bxSlider({
    nextText: '>',
    prevText: '<'
  });
  });
  




-@home_slider = HomeSlider.find_by_slug("breve")

-@date = Time.now
-if @home_slider
  -@home_slides_simu = @home_slider.home_slider_slides.where(:enabled => true)
  -@home_slides_simu = @home_slides_simu.where("start_at IS NULL or start_at <= ?",@date)
  -@home_slides_simu = @home_slides_simu.where("end_at IS NULL or end_at >= ?",@date)
  -@home_slides_simu = @home_slides_simu.order(:position)
  -@home_slides_simu = @home_slides_simu.joins(:lang_sites).where("lang_sites.id = ?", @lang.id)
  -if @home_slides_simu.size > 0
    .slider_breve_wrapper
      .inner
        .angle{:onclick => ""}
          =ic :"angle-right"
      .slider_breve
  
  
        -@home_slides_simu.each do |home_slider_slide|
 
          =link_to home_slider_slide.url.to_s, :target => ("_blank" if home_slider_slide.popup) do
    
            .inner
              .description
                %h3.bclamp{:style => ""}=home_slider_slide.titre1
  
      
    
    
          

-@articles = Article.before(Time.now).recents.joins(:lang_articles).where("lang_articles.enabled = 1 and lang_articles.lang_site_id = ?", @lang.id).limit(6)

- article = @articles[0]
-lang_article = article.lang_articles.find_by_lang_site_id(@lang.id)

.home_articles

  -img_url = ""
  -if article.without_text_image_file
    -img_url = "https://3p.quartz.xyz"+article.without_text_image_file.file.large.medium.url
  -if article.image_file
    -img_url = "https://3p.quartz.xyz"+article.image_file.file.large.medium.url
  -else
    -img_url = ""
    
  .desktop_inline
    .home_article_header
      .img.with_ratio{:style => "background: black center center;background-image:url('#{img_url}');position:relative;background-size:cover;", :data => {:ratio => 0.62}}

      .description
    

        %h2= lang_article.title
  
        .date
          %hr
          =l article.published_at, :format => "%d/%m/%Y"
          %span.sep
            ="|"
          =l article.published_at, :format => "%H:%M"
    
        .cat
          -cats = []
          -article.categories.uniq.each do |cat|
            -cats << link_to(cat.lang(I18n.locale.to_s).name, category_public_article_path(:lang => @lang.slug,:slug => cat.lang(I18n.locale.to_s).slug), :title => "Articles de la catégorie \""+cat.lang(I18n.locale.to_s).name.to_s+'"')
          =raw cats.join(", ")
      
      
        =simple_format lang_article.description.truncate(160, separator: ' ')
        .cta
          =link_to qit("Lire l'article"), article_path(:slug => lang_article.slug, :lang => @lang.slug), :class => "btn" 
      .clear

  
  .row.home_article_sub_headers
    .mobile_inline
      -@articles[0..0].each do  |article|
        -lang_article = article.lang_articles.find_by_lang_site_id(@lang.id)
        -img_url = ""
        -if article.without_text_image_file
          -img_url = "https://3p.quartz.xyz"+article.without_text_image_file.file.large.medium.small.url
        -if article.image_file
          -img_url = "https://3p.quartz.xyz"+article.image_file.file.large.medium.small.url
        -else
          -img_url = ""
        .columns.span_4
          .home_article_sub_header
            =link_to article_path(:slug => lang_article.slug, :lang => @lang.slug) do
              .img.with_ratio{:style => "background: black center center;background-image:url('#{img_url}');position:relative;background-size:cover;", :data => {:ratio => 0.62}}
                =image_tag "/blog-hover.png", :class => "vertical_center"
            =link_to article_path(:slug => lang_article.slug, :lang => @lang.slug) do
              %h2= lang_article.title
            .description
            

              =link_to article_path(:slug => lang_article.slug, :lang => @lang.slug) do
            
                .date
            
                  =l article.published_at, :format => "%d/%m/%Y"
                  %span.sep
                    ="|"
                  =l article.published_at, :format => "%H:%M"
    
              .cat
                -cats = []
                -article.categories.uniq.each do |cat|
                  -cats << link_to(cat.lang(I18n.locale.to_s).name, category_public_article_path(:lang => @lang.slug,:slug => cat.lang(I18n.locale.to_s).slug), :title => "Articles de la catégorie \""+cat.lang(I18n.locale.to_s).name.to_s+'"')
                =raw cats.join(", ")
      
              =link_to article_path(:slug => lang_article.slug, :lang => @lang.slug) do
                =simple_format lang_article.description.truncate(160, separator: ' ')
  
    -@articles[1..2].each do  |article|
      -lang_article = article.lang_articles.find_by_lang_site_id(@lang.id)
      -img_url = ""
      -if article.without_text_image_file
        -img_url = "https://3p.quartz.xyz"+article.without_text_image_file.file.large.medium.small.url
      -if article.image_file
        -img_url = "https://3p.quartz.xyz"+article.image_file.file.large.medium.small.url
      -else
        -img_url = ""
      .columns.span_4
        .home_article_sub_header
          =link_to article_path(:slug => lang_article.slug, :lang => @lang.slug) do
            .img.with_ratio{:style => "background: black center center;background-image:url('#{img_url}');position:relative;background-size:cover;", :data => {:ratio => 0.62}}
              =image_tag "/blog-hover.png", :class => "vertical_center"
          =link_to article_path(:slug => lang_article.slug, :lang => @lang.slug) do
            %h2= lang_article.title
          .description
            

            =link_to article_path(:slug => lang_article.slug, :lang => @lang.slug) do
            
              .date
            
                =l article.published_at, :format => "%d/%m/%Y"
                %span.sep
                  ="|"
                =l article.published_at, :format => "%H:%M"
    
            .cat
              -cats = []
              -article.categories.uniq.each do |cat|
                -cats << link_to(cat.lang(I18n.locale.to_s).name, category_public_article_path(:lang => @lang.slug,:slug => cat.lang(I18n.locale.to_s).slug), :title => "Articles de la catégorie \""+cat.lang(I18n.locale.to_s).name.to_s+'"')
              =raw cats.join(", ")
            =link_to article_path(:slug => lang_article.slug, :lang => @lang.slug) do
              =simple_format lang_article.description.truncate(160, separator: ' ')
       
    
    .columns.span_4.last-child
      =link_to "/#{I18n.locale.to_s}/blog.html" do
        .blog_encart
          =image_tag "/logo_blog.png"
            
          %h3 Blog
      .home_article_more
        =link_to "/#{I18n.locale.to_s}/blog.html" do
          %h4=qit "Lire plus d'articles"
        %hr
        -@articles[3..5].each do |article|
          -lang_article = article.lang_articles.find_by_lang_site_id(@lang.id)
          =link_to article_path(:slug => lang_article.slug, :lang => @lang.slug), :class => "article_line" do
            = lang_article.title
            %span.sep
              >
    .clear
        
    
-@menu_item_combat = MenuItem.find(260)
-if @lang.slug == "fr"
  .home_nos_combats
    %h1= @menu_item_combat.menu_content.lang_pages.find_by_lang_site_id(@lang.id).title
    %p.desc
      = @menu_item_combat.menu_content.lang_pages.find_by_lang_site_id(@lang.id).description
    
    .inner_combats
      -i = 0
      -MenuItem.where(:parent_id => @menu_item_combat.id).order(:position).each do |menu_item|
        -i += 1

        -menu_item_lang = menu_item.menu_item_langs.find_by_lang_site_id(@lang.id)


        -name = menu_item_lang.name
      
        -img_url = ""
        -if menu_item.image_file


        
          -img_url = menu_item.image_file.file.large.medium.url 

          -if menu_item.image_file and menu_item.image_file.photograph
            -@page_images_credits << menu_item.image_file.photograph




        -css_style = "background-image:url('#{img_url}');background-size:100%;background-size:cover;background-position:center center;background-color:black;"
    
    
    
        -if menu_item_lang.enabled == true and menu_item_lang.visible == true
          -if i <= 6
            =link_to @one_voice_host.to_s+menu_item_path(:url => menu_item_lang.url, :lang => @lang.slug) ,:style => css_style, :class => "square_link "+("active" if menu_item.id == @menu_item.id).to_s do
              .inner
                .vertical_center=menu_item.menu_item_langs.find_by_lang_site_id(@lang.id).name
        
          -else
            =link_to @one_voice_host.to_s+menu_item_path(:url => menu_item_lang.url, :lang => @lang.slug) ,:class => "line_combat_link "+("active" if menu_item.id == @menu_item.id).to_s do
              .right
                >
            
              =menu_item.menu_item_langs.find_by_lang_site_id(@lang.id).name
          
       