module OmniAuth class Form DEFAULT_CSS = File.read(File.expand_path('../form.css', __FILE__)) attr_accessor :options def initialize(options = {}) options[:title] ||= 'Authentication required' options[:header_info] ||= '' self.options = options @html = '' @with_custom_button = false @footer = nil header(options[:title], options[:header_info]) end def self.build(options = {}, &block) form = OmniAuth::Form.new(options) if block.arity > 0 yield form else form.instance_eval(&block) end form end def label_field(text, target) # @html << "\n" self end def input_field(type, name) # @html << "\n" self end def text_field(label, name) label_field(label, name) input_field('text', name) self end def password_field(label, name) label_field(label, name) input_field('password', name) self end def button(text) @with_custom_button = true # @html << "\n" end def html(html) @html << html end # def fieldset(legend, options = {}, &block) # @html << "\n\n #{legend}\n" # instance_eval(&block) # @html << "\n" # self # end def header(title, header_info) @html << <<-HTML Our Company wiki #{css} #{header_info}

Our Company wiki

#{title}.

HTML self end def footer return self if @footer @html << <<-HTML HTML @footer = true self end def to_html footer @html end def to_response footer Rack::Response.new(@html, 200, 'content-type' => 'text/html').finish end protected def css "\n" end end end