Move omniauth form partial to a component

This way we simplify the view a little bit and replace some slow system
tests with faster component tests.
This commit is contained in:
Javi Martín
2024-10-25 18:03:36 +02:00
parent 58639b64fa
commit 3931b43b87
8 changed files with 100 additions and 130 deletions

View File

@@ -1,22 +0,0 @@
<% if oauth_logins.any? %>
<div class="row">
<div class="small-12 column">
<div class="margin-bottom">
<strong><%= t("omniauth.info.#{action}") %></strong>
</div>
</div>
<% oauth_logins.each do |login| %>
<div class="small-12 medium-6 large-4 column end">
<%= link_to t("omniauth.#{login}.name"), send("user_#{login}_omniauth_authorize_path"),
title: t("omniauth.#{login}.#{action}"),
class: "button-#{login.to_s.delete_suffix("_oauth2")} button expanded",
method: :post %>
</div>
<% end %>
<div class="small-12 column auth-divider">
<span><%= t("omniauth.or_fill") %></span>
</div>
</div>
<% end %>

View File

@@ -1,7 +1,7 @@
<% provide :title, t("devise_views.sessions.new.title") %>
<h2><%= t("devise_views.sessions.new.title") %></h2>
<%= render "devise/omniauth_form", action: "sign_in" %>
<%= render Devise::OmniauthFormComponent.new("sign_in") %>
<p>
<%= sanitize(t("devise_views.shared.links.signup",

View File

@@ -1,7 +1,7 @@
<% provide :title, t("devise_views.users.registrations.new.title") %>
<h2><%= t("devise_views.users.registrations.new.title") %></h2>
<%= render "devise/omniauth_form", action: "sign_up" %>
<%= render Devise::OmniauthFormComponent.new("sign_up") %>
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
<%= render "shared/errors", resource: resource %>