%
# Copyright (C) 2015 - 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 .
css_bundle :dashboard_card
default_number_of_fake_dashcards_to_show = 5
number_of_fake_published_cards_to_show =
Rails.cache.read(['last_known_dashboard_cards_published_count', @current_user.global_id].cache_key) ||
default_number_of_fake_dashcards_to_show
number_of_fake_unpublished_cards_to_show =
Rails.cache.read(['last_known_dashboard_cards_unpublished_count', @current_user.global_id].cache_key) ||
default_number_of_fake_dashcards_to_show
number_of_fake_cards_to_show =
Rails.cache.read(['last_known_dashboard_cards_count', @current_user.global_id].cache_key) ||
default_number_of_fake_dashcards_to_show
render_on_pageload = user_dashboard_view == 'cards'
%>
<% if render_on_pageload %>
<%# fire off these `fetch` requests now so they are ready sooner %>
<% if @current_user.roles(@domain_root_account).include?("observer") && @cards_prefetch_observed_param.present? %>
<% if !Account.site_admin.feature_enabled?(:dashboard_graphql_integration) %>
<%= prefetch_xhr("/api/v1/dashboard/dashboard_cards?observed_user_id=#{@cards_prefetch_observed_param}") %>
<% end %>
<%= prefetch_xhr("/dashboard-sidebar?observed_user_id=#{@cards_prefetch_observed_param}") %>
<% else %>
<% if !Account.site_admin.feature_enabled?(:dashboard_graphql_integration) %>
<%= prefetch_xhr("/api/v1/dashboard/dashboard_cards") %>
<% end %>
<%= prefetch_xhr("/dashboard-sidebar") %>
<% end %>
<% end %>
<% for i in 1..number_of_fake_published_cards_to_show do %>
<% end %>
<% for i in 1..number_of_fake_unpublished_cards_to_show do %>
<% end %>