Remove duplication in oauth actions
We were writing the same code twice, with the only difference being the text "Sign up" in the sign_up action, and "Sign in" in the sign_in action. Note we're renaming the `omniauth.info_*` I18n keys so we don't need to add new exceptions to the `ignore_unused` list, and so it's consistent with all the other keys under the `omniauth` key.
This commit is contained in:
@@ -1,103 +1,49 @@
|
||||
<% if feature?(:twitter_login) || feature?(:facebook_login) || feature?(:google_login) %>
|
||||
|
||||
<% if current_page?(new_user_session_path) %>
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<div class="margin-bottom">
|
||||
<strong><%= t("omniauth.info_sign_in") %></strong>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% if feature? :twitter_login %>
|
||||
<div class="small-12 medium-6 large-4 column end">
|
||||
<%= link_to t("omniauth.twitter.name"), user_twitter_omniauth_authorize_path,
|
||||
title: t("omniauth.twitter.sign_in"),
|
||||
class: "button-twitter button expanded",
|
||||
method: :post %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if feature? :facebook_login %>
|
||||
<div class="small-12 medium-6 large-4 column end">
|
||||
<%= link_to t("omniauth.facebook.name"), user_facebook_omniauth_authorize_path,
|
||||
title: t("omniauth.facebook.sign_in"),
|
||||
class: "button-facebook button expanded",
|
||||
method: :post %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if feature? :google_login %>
|
||||
<div class="small-12 medium-6 large-4 column end">
|
||||
<%= link_to t("omniauth.google_oauth2.name"), user_google_oauth2_omniauth_authorize_path,
|
||||
title: t("omniauth.google_oauth2.sign_in"),
|
||||
class: "button-google button expanded",
|
||||
method: :post %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if feature? :wordpress_login %>
|
||||
<div class="small-12 medium-6 large-4 column end">
|
||||
<%= link_to t("omniauth.wordpress_oauth2.name"), user_wordpress_oauth2_omniauth_authorize_path,
|
||||
title: t("omniauth.wordpress_oauth2.sign_in"),
|
||||
class: "button-wordpress button expanded",
|
||||
method: :post %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="small-12 column auth-divider">
|
||||
<span><%= t("omniauth.or_fill") %></span>
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<div class="margin-bottom">
|
||||
<strong><%= t("omniauth.info.#{action}") %></strong>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% elsif current_page?(new_user_registration_path) %>
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<div class="margin-bottom">
|
||||
<strong><%= t("omniauth.info_sign_up") %></strong>
|
||||
</div>
|
||||
<% if feature? :twitter_login %>
|
||||
<div class="small-12 medium-6 large-4 column end">
|
||||
<%= link_to t("omniauth.twitter.name"), user_twitter_omniauth_authorize_path,
|
||||
title: t("omniauth.twitter.#{action}"),
|
||||
class: "button-twitter button expanded",
|
||||
method: :post %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if feature? :twitter_login %>
|
||||
<div class="small-12 medium-6 large-4 column end">
|
||||
<%= link_to t("omniauth.twitter.name"), user_twitter_omniauth_authorize_path,
|
||||
title: t("omniauth.twitter.sign_up"),
|
||||
class: "button-twitter button expanded",
|
||||
method: :post %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if feature? :facebook_login %>
|
||||
<div class="small-12 medium-6 large-4 column end">
|
||||
<%= link_to t("omniauth.facebook.name"), user_facebook_omniauth_authorize_path,
|
||||
title: t("omniauth.facebook.sign_up"),
|
||||
class: "button-facebook button expanded",
|
||||
method: :post %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if feature? :google_login %>
|
||||
<div class="small-12 medium-6 large-4 column end">
|
||||
<%= link_to t("omniauth.google_oauth2.name"), user_google_oauth2_omniauth_authorize_path,
|
||||
title: t("omniauth.google_oauth2.sign_up"),
|
||||
class: "button-google button expanded",
|
||||
method: :post %>
|
||||
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if feature? :wordpress_login %>
|
||||
<div class="small-12 medium-6 large-4 column end">
|
||||
<%= link_to t("omniauth.wordpress_oauth2.name"), user_wordpress_oauth2_omniauth_authorize_path,
|
||||
title: t("omniauth.wordpress_oauth2.sign_up"),
|
||||
class: "button-wordpress button expanded",
|
||||
method: :post %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="small-12 column auth-divider">
|
||||
<span><%= t("omniauth.or_fill") %></span>
|
||||
<% if feature? :facebook_login %>
|
||||
<div class="small-12 medium-6 large-4 column end">
|
||||
<%= link_to t("omniauth.facebook.name"), user_facebook_omniauth_authorize_path,
|
||||
title: t("omniauth.facebook.#{action}"),
|
||||
class: "button-facebook button expanded",
|
||||
method: :post %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if feature? :google_login %>
|
||||
<div class="small-12 medium-6 large-4 column end">
|
||||
<%= link_to t("omniauth.google_oauth2.name"), user_google_oauth2_omniauth_authorize_path,
|
||||
title: t("omniauth.google_oauth2.#{action}"),
|
||||
class: "button-google button expanded",
|
||||
method: :post %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if feature? :wordpress_login %>
|
||||
<div class="small-12 medium-6 large-4 column end">
|
||||
<%= link_to t("omniauth.wordpress_oauth2.name"), user_wordpress_oauth2_omniauth_authorize_path,
|
||||
title: t("omniauth.wordpress_oauth2.#{action}"),
|
||||
class: "button-wordpress button expanded",
|
||||
method: :post %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="small-12 column auth-divider">
|
||||
<span><%= t("omniauth.or_fill") %></span>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<% provide :title do %><%= t("devise_views.sessions.new.title") %><% end %>
|
||||
<h2><%= t("devise_views.sessions.new.title") %></h2>
|
||||
|
||||
<%= render "devise/omniauth_form" %>
|
||||
<%= render "devise/omniauth_form", action: "sign_in" %>
|
||||
|
||||
<p>
|
||||
<%= sanitize(t("devise_views.shared.links.signup",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<% provide :title do %><%= t("devise_views.users.registrations.new.title") %><% end %>
|
||||
<h2><%= t("devise_views.users.registrations.new.title") %></h2>
|
||||
|
||||
<%= render "devise/omniauth_form" %>
|
||||
<%= render "devise/omniauth_form", action: "sign_up" %>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
|
||||
<%= render "shared/errors", resource: resource %>
|
||||
|
||||
@@ -299,8 +299,9 @@ en:
|
||||
sign_in: Sign in with Twitter
|
||||
sign_up: Sign up with Twitter
|
||||
name: Twitter
|
||||
info_sign_in: "Sign in with:"
|
||||
info_sign_up: "Sign up with:"
|
||||
info:
|
||||
sign_in: "Sign in with:"
|
||||
sign_up: "Sign up with:"
|
||||
or_fill: "Or fill the following form:"
|
||||
proposals:
|
||||
create:
|
||||
|
||||
@@ -299,8 +299,9 @@ es:
|
||||
sign_in: Entra con Twitter
|
||||
sign_up: Regístrate con Twitter
|
||||
name: Twitter
|
||||
info_sign_in: "Entra con:"
|
||||
info_sign_up: "Regístrate con:"
|
||||
info:
|
||||
sign_in: "Entra con:"
|
||||
sign_up: "Regístrate con:"
|
||||
or_fill: "O rellena el siguiente formulario:"
|
||||
proposals:
|
||||
create:
|
||||
|
||||
Reference in New Issue
Block a user