-@ancestor_1 = @menu_item.ancestors.reverse[1] if @menu_item
-@ancestor_1 = @original_menu_item if @original_menu_item



-if @lang_page.without_text_image_file
  -@facebook_img = @lang_page.without_text_image_file.file.large.medium.url
  
  
  
-@twitter_title = @lang_page.twitter_title if @lang_page.twitter_title?

                  
                  
-@sidebar = false

-if !@new_site
  -content_for :corps do   
    -if @menu_item.id == 7
  
    
    
      =raw"</div>"
    
      .follow_row_container
        .main_container
          .inner
            -@nos_combats = MenuItem.find(7)
            -@nos_combats.children.order(:position).each do |mi|
          
              - menu_item_lang = mi.menu_item_langs.find_by_lang_site_id(@lang.id)
              -if menu_item_lang.enabled == true and menu_item_lang.visible == true
            
                -css_style = ""
            
                -ratio = 1
                -url = mi.cible_url(@lang)
                -if mi.image_file

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

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




                -css_style += "background-image:url('#{img_url}');background-size:100%;background-size:cover;background-position:center center;display:block;"


                .element#element
                  =link_to url.to_s , :style => css_style, :data => {:ratio => ratio}, :class => "with_ratio" do
 


                    .overlay


                    %h4.title
                      =#image_tag mi.icon_image_file.file.url if mi.icon_image_file
                      =mi.menu_item_langs.find_by_lang_site_id(@lang.id).name
  
  
      =raw "<div class='main_container'>"
    -elsif [247, 34,42, 251, 248, 249, 250].include?(@menu_item.id)
      =raw "</div>"
      .special_show
        -if @menu_item.id == 34
    
          %div.special_show_special1{:style => "width:50%;display:inline-block"}=render :partial => "public/menu_items/large_thumb", :locals => {:menu_item => MenuItem.find(50)}
          =render :partial => "public/menu_items/small_thumb", :locals => {:menu_item => MenuItem.find(107)}
          
              
      
        -elsif @menu_item.id == 247
          .row
            .columns.span_6
              =render :partial => "public/menu_items/large_thumb", :locals => {:menu_item => MenuItem.find(35)}
              .clear
              .row
                .columns.span_6
                  =render :partial => "public/menu_items/small_thumb", :locals => {:menu_item => MenuItem.find(110)}
                .columns.span_6
                  =render :partial => "public/menu_items/small_thumb", :locals => {:menu_item => MenuItem.find(43)}
        
            .columns.span_6
              .row
                .columns.span_6
                  =render :partial => "public/menu_items/small_thumb", :locals => {:menu_item => MenuItem.find(191)}
          
                .columns.span_6
                  =render :partial => "public/menu_items/small_thumb", :locals => {:menu_item => MenuItem.find(132)}
            
              .clear
              =render :partial => "public/menu_items/large_thumb", :locals => {:menu_item => MenuItem.find(36)}
      
        -elsif @menu_item.id == 42
          .row
            .columns.span_6
              =render :partial => "public/menu_items/large_thumb", :locals => {:menu_item => MenuItem.find(41)}
              .clear
        
              =render :partial => "public/menu_items/small_thumb", :locals => {:menu_item => MenuItem.find(241)}
          
        
            .columns.span_6
              =render :partial => "public/menu_items/small_thumb", :locals => {:menu_item => MenuItem.find(143)}
            
              .clear
              =render :partial => "public/menu_items/large_thumb", :locals => {:menu_item => MenuItem.find(244)}
      
      
        -elsif @menu_item.id == 251
          .row
            .columns.span_6
              =render :partial => "public/menu_items/large_thumb", :locals => {:menu_item => MenuItem.find(96)}
              .clear
        
              =render :partial => "public/menu_items/small_thumb", :locals => {:menu_item => MenuItem.find(224)}
          
        
            .columns.span_6
              =render :partial => "public/menu_items/small_thumb", :locals => {:menu_item => MenuItem.find(256)}
            
              .clear
              =render :partial => "public/menu_items/large_thumb", :locals => {:menu_item => MenuItem.find(95)}
      
        -elsif @menu_item.id == 248
          .row
            .columns.span_6
              =render :partial => "public/menu_items/large_thumb", :locals => {:menu_item => MenuItem.find(45)}
              .clear
        
              =render :partial => "public/menu_items/small_thumb", :locals => {:menu_item => MenuItem.find(47)}
          
        
            .columns.span_6
              =render :partial => "public/menu_items/small_thumb", :locals => {:menu_item => MenuItem.find(46)}
            
              .clear
              =render :partial => "public/menu_items/large_thumb", :locals => {:menu_item => MenuItem.find(253)}
           
        -elsif @menu_item.id == 249
          .row
            .columns.span_6
              =render :partial => "public/menu_items/large_thumb", :locals => {:menu_item => MenuItem.find(39)}
              .clear
            
            .columns.span_6
              .row
                .columns.span_6
                  =render :partial => "public/menu_items/small_thumb", :locals => {:menu_item => MenuItem.find(118)}
          
                .columns.span_6
                  =render :partial => "public/menu_items/small_thumb", :locals => {:menu_item => MenuItem.find(225)}
            
              .clear
            
        -elsif @menu_item.id == 250
          .row
            .columns.span_6
              =render :partial => "public/menu_items/large_thumb", :locals => {:menu_item => MenuItem.find(48)}
              .clear
            
            .columns.span_6
              =render :partial => "public/menu_items/small_thumb", :locals => {:menu_item => MenuItem.find(185)}
          
      
        .clear
      =raw "<div class='main_container'>"
  
  
    -elsif [9].include?(@menu_item.id)
      =raw "</div>"
      .follow_row_container{:style => "padding:6% 0;padding-bottom:7%;"}
        .main_container
          -if false
            .first_title
              %h1{:style => "padding-top:0"}=raw @menu_item.menu_content.lang_pages.find_by_lang_site_id(@lang.id).title
              
      
   
          .row
            .columns.span_6
              =render :partial => "public/menu_items/large_thumb", :locals => {:menu_item => MenuItem.find(14), :skip_desc => true}
          
      
            .columns.span_6
              =render :partial => "public/menu_items/large_thumb", :locals => {:menu_item => MenuItem.find(17), :skip_desc => true}
          .clear
      :scss
        .follow_row_container{
          .main_container{
            max-width:1200px;
          }
          .large_thumb{
            max-width:500px;
          }
        }
      =raw "<div class='main_container'>"
  
    -else
      -if @menu_item.title_image
        -if @menu_item.menu_item_langs.find_by_lang_site_id(@lang.id).image_file
          -img_url = @menu_item.menu_item_langs.find_by_lang_site_id(@lang.id).image_file.file.large.url 
          -@facebook_img =  @menu_item.menu_item_langs.find_by_lang_site_id(@lang.id).image_file.file.large.medium.url
        -elsif @menu_item.image_file
          -img_url = @menu_item.image_file.file.large.url 
          -@facebook_img =  @menu_item.image_file.file.large.medium.url
        -if img_url
          .menu_item_top.principal{:style => "background-image:url('#{img_url}');"}
        -else
          %div{:style => "height:55px;"}
        
      
    
      .menu_content_inner{:class => @menu_item_lang.slug}
        .inner
          .menu_item_content
            -if !@menu_item.title_cached
              .first_title
                %h1=raw @menu_item.menu_content.lang_pages.find_by_lang_site_id(@lang.id).title
                -if @new_site
                  %hr
                  .description
                    =raw @menu_item.menu_content.lang_pages.find_by_lang_site_id(@lang.id).description
      

                

            =render :partial => "public/blocks/block", :locals => {:block => @menu_item.menu_content.blocks.find_by_lang_site_id(@lang.id)}
    
          -if @menu_item.id != 107
            .bottom_subpages
              -@menu_item.children.order(:position).each do |menu_item|
          
                -menu_item_lang = menu_item.menu_item_langs.find_by_lang_site_id(@lang.id)
 
            
                -name = menu_item_lang.name
                -if menu_item_lang.enabled == true and menu_item_lang.visible == true
                  -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;display:block;min-height:50px;"


                  .subpage_link
                    =link_to @one_voice_host.to_s+menu_item_path(:url => menu_item_lang.url, :lang => @lang.slug) , :class => "with_ratio" do
                      .with_ratio{:style => css_style, :data => {:ratio => 0.62}}
                

                      .overlay


                      %h4.title
                        =menu_item.menu_item_langs.find_by_lang_site_id(@lang.id).name
              
          
    
    
    
    
          -articles_ids = @menu_item.articles.all.map {|u| u.id}
          -categories_ids = @menu_item.categories.map {|u| u.id}
          -tags_ids = @menu_item.tags.map {|u| u.id}
    
          - tags_articles_ids = Article.joins(:tags).where(:tags =>{:id => tags_ids }).map {|u| u.id}
    
          - categories_articles_ids = Article.where(:category_id => categories_ids ).map {|u| u.id}
    
          -ids = articles_ids + categories_articles_ids +tags_articles_ids
          -ids =ids.sort.uniq
    
          -articles = Article.recents.where("articles.published_at <= ?", Date.today).joins(:lang_articles).where("lang_articles.enabled = 1 and lang_articles.lang_site_id = ?", @lang.id)
          -articles = articles.where(:id => ids)
          -articles = articles.order("published_at DESC")
          -articles = articles.limit(10)
          -if articles.count > 0
            .center{:style => "padding:0 10px;margin:40px 20px;border-top:1px solid rgba(5, 5, 5, 0.05);border-bottom:1px solid rgba(5, 5, 5, 0.05);"}
    
              %h3 
                =qit 'Pages - Titre articles associés ', "Pour aller plus loin, sur notre"
                =link_to("blog", "/fr/blog.html")+"..."
        
      
              %ul
                -articles.each do |article|
                  %li
                    -lang_article = article.lang_articles.find_by_lang_site_id(@lang.id)
                    =link_to lang_article.title, article_path(:slug => lang_article.slug, :lang => @lang.slug)
      
   
      
          -if @menu_item.slug != "index" and @menu_item.ancestors.length >= 1 and !@original_menu_item
            .breadcrumb          
              -if @menu_item.ancestors
                =link_to i(:home), "/"
                >
                -for menu_item in @menu_item.ancestors.reverse 
                  =menu_item_link(menu_item)
                  >

                =@menu_item.menu_item_langs.find_by_lang_site_id(@lang.id).name

    
        
    -if current_admin
      .admin_panel
        =link_to i(:pencil), edit_admin_menu_item_path(:id => @menu_item.menu_content.menu_item.id, :lang => @lang.slug), :class => "btn btn-primary"
      
        =link_to "Télécharger l'image de bandeau", @menu_item.image_file.file.large.url, :class => "btn btn-primary" if @menu_item.image_file
    
  
  
      
    

  =yield :corps

-else
  
  -if @menu_item_lang.permalink == "index"
    .render_block.home_render_block
      =render :partial => "public/blocks/block", :locals => {:block => @menu_item.menu_content.blocks.find_by_lang_site_id(@lang.id)}
  -else
    -if @menu_item.title_image
      -if @menu_item.menu_item_langs.find_by_lang_site_id(@lang.id).image_file
        -img_url = @menu_item.menu_item_langs.find_by_lang_site_id(@lang.id).image_file.file.large.url 
        -@facebook_img =  @menu_item.menu_item_langs.find_by_lang_site_id(@lang.id).image_file.file.large.medium.url
      -elsif @menu_item.image_file
        -img_url = @menu_item.image_file.file.large.url 
        -@facebook_img =  @menu_item.image_file.file.large.medium.url
      -if img_url
        .menu_item_top.principal.with_ratio{:style => "background-image:url('#{img_url}');", :data => {:ratio => 0.30}}
      -else
        %div{:style => "height:55px;"}
    
  

    .menu_content_inner{:class => @menu_item_lang.slug}
      .inner
        .menu_item_content
          -if !@menu_item.title_cached
            .first_title
              -if @menu_item.menu_content.page_type_id == 3
              
                %h1=raw @menu_item.parent.menu_content.lang_pages.find_by_lang_site_id(@lang.id).title
              
              
              -else
                %h1=raw @menu_item.menu_content.lang_pages.find_by_lang_site_id(@lang.id).title
              -if @new_site
                %hr
                -if @menu_item.menu_content.page_type_id == 2 or @menu_item.menu_content.page_type_id == 3
                  .chapitre_menu
                    -if @menu_item.menu_content.page_type_id == 3
                      -chapitre_id = @menu_item.parent.id
                    -else
                      -chapitre_id = @menu_item.id
                    -MenuItem.where(:parent_id => chapitre_id).order(:position).each do |menu_item|
          
                      -menu_item_lang = menu_item.menu_item_langs.find_by_lang_site_id(@lang.id)
 
            
                      -name = menu_item_lang.name
                      -if menu_item_lang.enabled == true and menu_item_lang.visible == true and menu_item.menu_content.page_type_id == 3
                
                        =link_to @one_voice_host.to_s+menu_item_path(:url => menu_item_lang.url, :lang => @lang.slug) , :class => "chapitre_link "+("active" if menu_item.id == @menu_item.id).to_s do
                          =menu_item.menu_item_langs.find_by_lang_site_id(@lang.id).name
                        %span.sep
                          |
                .description
                  =raw @menu_item.menu_content.lang_pages.find_by_lang_site_id(@lang.id).description
                
   
  

            

          .render_block
            =render :partial => "public/blocks/block", :locals => {:block => @menu_item.menu_content.blocks.find_by_lang_site_id(@lang.id)}
            .bottom_space
        
        
        
          =render :partial => "public/menu_items/bottom"
                
      -if current_admin
        .admin_panel
          =link_to i(:pencil), edit_admin_menu_item_path(:id => @menu_item.menu_content.menu_item.id, :lang => @lang.slug), :class => "btn btn-primary"
      
          =link_to "Télécharger l'image de bandeau", @menu_item.image_file.file.large.url, :class => "btn btn-primary" if @menu_item.image_file
    
  
        

-if @sidebar
  :coffeescript
    resize_menu_content_inner = ->
      $('.menu_content_inner').css
        "width" : ($(".widther").outerWidth() - $(".side_menu").outerWidth())+"px"
        "float" : "left"
    resize_menu_content_inner()
    $(window).bind "resize", ->
      resize_menu_content_inner()
