Module: DeviseAuthy::Views::Helpers

Defined in:
lib/devise-authy/controllers/view_helpers.rb

Instance Method Summary collapse

Instance Method Details



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/devise-authy/controllers/view_helpers.rb', line 4

def authy_request_phone_call_link(opts = {})
  title = opts.delete(:title) do
    I18n.t('request_phone_call', scope: 'devise')
  end
  opts = {
    :id => "authy-request-phone-call-link",
    :method => :post,
    :remote => true
  }.merge(opts)

  link_to(
    title,
    url_for([resource_name.to_sym, :request_phone_call]),
    opts
  )
end


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/devise-authy/controllers/view_helpers.rb', line 21

def authy_request_sms_link(opts = {})
  title = opts.delete(:title) do
    I18n.t('request_sms', scope: 'devise')
  end
  opts = {
    :id => "authy-request-sms-link",
    :method => :post,
    :remote => true
  }.merge(opts)

  link_to(
    title,
    url_for([resource_name.to_sym, :request_sms]),
    opts
  )
end

#enable_authy_form(opts = {}, &block) ⇒ Object



46
47
48
49
50
51
# File 'lib/devise-authy/controllers/view_helpers.rb', line 46

def enable_authy_form(opts = {}, &block)
  opts = default_opts.merge(opts)
  form_tag([resource_name.to_sym, :enable_authy], opts) do
    capture(&block)
  end
end

#verify_authy_form(opts = {}, &block) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/devise-authy/controllers/view_helpers.rb', line 38

def verify_authy_form(opts = {}, &block)
  opts = default_opts.merge(:id => 'devise_authy').merge(opts)
  form_tag([resource_name.to_sym, :verify_authy], opts) do
    buffer = hidden_field_tag(:"#{resource_name}_id", @resource.id)
    buffer << capture(&block)
  end
end

#verify_authy_installation_form(opts = {}, &block) ⇒ Object



53
54
55
56
57
58
# File 'lib/devise-authy/controllers/view_helpers.rb', line 53

def verify_authy_installation_form(opts = {}, &block)
  opts = default_opts.merge(opts)
  form_tag([resource_name.to_sym, :verify_authy_installation], opts) do
    capture(&block)
  end
end