New UI: show the "courses" menu item all the time

closes: CNVS-22368

When a student only has enrollments in unpublished 
courses, they do not see a courses global nav link.
The link is needed to get to "all courses" and see 
their enrollments.

this changes things so the "courses" menu is always
shown. that way those users will be able to get
to that "all courses" link

Product / UX/UI review question:
This is just one possible way of fixing this problem.
the other thing we could do is to leave it how it was
but do a second, more expensive DB query to see if 
there are any of those unpublished or archived courses that
I can see on the /courses page but not in the course
menu. in standup, we agreed to do it like this but
if any of you feel strongly that we should do it 
the other way, that's fine too.


test plan:
Add a new user
Enroll them in an unpublished course
Masquerade as the new user, 
click the courses global nav option
you should see the "all courses" link in the tray popup

Change-Id: I140dbc4f4d2852c386cc57cac3f2afec6ef62979
Reviewed-on: https://gerrit.instructure.com/60233
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
This commit is contained in:
Ryan Shaw 2015-08-06 17:28:31 -06:00
parent edfde83901
commit 6b30f9cf85
2 changed files with 19 additions and 31 deletions

View File

@ -1,26 +1,16 @@
module GlobalNavigationHelper
def load_env_data
def load_navigation_env_data
if @current_user
@has_courses = (@current_user.menu_courses.count > 0)
@has_groups = (@current_user.current_groups.count > 0)
@has_accounts = (@current_user.all_accounts.count > 0)
visibility = ContextExternalTool.global_navigation_visibility_for_user(@domain_root_account, @current_user)
tools = ContextExternalTool.global_navigation_tools(@domain_root_account, visibility)
@mapped_tools = tools.map do |tool|
{
tool_data: tool,
link: account_external_tool_path(@domain_root_account, tool, :launch_type => 'global_navigation')
}
{
tool_data: tool,
link: account_external_tool_path(@domain_root_account, tool, :launch_type => 'global_navigation')
}
end
end
js_env({
HAS_COURSES: @has_courses || false,
HAS_GROUPS: @has_groups || false,
HAS_ACCOUNTS: @has_accounts || false,
HELP_LINK: help_link,
GLOBAL_NAV_MENU_ITEMS: @mapped_tools
})
js_env(HELP_LINK: help_link, GLOBAL_NAV_MENU_ITEMS: @mapped_tools)
end
# When k12 flag is on, replaces global navigation icon with a different one

View File

@ -1,5 +1,5 @@
<% js_bundle :navigation_header %>
<% load_env_data %>
<% load_navigation_env_data %>
<header id="header" class="ic-app-header no-print <%= 'no-user' unless @current_user %>">
<div class="ic-app-header__layout">
<div class="ic-app-header__primary">
@ -22,19 +22,17 @@
<div class="menu-item__text"><%= t('Dashboard') %></div>
</a>
</li>
<% if @has_courses %>
<li class="menu-item ic-app-header__menu-list-item <%= 'ic-app-header__menu-list-item--active' if active_path?('courses') %>">
<a id="global_nav_courses_link" href="<%= courses_path %>" class="ic-app-header__menu-list-link">
<div class="menu-item-icon-container" aria-hidden="true">
<%= svg_icon :courses_new_styles %>
</div>
<div class="menu-item__text">
<%= t('Courses') %>
</div>
</a>
</li>
<% end %>
<% if @has_groups %>
<li class="menu-item ic-app-header__menu-list-item <%= 'ic-app-header__menu-list-item--active' if active_path?('courses') %>">
<a id="global_nav_courses_link" href="<%= courses_path %>" class="ic-app-header__menu-list-link">
<div class="menu-item-icon-container" aria-hidden="true">
<%= svg_icon :courses_new_styles %>
</div>
<div class="menu-item__text">
<%= t('Courses') %>
</div>
</a>
</li>
<% if @current_user && @current_user.current_groups.count > 0 %>
<li class="menu-item ic-app-header__menu-list-item <%= ' ic-app-header__menu-list-item--active' if active_path?('groups') %>">
<a id="global_nav_groups_link" href="/groups" class="ic-app-header__menu-list-link">
<div class="menu-item-icon-container" aria-hidden="true">
@ -46,7 +44,7 @@
</a>
</li>
<% end %>
<% if @has_accounts %>
<% if @current_user && @current_user.all_accounts.count > 0 %>
<li class="menu-item ic-app-header__menu-list-item <%= ' ic-app-header__menu-list-item--active' if active_path?('accounts') %>">
<a id="global_nav_accounts_link" href="/accounts" class="ic-app-header__menu-list-link">
<div class="menu-item-icon-container" aria-hidden="true">