-if @menu_item.menu_content.page_type_id == 2 or @menu_item.menu_content.page_type_id == 3


  -if @menu_item.menu_content.page_type_id == 2
    -menu_item_id = @menu_item.parent.id
    -menu_item_test_id = @menu_item.id
  -else
    -menu_item_id = @menu_item.parent.parent.id
    -menu_item_test_id = @menu_item.parent.id
  
  .dark_bottom_links.thematique_menu{:style => "margin-bottom:0;"}
    -if MenuItem.find(menu_item_id).menu_content.page_type_id == 4
    
    
      -if MenuItem.where(:parent_id => menu_item_id).where("id != ?", menu_item_test_id).order(:position).count > 0
    
        -if @menu_item.ancestors.map {|e| e.id}.include?(260)
          %h3=qit "Combats similaires"
        -else
          %h3=qit "bottom-A lire également", "A lire également"
        -MenuItem.where(:parent_id => menu_item_id).where("id != ?", menu_item_test_id).order(:position).each do |menu_item|
          - img_url = ""
          -menu_item_lang = menu_item.menu_item_langs.find_by_lang_site_id(@lang.id)


          -name = menu_item_lang.name
    
          -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-color:black;background-image:url('#{img_url}');background-size:100%;background-size:cover;background-position:center center;display:block;min-height:50px;"
    
    
    
          -if menu_item_lang.enabled == true and menu_item_lang.visible == true

            =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
              .link
                .square_link{:style => css_style}
        
                %span=menu_item.menu_item_langs.find_by_lang_site_id(@lang.id).name
    -else
      %h3=qit "Nos autres combats"
      -MenuItem.where(:parent_id => 272).order(:position).limit(4).each do |menu_item|
        - img_url = ""
        -menu_item_lang = menu_item.menu_item_langs.find_by_lang_site_id(@lang.id)


        -name = menu_item_lang.name
  
        -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-color:black;background-image:url('#{img_url}');background-size:100%;background-size:cover;background-position:center center;display:block;min-height:50px;"
  
  
  
        -if menu_item_lang.enabled == true and menu_item_lang.visible == true

          =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
            .link
              .square_link{:style => css_style}
      
              %span=menu_item.menu_item_langs.find_by_lang_site_id(@lang.id).name
    



-if @menu_item.menu_content.page_type_id == 4
  .dark_bottom_links.thematique_menu{:style => "margin-bottom:0;"}
    -if @menu_item.id != 259
      %h3=qit "Focus sur la thématique"
    -else
      %h3=qit "bottom-A lire également", "A lire également"
    -MenuItem.where(:parent_id => @menu_item.id).order(:position).each do |menu_item|
      - img_url = ""
      -menu_item_lang = menu_item.menu_item_langs.find_by_lang_site_id(@lang.id)


      -name = menu_item_lang.name
    
      -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-color:black;background-image:url('#{img_url}');background-size:100%;background-size:cover;background-position:center center;display:block;min-height:50px;"
    
    
    
      -if menu_item_lang.enabled == true and menu_item_lang.visible == true

        =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
          .link
            .square_link{:style => css_style}
        
            %span=menu_item.menu_item_langs.find_by_lang_site_id(@lang.id).name
  =#THEMES
-elsif (@menu_item.children.size > 0 and !@menu_item.parent_id ) or (@menu_item.parent and !@menu_item.parent.parent_id)
  .dark_bottom_links.thematique_menu{:style => "margin-bottom:0;"}
    
    -if @menu_item.parent
      -menu_item = @menu_item.parent
    -else
      -menu_item = @menu_item
    %h3
      -if menu_item.id == 262
        =qit "Agir autrement"
      -elsif menu_item.id == 261
        =qit "A lire également"
      -else
        =qit "bottom-A lire également", "A lire également"
    -if @menu_item and @menu_item.id == 260
      -menu_items = MenuItem.where(:parent_id => menu_item.id).where("id != ?", @menu_item.id).order(:position).limit(8)
    -else
      -menu_items = MenuItem.where(:parent_id => menu_item.id).where("id != ?", @menu_item.id).order("Rand()").limit(4)
      
    -menu_items.each do |menu_item|
      - img_url = ""
      -menu_item_lang = menu_item.menu_item_langs.find_by_lang_site_id(@lang.id)


      -name = menu_item_lang.name
    
      -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-color:black;background-image:url('#{img_url}');background-size:100%;background-size:cover;background-position:center center;display:block;min-height:50px;"
    
    
    
      -if menu_item_lang.enabled == true and menu_item_lang.visible == true

        =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
          .link
            .square_link{:style => css_style}
        
            %span=menu_item.menu_item_langs.find_by_lang_site_id(@lang.id).name
