<%
   selected_section = controller.class::SECTION if defined?(controller.class::SECTION)
   if selected_section==Navigation::SECTION_RESOURCE && !@project && !@resource
     selected_section = Navigation::SECTION_HOME
   end
%>

<script>
  window.navbarOptions.set({
    globalDashboards: [
      <% dashboards = ActiveDashboard.user_dashboards(current_user, true)
         dashboards.each_with_index do |dashboard, index| %>
      {
        url: '/dashboard/?did=<%= dashboard.dashboard_id -%>',
        name: '<%= escape_javascript dashboard.dashboard.name(true) -%>'
      }<% if index < dashboards.size - 1 -%>, <% end %>
      <% end %>
    ],
    globalPages: [
      <% pages = controller.java_facade.getPages(Navigation::SECTION_HOME.key, nil, nil, nil, nil)
         pages.each_with_index do |page, index|
      %>
      {
        url: '<%= page.isController() ? page.getId() : "/plugins/home/#{page.getId()}" -%>',
        name: '<%= escape_javascript message(page.getId() + '.page', :default => page.getTitle()) -%>'
      }<% if index < pages.size - 1 -%>, <% end %>
      <% end %>
    ],
    <%
      logo_url = property_value_by_key('sonar.lf.logoUrl')
      logo_width = property_value_by_key('sonar.lf.logoWidthPx')
    %>
    <%
      if logo_url
    %>
    logoUrl: '<%= escape_javascript logo_url -%>',
    <% end %>
    <%
      if logo_width
    %>
    logoWidth: '<%= escape_javascript logo_width -%>'
    <% end %>
  });
</script>
