%
# 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 %>
<%= prefetch_xhr('/api/v1/dashboard/dashboard_cards') %>
<%= prefetch_xhr(dashboard_sidebar_url) %>
<% end %>
<% if @domain_root_account.feature_enabled?(:unpublished_courses) %>
<% 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 %>
<% else %>
<% for i in 1..number_of_fake_cards_to_show do %>
<% end %>
<% end %>