Class: Searls::Auth::HelperMethods
- Inherits:
-
Object
- Object
- Searls::Auth::HelperMethods
- Defined in:
- app/helpers/searls/auth/application_helper.rb
Instance Method Summary collapse
- #attr_for(model, field_name) ⇒ Object
- #email_field_stimulus_data ⇒ Object
- #enable_turbo? ⇒ Boolean
-
#initialize(view_context) ⇒ HelperMethods
constructor
A new instance of HelperMethods.
- #login_path(**kwargs) ⇒ Object
- #login_stimulus_controller ⇒ Object
- #login_url(**kwargs) ⇒ Object
- #otp_field_stimulus_data ⇒ Object
- #otp_stimulus_controller ⇒ Object
- #register_path(**kwargs) ⇒ Object
- #register_url(**kwargs) ⇒ Object
- #routes ⇒ Object
- #rpad(s, spacer = " ", times = 1) ⇒ Object
Constructor Details
#initialize(view_context) ⇒ HelperMethods
4 5 6 |
# File 'app/helpers/searls/auth/application_helper.rb', line 4 def initialize(view_context) @view_context = view_context end |
Instance Method Details
#attr_for(model, field_name) ⇒ Object
53 54 55 56 57 |
# File 'app/helpers/searls/auth/application_helper.rb', line 53 def attr_for(model, field_name) if model.respond_to?(field_name) model.send(field_name) end end |
#email_field_stimulus_data ⇒ Object
32 33 34 35 36 |
# File 'app/helpers/searls/auth/application_helper.rb', line 32 def email_field_stimulus_data { action: "change->searls-auth-login#updateEmail" } end |
#enable_turbo? ⇒ Boolean
49 50 51 |
# File 'app/helpers/searls/auth/application_helper.rb', line 49 def enable_turbo? params[:redirect_subdomain].blank? || params[:redirect_subdomain] == request.subdomain end |
#login_path(**kwargs) ⇒ Object
12 13 14 |
# File 'app/helpers/searls/auth/application_helper.rb', line 12 def login_path(**kwargs) routes.login_path(forwardable_params.merge(kwargs)) end |
#login_stimulus_controller ⇒ Object
28 29 30 |
# File 'app/helpers/searls/auth/application_helper.rb', line 28 def login_stimulus_controller "searls-auth-login" end |
#login_url(**kwargs) ⇒ Object
16 17 18 |
# File 'app/helpers/searls/auth/application_helper.rb', line 16 def login_url(**kwargs) routes.login_url(forwardable_params.merge(kwargs)) end |
#otp_field_stimulus_data ⇒ Object
42 43 44 45 46 47 |
# File 'app/helpers/searls/auth/application_helper.rb', line 42 def otp_field_stimulus_data { action: "paste->searls-auth-otp#pasted input->otp#caret click->searls-auth-otp#caret keydown->searls-auth-otp#caret keyup->searls-auth-otp#caret", searls_auth_otp_target: "input" } end |
#otp_stimulus_controller ⇒ Object
38 39 40 |
# File 'app/helpers/searls/auth/application_helper.rb', line 38 def otp_stimulus_controller "searls-auth-otp" end |
#register_path(**kwargs) ⇒ Object
20 21 22 |
# File 'app/helpers/searls/auth/application_helper.rb', line 20 def register_path(**kwargs) routes.register_path(forwardable_params.merge(kwargs)) end |
#register_url(**kwargs) ⇒ Object
24 25 26 |
# File 'app/helpers/searls/auth/application_helper.rb', line 24 def register_url(**kwargs) routes.register_url(forwardable_params.merge(kwargs)) end |
#routes ⇒ Object
8 9 10 |
# File 'app/helpers/searls/auth/application_helper.rb', line 8 def routes Searls::Auth::Engine.routes.url_helpers end |
#rpad(s, spacer = " ", times = 1) ⇒ Object
59 60 61 62 |
# File 'app/helpers/searls/auth/application_helper.rb', line 59 def rpad(s, spacer = " ", times = 1) return "" if s.blank? "#{s}#{spacer * times}" end |