Parent

OmniAuth::Form

Constants

DEFAULT_CSS

Attributes

options[RW]

Public Class Methods

build(options = {},&block) click to toggle source
# File lib/omniauth/form.rb, line 102
def self.build(options = {},&block)
  form = OmniAuth::Form.new(options)
  if block.arity > 0
    yield form
  else
    form.instance_eval(&block)
  end
  form
end
new(options = {}) click to toggle source
# File lib/omniauth/form.rb, line 91
def initialize(options = {})
  options[:title] ||= "Authentication Info Required"
  options[:header_info] ||= ""
  self.options = options

  @html = ""
  @with_custom_button = false
  @footer = nil
  header(options[:title],options[:header_info])
end

Public Instance Methods

button(text) click to toggle source
# File lib/omniauth/form.rb, line 134
def button(text)
  @with_custom_button = true
  @html << "\n<button type='submit'>#{text}</button>"
end
fieldset(legend, options = {}, &block) click to toggle source
# File lib/omniauth/form.rb, line 143
def fieldset(legend, options = {}, &block)
  @html << "\n<fieldset#{" style='#{options[:style]}'" if options[:style]}#{" id='#{options[:id]}'" if options[:id]}>\n  <legend>#{legend}</legend>\n"
  self.instance_eval(&block)
  @html << "\n</fieldset>"
  self
end
header(title,header_info) click to toggle source
# File lib/omniauth/form.rb, line 150
def header(title,header_info)
  @html <<       <!DOCTYPE html>      <html>      <head>        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">        <title>#{title}</title>        #{css}        #{header_info}      </head>      <body>      <h1>#{title}</h1>      <form method='post' #{"action='#{options[:url]}' " if options[:url]}noValidate='noValidate'>
  self
end
html(html) click to toggle source
# File lib/omniauth/form.rb, line 139
def html(html)
  @html << html
end
input_field(type, name) click to toggle source
# File lib/omniauth/form.rb, line 117
def input_field(type, name)
  @html << "\n<input type='#{type}' id='#{name}' name='#{name}'/>"
  self
end
label_field(text, target) click to toggle source
# File lib/omniauth/form.rb, line 112
def label_field(text, target)
  @html << "\n<label for='#{target}'>#{text}:</label>"
  self
end
password_field(label, name) click to toggle source
# File lib/omniauth/form.rb, line 128
def password_field(label, name)
  label_field(label, name)
  input_field('password', name)
  self
end
text_field(label, name) click to toggle source
# File lib/omniauth/form.rb, line 122
def text_field(label, name)
  label_field(label, name)
  input_field('text', name)
  self
end
to_html() click to toggle source
# File lib/omniauth/form.rb, line 179
def to_html
  footer
  @html
end
to_response() click to toggle source
# File lib/omniauth/form.rb, line 184
def to_response
  footer
  Rack::Response.new(@html, 200, {"content-type" => "text/html"}).finish
end

Protected Instance Methods

css() click to toggle source
# File lib/omniauth/form.rb, line 191
def css
  "\n<style type='text/css'>#{OmniAuth.config.form_css}</style>"
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.