<% @page_levels.each_with_index do |name, i| %>
<%
if !name.blank?
@path << '/' if !@path.blank?
@path << name
end
@parent = @page
@page = CmsPage.find_by_path @path
@page_level = i
@pages = @parent.children if @parent
break_flag = false
if !@page
if @parent && @parent.children.first
@page = @parent.children.first
elsif @parent
@page = @parent
else
@page = CmsPage.find(:first)
end
break_flag = true
end
-%>
<% if i == 0 -%>
<%= render :partial => 'list_page_select', :locals => { :list_page_select => CmsPage.find(1) } %>
<% else -%>
<%= render :partial => 'list_pages_select' %>
<% end -%>
<%= javascript_tag "$('cb_item_#{@parent.id}').className = 'cb_item cb_item_selected';" if @parent %>
<%- break if break_flag -%>
<% end -%>