Fix linting (#4933) [deploy]

This commit is contained in:
Ben Halpern 2019-11-26 08:35:34 -05:00 committed by GitHub
parent 481871f127
commit 4dabe265c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 48 additions and 48 deletions

View file

@ -172,7 +172,7 @@ module ApplicationHelper
if ApplicationConfig["LOGO_SVG"].present?
ApplicationConfig["LOGO_SVG"].html_safe
else
inline_svg("devplain.svg", class: "logo", size: "20% * 20%", aria: true, title: "App logo")
inline_svg_tag("devplain.svg", class: "logo", size: "20% * 20%", aria: true, title: "App logo")
end
end

View file

@ -21,13 +21,13 @@ module ArticlesHelper
end
end
def image_tag_or_inline_svg(service_name, width: nil, height: nil)
def image_tag_or_inline_svg_tag(service_name, width: nil, height: nil)
name = "#{service_name}-logo.svg"
if internal_navigation?
image_tag(name, class: "icon-img", alt: "#{service_name} logo", width: width, height: height)
else
inline_svg(name, class: "icon-img", aria: true, title: "#{service_name} logo", width: width, height: height)
inline_svg_tag(name, class: "icon-img", aria: true, title: "#{service_name} logo", width: width, height: height)
end
end

View file

@ -125,10 +125,10 @@
</a>
</span>
<% if @user.twitter_username.present? %>
<a href="http://twitter.com/<%= @user.twitter_username %>"><%= image_tag_or_inline_svg "twitter", width: 18, height: 18 %></a>
<a href="http://twitter.com/<%= @user.twitter_username %>"><%= image_tag_or_inline_svg_tag "twitter", width: 18, height: 18 %></a>
<% end %>
<% if @user.github_username.present? %>
<a href="http://github.com/<%= @user.github_username %>"><%= image_tag_or_inline_svg "github", width: 18, height: 18 %></a>
<a href="http://github.com/<%= @user.github_username %>"><%= image_tag_or_inline_svg_tag "github", width: 18, height: 18 %></a>
<% end %>
<% if @article.published_timestamp.present? %>
<time itemprop="datePublished" datetime="<%= @article.published_timestamp %>"><%= @article.readable_publish_date %></time>

View file

@ -75,10 +75,10 @@
<% end %>
<div class="links">
<a href="/users/auth/twitter?callback_url=<%= ApplicationConfig["APP_PROTOCOL"] %><%= ApplicationConfig["APP_DOMAIN"] %>/users/auth/twitter/callback" class="sign-up-link" data-no-instant>
<%= inline_svg("twitter-logo.svg", class: "icon-img", aria: true, title: "twitter logo") %> Sign In with Twitter
<%= inline_svg_tag("twitter-logo.svg", class: "icon-img", aria: true, title: "twitter logo") %> Sign In with Twitter
</a>
<a href="/users/auth/github?state=join-club-page_basic" class="sign-up-link" data-no-instant>
<%= inline_svg("github-logo.svg", class: "icon-img", aria: true, title: "github logo") %> Sign In with GitHub
<%= inline_svg_tag("github-logo.svg", class: "icon-img", aria: true, title: "github logo") %> Sign In with GitHub
</a>
<p><em>We require social login to prevent abuse.</em></p>
</div>

View file

@ -18,11 +18,11 @@
</div>
<a href="/new" id="write-link" class="cta nav-link write">WRITE A POST</a>
<a href="/connect" id="connect-link" class="nav-link connect-icon" aria-label="Connect">
<%= inline_svg("connect.svg", size: "100% * 100%", aria: true, title: "Connect") %>
<%= inline_svg_tag("connect.svg", size: "100% * 100%", aria: true, title: "Connect") %>
<div class="connect-number" id="connect-number"></div>
</a>
<a href="/notifications" id="notifications-link" class="nav-link notifications-icon" aria-label="Notifications">
<%= inline_svg("bell.svg", size: "100% * 100%", aria: true, title: "Notifications") %>
<%= inline_svg_tag("bell.svg", size: "100% * 100%", aria: true, title: "Notifications") %>
<div class="notifications-number" id="notifications-number"></div>
</a>
<div class="navbar-menu-wrapper" id="navbar-menu-wrapper">
@ -30,7 +30,7 @@
<% if user_signed_in? %>
<div class="nav-profile-image-wrapper"><img alt="" class="nav-profile-image" id="nav-profile-image" /></div>
<% else %>
<%= inline_svg("menu.svg", class: "bars", size: "20% * 20%", aria: true, title: "Navigation menu") %>
<%= inline_svg_tag("menu.svg", class: "bars", size: "20% * 20%", aria: true, title: "Navigation menu") %>
<% end %>
</button>
<div class="menubg" id="menubg"></div>

View file

@ -128,7 +128,7 @@
<%= truncate @article.user.name, length: 25 %>・<%= @article.readable_publish_date %>
</div>
<div class="preview-dev-logo">
<%= inline_svg("devplain.svg", class: "logo", size: "9vw * 9vw", aria: false, title: "DEV logo") %>
<%= inline_svg_tag("devplain.svg", class: "logo", size: "9vw * 9vw", aria: false, title: "DEV logo") %>
</div>
</div>
</div>

View file

@ -143,7 +143,7 @@
<%= truncate @comment.user.name, length: 25 %>・<%= @comment.readable_publish_date %>
</div>
<div class="preview-dev-logo">
<%= inline_svg("devplain.svg", class: "logo", size: "9vw * 9vw", aria: false, title: "DEV logo") %>
<%= inline_svg_tag("devplain.svg", class: "logo", size: "9vw * 9vw", aria: false, title: "DEV logo") %>
</div>
</div>
</div>

View file

@ -35,7 +35,7 @@
}
h1 {
color: <%= HexComparer.new([@cat_color]).brightness(0.70) %>;
color: <%= HexComparer.new([@cat_color]).brightness(0.70) %>;
width: 92%;
margin: 0;
padding: 1vw;
@ -46,7 +46,7 @@
font-size: 3.1vw;
padding: 0 4vw;
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", "Roboto", sans-serif;
color: <%= HexComparer.new([@cat_color]).brightness(0.77) %>;
color: <%= HexComparer.new([@cat_color]).brightness(0.77) %>;
}
.preview-category {
@ -81,7 +81,7 @@
<%= @category %>
</div>
<div class="preview-dev-logo">
<%= inline_svg("devlistings-horizontal.svg", class: "logo", size: "30vw*10vw", aria: false, title: "DEV logo") %>
<%= inline_svg_tag("devlistings-horizontal.svg", class: "logo", size: "30vw*10vw", aria: false, title: "DEV logo") %>
</div>
</div>
</div>

View file

@ -102,7 +102,7 @@
</h2>
<% end %>
<div class="preview-dev-logo">
<%= inline_svg("devplain.svg", class: "logo", size: "9vw * 9vw", aria: false, title: "DEV logo") %>
<%= inline_svg_tag("devplain.svg", class: "logo", size: "9vw * 9vw", aria: false, title: "DEV logo") %>
</div>
</div>
</div>

View file

@ -90,7 +90,7 @@
<%= @user.name %>
</h1>
<div class="preview-dev-logo">
<%= inline_svg("devplain.svg", class: "logo", size: "9vw * 9vw", aria: false, title: "DEV logo") %>
<%= inline_svg_tag("devplain.svg", class: "logo", size: "9vw * 9vw", aria: false, title: "DEV logo") %>
</div>
</div>
</div>

View file

@ -34,68 +34,68 @@
<p class="social">
<% if @user.twitter_username.present? %>
<a href="https://twitter.com/<%= @user.twitter_username %>" target="_blank" rel="noopener me">
<%= inline_svg("twitter-logo.svg", class: "icon-img", aria: true, title: "Twitter logo") %>
<%= inline_svg_tag("twitter-logo.svg", class: "icon-img", aria: true, title: "Twitter logo") %>
</a>
<% end %>
<% if @user.github_username.present? %>
<a href="https://github.com/<%= @user.github_username %>" target="_blank" rel="noopener me">
<%= inline_svg("github-logo.svg", class: "icon-img", aria: true, title: "GitHub logo") %>
<%= inline_svg_tag("github-logo.svg", class: "icon-img", aria: true, title: "GitHub logo") %>
</a>
<% end %>
<% if @user.class.name == "User" %>
<% if @user.mastodon_url.present? %>
<a href="<%= @user.mastodon_url %>" target="_blank" rel="noopener">
<%= inline_svg("mastodon-logo.svg", class: "icon-img", aria: true, title: "Mastodon logo") %>
<%= inline_svg_tag("mastodon-logo.svg", class: "icon-img", aria: true, title: "Mastodon logo") %>
</a>
<% end %>
<% if @user.facebook_url.present? %>
<a href="<%= @user.facebook_url %>" target="_blank" rel="noopener me">
<%= inline_svg("facebook-logo.svg", class: "icon-img", aria: true, title: "Facebook logo") %>
<%= inline_svg_tag("facebook-logo.svg", class: "icon-img", aria: true, title: "Facebook logo") %>
</a>
<% end %>
<% if @user.linkedin_url.present? %>
<a href="<%= @user.linkedin_url %>" target="_blank" rel="noopener me">
<%= inline_svg("linkedin_icon.svg", class: "icon-img", aria: true, title: "LinkedIn logo") %>
<%= inline_svg_tag("linkedin_icon.svg", class: "icon-img", aria: true, title: "LinkedIn logo") %>
</a>
<% end %>
<% if @user.behance_url.present? %>
<a href="<%= @user.behance_url %>" target="_blank" rel="noopener me">
<%= inline_svg("behance_icon.svg", class: "icon-img", aria: true, title: "Behance logo") %>
<%= inline_svg_tag("behance_icon.svg", class: "icon-img", aria: true, title: "Behance logo") %>
</a>
<% end %>
<% if @user.stackoverflow_url.present? %>
<a href="<%= @user.stackoverflow_url %>" target="_blank" rel="noopener me">
<%= inline_svg("stackoverflow-logo.svg", class: "icon-img", aria: true, title: "StackOverflow logo") %>
<%= inline_svg_tag("stackoverflow-logo.svg", class: "icon-img", aria: true, title: "StackOverflow logo") %>
</a>
<% end %>
<% if @user.dribbble_url.present? %>
<a href="<%= @user.dribbble_url %>" target="_blank" rel="noopener me">
<%= inline_svg("dribbble_icon.svg", class: "icon-img", aria: true, title: "Dribbble logo") %>
<%= inline_svg_tag("dribbble_icon.svg", class: "icon-img", aria: true, title: "Dribbble logo") %>
</a>
<% end %>
<% if @user.medium_url.present? %>
<a href="<%= @user.medium_url %>" target="_blank" rel="noopener nofollow me">
<%= inline_svg("medium_icon.svg", class: "icon-img", aria: true, title: "Medium logo") %>
<%= inline_svg_tag("medium_icon.svg", class: "icon-img", aria: true, title: "Medium logo") %>
</a>
<% end %>
<% if @user.gitlab_url.present? %>
<a href="<%= @user.gitlab_url %>" target="_blank" rel="noopener nofollow me">
<%= inline_svg("gitlab.svg", class: "icon-img", aria: true, title: "GitLab logo") %>
<%= inline_svg_tag("gitlab.svg", class: "icon-img", aria: true, title: "GitLab logo") %>
</a>
<% end %>
<% if @user.instagram_url.present? %>
<a href="<%= @user.instagram_url %>" target="_blank" rel="noopener nofollow me">
<%= inline_svg("instagram-logo.svg", class: "icon-img", aria: true, title: "Instagram logo") %>
<%= inline_svg_tag("instagram-logo.svg", class: "icon-img", aria: true, title: "Instagram logo") %>
</a>
<% end %>
<% if @user.twitch_url.present? %>
<a href="<%= @user.twitch_url %>" target="_blank" rel="noopener nofollow me">
<%= inline_svg("twitch-logo.svg", class: "icon-img", aria: true, title: "Twitch logo") %>
<%= inline_svg_tag("twitch-logo.svg", class: "icon-img", aria: true, title: "Twitch logo") %>
</a>
<% end %>
<% if @user.website_url.present? %>
<a href="<%= @user.website_url %>" target="_blank" rel="noopener nofollow me">
<%= inline_svg("external-link-logo.svg", class: "icon-img", aria: true, title: "external link icon") %>
<%= inline_svg_tag("external-link-logo.svg", class: "icon-img", aria: true, title: "external link icon") %>
</a>
<% end %>
<% end %>

View file

@ -57,71 +57,71 @@
<p class="social">
<% if @user.twitter_username? %>
<a href="https://twitter.com/<%= @user.twitter_username %>" target="_blank" rel="noopener me">
<%= inline_svg("twitter-logo.svg", class: "icon-img", aria: true, title: "Twitter logo") %>
<%= inline_svg_tag("twitter-logo.svg", class: "icon-img", aria: true, title: "Twitter logo") %>
</a>
<% end %>
<% if @user.github_username? %>
<a href="https://github.com/<%= @user.github_username %>" target="_blank" rel="noopener me">
<%= inline_svg("github-logo.svg", class: "icon-img", aria: true, title: "GitHub logo") %>
<%= inline_svg_tag("github-logo.svg", class: "icon-img", aria: true, title: "GitHub logo") %>
</a>
<% end %>
<% if @user.mastodon_url? %>
<a href="<%= @user.mastodon_url %>" target="_blank" rel="noopener me">
<%= inline_svg("mastodon-logo.svg", class: "icon-img", aria: true, title: "Mastodon logo") %>
<%= inline_svg_tag("mastodon-logo.svg", class: "icon-img", aria: true, title: "Mastodon logo") %>
</a>
<% end %>
<% if @user.facebook_url? %>
<a href="<%= @user.facebook_url %>" target="_blank" rel="noopener me">
<%= inline_svg("facebook-logo.svg", class: "icon-img", aria: true, title: "Facebook logo") %>
<%= inline_svg_tag("facebook-logo.svg", class: "icon-img", aria: true, title: "Facebook logo") %>
</a>
<% end %>
<% if @user.linkedin_url? %>
<a href="<%= @user.linkedin_url %>" target="_blank" rel="noopener me">
<%= inline_svg("linkedin_icon.svg", class: "icon-img", aria: true, title: "LinkedIn logo") %>
<%= inline_svg_tag("linkedin_icon.svg", class: "icon-img", aria: true, title: "LinkedIn logo") %>
</a>
<% end %>
<% if @user.behance_url? %>
<a href="<%= @user.behance_url %>" target="_blank" rel="noopener me">
<%= inline_svg("behance_icon.svg", class: "icon-img", aria: true, title: "Behance logo") %>
<%= inline_svg_tag("behance_icon.svg", class: "icon-img", aria: true, title: "Behance logo") %>
</a>
<% end %>
<% if @user.stackoverflow_url? %>
<a href="<%= @user.stackoverflow_url %>" target="_blank" rel="noopener me">
<%= inline_svg("stackoverflow-logo.svg", class: "icon-img", aria: true, title: "StackOverflow logo") %>
<%= inline_svg_tag("stackoverflow-logo.svg", class: "icon-img", aria: true, title: "StackOverflow logo") %>
</a>
<% end %>
<% if @user.dribbble_url? %>
<a href="<%= @user.dribbble_url %>" target="_blank" rel="noopener me">
<%= inline_svg("dribbble_icon.svg", class: "icon-img", aria: true, title: "Dribbble logo") %>
<%= inline_svg_tag("dribbble_icon.svg", class: "icon-img", aria: true, title: "Dribbble logo") %>
</a>
<% end %>
<% if @user.medium_url? %>
<a href="<%= @user.medium_url %>" target="_blank" rel="noopener nofollow me">
<%= inline_svg("medium_icon.svg", class: "icon-img", aria: true, title: "Medium logo") %>
<%= inline_svg_tag("medium_icon.svg", class: "icon-img", aria: true, title: "Medium logo") %>
</a>
<% end %>
<% if @user.gitlab_url? %>
<a href="<%= @user.gitlab_url %>" target="_blank" rel="noopener nofollow me">
<%= inline_svg("gitlab.svg", class: "icon-img", aria: true, title: "GitLab logo") %>
<%= inline_svg_tag("gitlab.svg", class: "icon-img", aria: true, title: "GitLab logo") %>
</a>
<% end %>
<% if @user.instagram_url? %>
<a href="<%= @user.instagram_url %>" target="_blank" rel="noopener nofollow me">
<%= inline_svg("instagram-logo.svg", class: "icon-img", aria: true, title: "Instagram logo") %>
<%= inline_svg_tag("instagram-logo.svg", class: "icon-img", aria: true, title: "Instagram logo") %>
</a>
<% end %>
<% if @user.twitch_username? %>
<%= link_to twitch_live_stream_path(username: @user.username) do %>
<%= inline_svg("twitch-logo.svg", class: "icon-img", id: "icon-twitch", aria: true, title: "Twitch logo") %>
<%= inline_svg_tag("twitch-logo.svg", class: "icon-img", id: "icon-twitch", aria: true, title: "Twitch logo") %>
<% end %>
<% elsif @user.twitch_url? %>
<a href="<%= @user.twitch_url %>" target="_blank" rel="noopener nofollow me">
<%= inline_svg("twitch-logo.svg", class: "icon-img", aria: true, title: "Twitch logo") %>
<%= inline_svg_tag("twitch-logo.svg", class: "icon-img", aria: true, title: "Twitch logo") %>
</a>
<% end %>
<% if @user.website_url? %>
<a href="<%= @user.website_url %>" target="_blank" rel="noopener nofollow me">
<%= inline_svg("external-link-logo.svg", class: "icon-img", aria: true, title: "external link icon") %>
<%= inline_svg_tag("external-link-logo.svg", class: "icon-img", aria: true, title: "external link icon") %>
</a>
<% end %>
</p>

View file

@ -23,18 +23,18 @@ describe ArticlesHelper do
end
end
describe "#image_tag_or_inline_svg" do
describe "#image_tag_or_inline_svg_tag" do
helper do
def internal_navigation?
true
end
end
subject { helper.image_tag_or_inline_svg("twitter") }
subject { helper.image_tag_or_inline_svg_tag("twitter") }
it { is_expected.to start_with("<img") }
context "with a width and height" do
subject { helper.image_tag_or_inline_svg("twitter", width: 18, height: 18) }
subject { helper.image_tag_or_inline_svg_tag("twitter", width: 18, height: 18) }
it { is_expected.to include('width="18" height="18"') }
end
@ -46,7 +46,7 @@ describe ArticlesHelper do
end
context "with width and height arguments, and with #internal_navigation? set to false" do
subject { helper.image_tag_or_inline_svg("twitter", width: 18, height: 18) }
subject { helper.image_tag_or_inline_svg_tag("twitter", width: 18, height: 18) }
before { allow(helper).to receive(:internal_navigation?).and_return(false) }