Module: Adauth::Rails::Helpers

Defined in:
lib/adauth/rails/helpers.rb

Overview

Helper methods for rails

Instance Method Summary collapse

Instance Method Details

#adauth_formObject

Creates a form_tag for the adauth form

Sets the html id to “adauth_login” and the form destination to “/adauth”



9
10
11
12
13
# File 'lib/adauth/rails/helpers.rb', line 9

def adauth_form
 form_tag '/adauth', :id => "adauth_login" do
     yield.html_safe
 end
end

#default_adauth_formObject

Create the default form by calling ‘adauth_form` and passing a username and password input



16
17
18
19
20
21
22
23
24
# File 'lib/adauth/rails/helpers.rb', line 16

def default_adauth_form
    adauth_form do
        "<p>#{label_tag :username}: 
        #{text_field_tag :username}</p>
        <p>#{label_tag :password}: 
        #{password_field_tag :password}</p>
        <p>#{submit_tag "Login!"}</p>"
    end
end