class OmniAuth::Strategies::Standalone::Form
Public Class Methods
new(fields, checkboxes, callback_path)
click to toggle source
# File lib/omniauth/strategies/standalone/form.rb, line 7 def initialize(fields, checkboxes, callback_path) @fields = fields @checkboxes = checkboxes ||= [] @callback_path = callback_path end
Public Instance Methods
render()
click to toggle source
# File lib/omniauth/strategies/standalone/form.rb, line 13 def render add_fields_to_form add_submit_button_to_form add_opposite_auth_link to_html end
Private Instance Methods
add_fields_to_form()
click to toggle source
# File lib/omniauth/strategies/standalone/form.rb, line 43 def add_fields_to_form fields.each do |field| label = field.to_s.capitalize.gsub('_', ' ') name = field.to_s form.text_field label, name end checkboxes.each do |checkox| label = checkox.to_s.capitalize.gsub('_', ' ') name = checkox.to_s form.label_field(label, name) form.input_field('checkbox', name) end end
add_opposite_auth_link()
click to toggle source
# File lib/omniauth/strategies/standalone/form.rb, line 26 def add_opposite_auth_link form.instance_variable_set('@html', html << opposite_link_tag) end
callback_path()
click to toggle source
# File lib/omniauth/strategies/standalone/form.rb, line 58 def callback_path @callback_path end
checkboxes()
click to toggle source
# File lib/omniauth/strategies/standalone/form.rb, line 66 def checkboxes @checkboxes end
fields()
click to toggle source
# File lib/omniauth/strategies/standalone/form.rb, line 62 def fields @fields end
form()
click to toggle source
# File lib/omniauth/strategies/standalone/form.rb, line 70 def form @form ||= OmniAuth::Form.new(:title => title, :url => callback_path) end
html()
click to toggle source
# File lib/omniauth/strategies/standalone/form.rb, line 30 def html form.instance_variable_get('@html') end
opposite_link_tag()
click to toggle source
# File lib/omniauth/strategies/standalone/form.rb, line 34 def opposite_link_tag "\n<div style='text-align:center; margin:20px auto 0;'>" \ "or <a href='?#{opposite_type}'>#{opposite_title}</a></div>" end
to_html()
click to toggle source
# File lib/omniauth/strategies/standalone/form.rb, line 22 def to_html form.to_response end