Class: Weaver::CreditCardForm
- Defined in:
- lib/weaver/element_types/credit_card_form.rb
Overview
Creates the credit card form
Instance Method Summary collapse
- #apply_script(scripts) ⇒ Object
- #generate ⇒ Object
-
#initialize(page, anchors, options = {}, &block) ⇒ CreditCardForm
constructor
A new instance of CreditCardForm.
Methods inherited from Elements
#_button, #accordion, #background, #badge, #big_button, #big_embossed_button, #block_button, #breadcrumb, #center, #circle_button, #col, #crossfade_image, #embossed_button, #gallery, #half, #hyperlink, #ibox, #icon, #image, #jumbotron, #math, #method_missing, #modal, #normal_button, #on_page_load, #outline_button, #p, #panel, #quarter, #request_css, #request_js, #root, #rounded_button, #row, #set_favicon_path, #set_favicon_type, #small_button, #syntax, #table, #table_from_hashes, #table_from_source, #tabs, #text, #third, #tiny_button, #twothirds, #wform, #widget, #write_script_once
Constructor Details
#initialize(page, anchors, options = {}, &block) ⇒ CreditCardForm
Returns a new instance of CreditCardForm.
6 7 8 9 10 |
# File 'lib/weaver/element_types/credit_card_form.rb', line 6 def initialize(page, anchors, = {}, &block) super(page, anchors) @options = instance_eval(&block) if block end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Weaver::Elements
Instance Method Details
#apply_script(scripts) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/weaver/element_types/credit_card_form.rb', line 12 def apply_script(scripts) scripts << <<~SCRIPT object["#{card_input_name}_type"] = $('##{card_input_name}_type').val(); object["#{card_input_name}_number"] = $('##{card_input_name}_number').val(); object["#{card_input_name}_exp_month"] = $('##{card_input_name}_exp_month').val(); object["#{card_input_name}_exp_year"] = $('##{card_input_name}_exp_year').val(); object["#{card_input_name}_name"] = $('##{card_input_name}_name').val(); object["#{card_input_name}_cvc"] = $('##{card_input_name}_cvc').val(); SCRIPT end |
#generate ⇒ Object
23 24 25 26 27 |
# File 'lib/weaver/element_types/credit_card_form.rb', line 23 def generate setup! generate_html! super end |