Skip to content

Commit 2033bd5

Browse files
committed
Cache learning path card
1 parent f8db022 commit 2033bd5

1 file changed

Lines changed: 40 additions & 35 deletions

File tree

Lines changed: 40 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,47 @@
1-
<li class="masonry-brick media-item large block-item learning-path-bg-<%= (learning_path.id % 4) + 1 -%>">
2-
<%= link_to learning_path, class: 'link-overlay' do %>
3-
<%= item_order_badge(collection_item) if defined? collection_item %>
1+
<% cache(learning_path, expires_in: 1.hour) do %>
2+
<li class="masonry-brick media-item large block-item learning-path-bg-<%= (learning_path.id % 4) + 1 -%>">
3+
<%= link_to learning_path, class: 'link-overlay' do %>
4+
<%= item_order_badge(collection_item) if defined? collection_item %>
45

5-
<div class="masonry-brick-heading">
6-
<div class="masonry-icons">
7-
<% if current_user&.is_admin? %>
8-
<%= missing_icon(learning_path) %>
9-
<%= scrape_status_icon(learning_path) %>
10-
<%= suggestion_icon(learning_path) %>
11-
<% end %>
12-
</div>
13-
<div class="sub-heading">
14-
<%= display_attribute_no_label(learning_path, :learning_path_type) %>
15-
</div>
16-
<h4 class="mb-3"><%= learning_path.title %></h4>
17-
</div>
6+
<div class="masonry-brick-heading">
7+
<div class="masonry-icons">
8+
<% if current_user&.is_admin? %>
9+
<%= missing_icon(learning_path) %>
10+
<%= scrape_status_icon(learning_path) %>
11+
<%= suggestion_icon(learning_path) %>
12+
<% end %>
13+
</div>
14+
<div class="sub-heading">
15+
<%= display_attribute_no_label(learning_path, :learning_path_type) %>
16+
</div>
17+
<h4 class="mb-3"><%= learning_path.title %></h4>
18+
<%= rand %>
1819

19-
<div class="clearfix">
20-
<div class="pull-right">
21-
<% if controller_name != 'content_providers' && learning_path.content_provider %>
22-
<%= image_tag(learning_path.content_provider.image.url, class: 'provider-avatar') %>
23-
<% end %>
2420
</div>
2521

26-
<div>
27-
<% competency = display_difficulty_level(learning_path.difficulty_level) %>
28-
<% if competency %>
29-
<span class="label label-default"><%= competency %></span>
30-
<% end %>
31-
<span class="label label-default"><i class="fa fa-folder-open"></i> <%= pluralize(learning_path.topics.count, 'topic') %></span>
32-
<span class="label label-default"><i class="fa fa-book"></i> <%= pluralize(learning_path.topics_materials.count, 'materials') %></span>
33-
</div>
22+
<div class="clearfix">
23+
<div class="pull-right">
24+
<% if controller_name != 'content_providers' && learning_path.content_provider %>
25+
<%= image_tag(learning_path.content_provider.image.url, class: 'provider-avatar') %>
26+
<% end %>
27+
</div>
3428

35-
<div>
36-
<%= keywords_and_topics(learning_path, limit: 10) %>
29+
<div>
30+
<% competency = display_difficulty_level(learning_path.difficulty_level) %>
31+
<% if competency %>
32+
<span class="label label-default"><%= competency %></span>
33+
<% end %>
34+
<span class="label label-default"><i class="fa fa-folder-open"></i> <%= pluralize(learning_path.topics.count, 'topic') %></span>
35+
<span class="label label-default"><i class="fa fa-book"></i> <%= pluralize(learning_path.topics_materials.count, 'materials') %></span>
36+
</div>
37+
38+
<div>
39+
<%= keywords_and_topics(learning_path, limit: 10) %>
40+
</div>
3741
</div>
38-
</div>
3942

40-
<%= item_comment(collection_item) if defined? collection_item %>
41-
<% end %>
42-
</li>
43+
<%= item_comment(collection_item) if defined? collection_item %>
44+
<% end %>
45+
</li>
46+
<% end %>
47+

0 commit comments

Comments
 (0)