-if (@menu_item and @menu_item.sidebar) or !@menu_item



  -content_for :sidebar do
    .large_only
      -if @menu_item.parent_id
        -if @menu_item.ancestors.reverse[0]
          -first_level_menu = @menu_item.ancestors.reverse[0]
  
      -else
    
        -first_level_menu = @menu_item
    
      -#if first_level_menu.children.size > 0
      -if first_level_menu.children.count > 0
        .square.green
          %h3=menu_item_link(first_level_menu)
          %ul
            -first_level_menu.children.where(:enabled => true, :visible => true).order(:position).each do |menu_item|
    
              %li
                =menu_item_link(menu_item)
                -if menu_item.children.where(:enabled => true, :visible => true).size > 0
                  %ul
                    -menu_item.children.where(:enabled => true, :visible => true).order(:position).each do |menu_item|
                      %li=menu_item_link(menu_item)
  
  
  .mobile_only
    -if @menu_item.parent_id
      -if @menu_item.ancestors.reverse[0]
        -first_level_menu = @menu_item.ancestors.reverse[0]

    -else
  
      -first_level_menu = @menu_item
  
    -#if first_level_menu.children.size > 0
    -if first_level_menu.children.count > 0
      .square.green
        %h3=menu_item_link(first_level_menu)
        %ul
          -first_level_menu.children.where(:enabled => true, :visible => true).order(:position).each do |menu_item|
  
            %li
              =menu_item_link(menu_item)
              -if menu_item.children.where(:enabled => true, :visible => true).size > 0
                %ul
                  -menu_item.children.where(:enabled => true, :visible => true).order(:position).each do |menu_item|
                    %li=menu_item_link(menu_item)
                    
-else

  -if @menu_item.parent_id
    -if @menu_item.ancestors.reverse[0]
      -first_level_menu = @menu_item.ancestors.reverse[0]

  -else
  
    -first_level_menu = @menu_item
  
  -#if first_level_menu.children.size > 0
  -if first_level_menu.children.count > 0
    .square.green
      %h3=menu_item_link(first_level_menu)
      %ul
        -first_level_menu.children.where(:enabled => true, :visible => true).order(:position).each do |menu_item|
  
          %li
            =menu_item_link(menu_item)
            -if menu_item.children.where(:enabled => true, :visible => true).size > 0
              %ul
                -menu_item.children.where(:enabled => true, :visible => true).order(:position).each do |menu_item|
                  %li=menu_item_link(menu_item)
          
          
          
          
  

=render :partial => "public/blocks/block", :locals => {:block => @menu_item.menu_content.blocks[0]}

