<% # Copyright (C) 2014 - present Instructure, Inc. # # This file is part of Canvas. # # Canvas is free software: you can redistribute it and/or modify it under # the terms of the GNU Affero General Public License as published by the Free # Software Foundation, version 3 of the License. # # Canvas is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more # details. # # You should have received a copy of the GNU Affero General Public License along # with this program. If not, see . %> <% granted_permissions = ContextExternalTool.global_navigation_granted_permissions(root_account: @domain_root_account, user: @current_user, context: @context || @domain_root_account, session: session) tools = ContextExternalTool.filtered_global_navigation_tools(@domain_root_account, granted_permissions).map do |tool| tool_display = tool.extension_setting('global_navigation', 'windowTarget') == '_blank' ? 'borderless' : nil tool_path = account_external_tool_path(@domain_root_account, tool, launch_type: 'global_navigation', display: tool_display) { tool: tool, tool_path: tool_path, current_page: current_page?(tool_path) } end %> <%# include active tab status in cache key so that the HTML is always accurate %> <% cache([ContextExternalTool.global_navigation_menu_render_cache_key(@domain_root_account, granted_permissions), tools.pluck(:current_page)]) do %> <% tools.each do |tool_details| tool = tool_details[:tool] %> <% end %> <% end %>