-
Notifications
You must be signed in to change notification settings - Fork 91
Expand file tree
/
Copy path_main_stories_feed.html.erb
More file actions
66 lines (66 loc) · 2.91 KB
/
_main_stories_feed.html.erb
File metadata and controls
66 lines (66 loc) · 2.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<% if @default_home_feed && user_signed_in? %>
<% cache("fetched-home-articles-object", expires_in: 3.minutes) do %>
<% @new_stories = Article.where("published_at > ? AND score > ?", rand(2..6).hours.ago, -30).
where(published: true).
includes(:user).
limit(rand(15..60)).
order("published_at DESC").
limited_column_select.
decorate %>
<div id="new-articles-object" data-articles="
<%= @new_stories.to_json(
only: %i[title path id user_id comments_count positive_reactions_count organization_id
reading_time video_thumbnail_url video video_duration_in_minutes
experience_level_rating experience_level_rating_distribution],
methods: %i[readable_publish_date cached_tag_list_array flare_tag class_name
cloudinary_video_url video_duration_in_minutes published_at_int],
include: {
user: { only: %i[username name], methods: [:profile_image_90] },
organization: { only: %i[slug name], methods: [:profile_image_90] }
},
) %>">
</div>
<div id="home-articles-object" data-articles="
<%= @stories.to_json(
only: %i[title path id user_id comments_count positive_reactions_count organization_id
reading_time video_thumbnail_url video video_duration_in_minutes
experience_level_rating experience_level_rating_distribution],
methods: %i[readable_publish_date cached_tag_list_array flare_tag class_name
cloudinary_video_url video_duration_in_minutes published_at_int],
include: {
user: { only: %i[username name], methods: [:profile_image_90] },
organization: { only: %i[slug name], methods: [:profile_image_90] }
},
) %>">
<% 3.times do %>
<div class="single-article single-article-small-pic">
<div class="small-pic">
<div class="color single-article-loading"></div>
</div>
<div class="content">
<h3 class="single-article-loading"> </h3>
</div>
<h4 class="single-article-loading" style="width:46%">
</h4>
<div class="tags single-article-loading" style="width:56%">
</div>
</div>
<% end %>
</div>
<% end %>
<% else %>
<% @stories.each_with_index do |story, i| %>
<% next if story.id == @featured_story.id %>
<% if !user_signed_in? && i == 4 %>
<%= render "stories/sign_in_invitation" %>
<% end %>
<%= cache ['single_story', story], expires_in: 24.hours do %>
<%= render "articles/single_story", story: story %>
<% end %>
<% end %>
<% end %>
<% if @stories.size > 1 %>
<div class="placeholder-div"></div>
<% end %>
<div class="single-article-small-pic" id="article-index-hidden-div" style="display:none"></div>