Fix linting issues for app/views/stories (#1904) [ci skip]

This commit is contained in:
Arnelle Balane 2019-02-27 00:58:14 +08:00 committed by Mac Siri
parent c861fad573
commit ba7644dd29
3 changed files with 52 additions and 46 deletions

View file

@ -1,32 +1,38 @@
<% 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:
[:title, :path, :id, :user_id, :comments_count, :positive_reactions_count, :organization_id,
:reading_time, :video_thumbnail_url, :video],
methods:
[:readable_publish_date, :cached_tag_list_array, :flare_tag, :class_name, :cloudinary_video_url, :video_duration_in_minutes],
include: {user: {only: [:username, :name], methods: [:profile_image_90]},
organization: {only: [:slug, :name], methods: [:profile_image_90]}}) %>">
<% @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],
methods: %i[readable_publish_date cached_tag_list_array flare_tag class_name
cloudinary_video_url video_duration_in_minutes],
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:
[:title, :path, :id, :user_id, :comments_count, :positive_reactions_count, :organization_id,
:reading_time, :video_thumbnail_url, :video, :video_duration_in_minutes],
methods:
[:readable_publish_date, :cached_tag_list_array, :flare_tag, :class_name, :cloudinary_video_url, :video_duration_in_minutes],
include: { user: {only: [:username, :name], methods: [:profile_image_90]},
organization: {only: [:slug, :name], methods: [:profile_image_90]}}) %>">
<%= @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],
methods: %i[readable_publish_date cached_tag_list_array flare_tag class_name
cloudinary_video_url video_duration_in_minutes],
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="small-pic">
<div class="color single-article-loading"></div>
</div>
<div class="content">
@ -45,7 +51,7 @@
<% @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' %>
<%= render "stories/sign_in_invitation" %>
<% end %>
<%= render "articles/single_story", story: story %>
<% end %>

View file

@ -1,8 +1,8 @@
<div class="narrow-nav-menu" id="narrow-nav-menu" aria-label="feed-nav-menu">
<a href="<%= list_path %>/" class="<%= 'selected' if ["week", "month", "year", "infinity", "latest"].exclude?(params[:timeframe]) %>">&lt;MY DEV FEED&gt;</a>
<a href="<%= list_path %>/top/week" class="<%= 'selected' if timeframe_check('week') %>">&lt;PAST WEEK&gt;</a>
<a href="<%= list_path %>/top/month" class="<%= 'selected' if timeframe_check('month') %>">&lt;PAST MONTH&gt;</a>
<a href="<%= list_path %>/top/year" class="<%= 'selected' if timeframe_check('year') %>">&lt;PAST YEAR&gt;</a>
<a href="<%= list_path %>/top/infinity" class="<%= 'selected' if timeframe_check('infinity') %>">&lt;INFINITY&gt;</a>
<a href="<%= list_path %>/latest" class="<%= 'selected' if timeframe_check('latest') %>">&lt;LATEST&gt;</a>
<a href="<%= list_path %>/" class="<%= "selected" if ["week", "month", "year", "infinity", "latest"].exclude?(params[:timeframe]) %>">&lt;MY DEV FEED&gt;</a>
<a href="<%= list_path %>/top/week" class="<%= "selected" if timeframe_check("week") %>">&lt;PAST WEEK&gt;</a>
<a href="<%= list_path %>/top/month" class="<%= "selected" if timeframe_check("month") %>">&lt;PAST MONTH&gt;</a>
<a href="<%= list_path %>/top/year" class="<%= "selected" if timeframe_check("year") %>">&lt;PAST YEAR&gt;</a>
<a href="<%= list_path %>/top/infinity" class="<%= "selected" if timeframe_check("infinity") %>">&lt;INFINITY&gt;</a>
<a href="<%= list_path %>/latest" class="<%= "selected" if timeframe_check("latest") %>">&lt;LATEST&gt;</a>
</div>

View file

@ -1,19 +1,19 @@
<div class="single-article single-article-small-pic feed-cta" id="in-feed-cta">
<div class="cta-container" id="cta-content">
<h2>
<% if @tag.blank? %>
Need more relevant posts?<br />Sign in to customize your feed:
<% else %>
<a href="/">dev.to</a> is a community of <br/><%= number_with_delimiter User.count %> amazing humans who code.
<% end %>
</h2>
<div class="button-container">
<a href="/users/auth/twitter?callback_url=<%= ApplicationConfig["APP_PROTOCOL"] %><%= ApplicationConfig["APP_DOMAIN"] %>/users/auth/twitter/callback" class="cta cta-button" aria-label="Sign in with Twitter." data-no-instant>
TWITTER
</a>
<a href="/users/auth/github?state=in-feed-cta" class="cta cta-button" aria-label="Sign in with GitHub." data-no-instant>
GITHUB
</a>
</div>
<div class="cta-container" id="cta-content">
<h2>
<% if @tag.blank? %>
Need more relevant posts?<br />Sign in to customize your feed:
<% else %>
<a href="/">dev.to</a> is a community of <br /><%= number_with_delimiter User.count %> amazing humans who code.
<% end %>
</h2>
<div class="button-container">
<a href="/users/auth/twitter?callback_url=<%= ApplicationConfig["APP_PROTOCOL"] %><%= ApplicationConfig["APP_DOMAIN"] %>/users/auth/twitter/callback" class="cta cta-button" aria-label="Sign in with Twitter." data-no-instant>
TWITTER
</a>
<a href="/users/auth/github?state=in-feed-cta" class="cta cta-button" aria-label="Sign in with GitHub." data-no-instant>
GITHUB
</a>
</div>
</div>
</div>