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





                  
                  
-@sidebar = false

-content_for :corps do   

  -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
    
    
    =raw "</div>"
    -if img_url
      .menu_item_top.principal{:style => "background-image:url('#{img_url}');"}
        -if !@menu_item.title_cached
          
          %h1.first_title=raw @menu_item.menu_content.lang_pages.find_by_lang_site_id(@lang.id).title
    -else
      =#%div{:style => "height:55px;"}
    =raw "<div class='main_container'>"
    
  
  .menu_content_inner{:class => @menu_item_lang.slug}
    .inner
      .menu_item_content
        


              

        =render :partial => "public/blocks/block", :locals => {:block => @menu_item.menu_content.blocks.find_by_lang_site_id(@lang.id)}
  
  
      .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 @jipe_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

    
          

-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()
