Newer
Older
dmpopidor / app / views / layouts / _dmponline_navigation.html.erb
<!-- Main navigation information -->

<!-- main menu -->
<% current_path = request.path%>
<% namespace = controller_path.split("/").first %>
<div id="main-nav-tabs" class="main_nav_tabs">
  <ul class="nav nav-tabs" data-tabs="tabs">
        <!-- Navigation for organisation admin -->
        <% if (user_signed_in? && current_user.is_org_admin? && ( action_name.include? "admin_" ) ) %>
             <% if namespace == "dmptemplates" then %>
                <li class="active">
            <% else %>
                <li>
            <% end %>
                <%= link_to t("org_admin.template_label"), admin_index_dmptemplate_path(current_user.organisation_id) %>
            </li>
            <% if namespace == "guidances" then %>
                <li class="active">
            <% else %>
                <li>
            <% end %>
                <%= link_to t("org_admin.guidance_label"), admin_index_guidance_path(current_user.organisation_id)%>
            </li>
            <% if namespace == "organisations" then %>
                <li class="active">
            <% else %>
                <li>
            <% end %>
                <%= link_to t("org_admin.org_details_label"), admin_show_organisation_path(current_user.organisation_id)%>
            </li>
            <% if current_path == "/org/admin/users/admin_index" || current_path == "/org/admin/users/admin_api_update" then %>
                <li class="active">
            <% else %>
                <li>
            <% end %>
                <%= link_to t("org_admin.user_list_label"), "/org/admin/users/admin_index", :class => "main_nav_last_li"%>
            </li>
        <% else %>
            <% if user_signed_in? %>
                <!-- project and plan page -->
                <% if (namespace == "projects" || namespace == "plans") && current_path != "/projects/new" then %>
                    <li class="active">
                <% else %>
                    <li>
                <% end %>
                    <%= link_to t("helpers.view_plans_label"), projects_path %>
                </li>
                <!-- create a plan page -->
                <% if current_path == "/projects/new" then %>
                    <li class="active">
                <% else %>
                    <li>
                <% end %>
                    <%= link_to t("helpers.create_plan_label"), "/projects/new"%>
                </li>

            <% else %>
                <!-- Home page -->
                <% if current_path == "/" then %>
                    <li class="active">
                <% else %>
                    <li>
                <% end %>
                    <%= link_to t("helpers.home"), root_path %>
                </li>
            <% end %>
            <!-- about_us page -->
            <% if current_path == "/about_us" then %>
                <li class="active">
            <% else %>
                <li>
            <% end %>
              <a href="<%= about_us_path %>"><%= t("helpers.about_us_label") %></a>
            </li>

            <!-- roadmap page -->
            <% if current_path == "/roadmap" then %>
                <li class="active">
            <% else %>
                <li>
            <% end %>
                <a href="<%= roadmap_path %>"><%= t("helpers.roadmap_label") %></a>
            </li>
            <!-- help page -->
            <% if current_path == "/help" then %>
                <li class="active">
            <% else %>
                <li>
            <% end %>
                <a href="<%= help_path %>" class="main_nav"><%= t("helpers.help_label") %></a>
            </li>
            <!-- language dropdown -->
            <li class="dropdown sign_in">
              <a class="dropdown-toggle main_nav" data-toggle="dropdown" href="#">
                <%= t('helpers.change_language')%>
                <b class="caret caret-orange"></b>
              </a>
              <ul class="dropdown-menu" style="padding: 0;">
                <% Language.all.order('name ASC').each do |language|%>
                    <% if I18n.locale == language.abbreviation %>
                        <li class="active">
                    <% else %>
                        <li>
                    <% end %>
                    <%= link_to language.name, {locale: language.abbreviation}, class: 'main_nav lang-dropdown-link'%>
                    </li>
                <% end %>
              </ul>
            </li>
        <%end%>
    </ul>

</div>