Sha256: d50764623032a777ee02372e1c40e7ba1705b08b3aa9a52f94b90e6caf4af3d4

Contents?: true

Size: 979 Bytes

Versions: 9

Compression:

Stored size: 979 Bytes

Contents

module Adauth
    module Rails
        # Helper methods for rails
        module Helpers
        
            # Creates a form_tag for the adauth form
            #
            # Sets the html id to "adauth_login" and the form destination to "/adauth"
            def adauth_form
        	    form_tag '/adauth', :id => "adauth_login" do
        	        yield.html_safe
    	        end
            end
        
            # Create the default form by calling `adauth_form` and passing a username and password input
            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
        end
    end
end

ActionView::Base.send :include, Adauth::Rails::Helpers if defined? ActionView

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
adauth-2.0.5 lib/adauth/rails/helpers.rb
adauth-2.0.4 lib/adauth/rails/helpers.rb
adauth-2.0.3 lib/adauth/rails/helpers.rb
adauth-2.0.2 lib/adauth/rails/helpers.rb
adauth-2.0.1 lib/adauth/rails/helpers.rb
adauth-2.0.0 lib/adauth/rails/helpers.rb
adauth-2.0.0pre2 lib/adauth/rails/helpers.rb
adauth-2.0.0pre1 lib/adauth/rails/helpers.rb
adauth-2.0.0pre lib/adauth/rails/helpers.rb