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

@@ -0,0 +1,22 @@
class Devise::OmniauthFormComponent < ApplicationComponent
attr_reader :action
def initialize(action)
@action = action
end
def render?
oauth_logins.any?
end
private
def oauth_logins
[
(:twitter if feature?(:twitter_login)),
(:facebook if feature?(:facebook_login)),
(:google_oauth2 if feature?(:google_login)),
(:wordpress_oauth2 if feature?(:wordpress_login))
].compact
end
end