Skip to content

Commit

Permalink
Fixed jquery.payment formatting not applying to more than one set of …
Browse files Browse the repository at this point in the history
…gateway fields on the payments page

Conflicts:
	frontend/app/assets/javascripts/store/checkout.js.coffee
  • Loading branch information
radar committed Oct 21, 2013
1 parent 7f2aa50 commit 38ea6ca
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion frontend/app/assets/javascripts/store/checkout.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Spree.disableSaveOnClick = ->
($ this).find(':submit, :image').attr('disabled', true).removeClass('primary').addClass 'disabled'

Spree.ready ($) ->
Spree.Checkout = {}
Spree.Checkout = {}
10 changes: 5 additions & 5 deletions frontend/app/assets/javascripts/store/checkout/payment.js.coffee
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Spree.ready ($) ->
if ($ '#checkout_form_payment').is('*')

$("#card_number").payment('formatCardNumber')
$("#card_expiry").payment('formatCardExpiry')
$("#card_code").payment('formatCardCVC')
$(".cardNumber").payment('formatCardNumber')
$(".cardExpiry").payment('formatCardExpiry')
$(".cardCode").payment('formatCardCVC')

$("#card_number").change ->
$("#cc_type").val($.payment.cardType(@value))
$(".cardNumber").change ->
$(this).parent().siblings(".ccType").val($.payment.cardType(@value))

($ 'input[type="radio"][name="order[payments_attributes][][payment_method_id]"]').click(->
($ '#payment-methods li').hide()
Expand Down
10 changes: 5 additions & 5 deletions frontend/app/views/spree/checkout/payment/_gateway.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<p class="field" data-hook="card_number">
<%= label_tag "card_number", Spree.t(:card_number) %><span class="required">*</span><br />
<% options_hash = Rails.env.production? ? {:autocomplete => 'off'} : {} %>
<%= text_field_tag "#{param_prefix}[number]", '', options_hash.merge(:id => 'card_number', :class => 'required', :size => 19, :maxlength => 19, :autocomplete => "off") %>
<%= text_field_tag "#{param_prefix}[number]", '', options_hash.merge(:id => 'card_number', :class => 'required cardNumber', :size => 19, :maxlength => 19, :autocomplete => "off") %>
&nbsp;
<span id="card_type" style="display:none;">
( <span id="looks_like" ><%= Spree.t(:card_type_is) %> <span id="type"></span></span>
Expand All @@ -13,16 +13,16 @@
</span>
</p>
<p class="field" data-hook="card_expiration">
<%= label_tag "card_month", Spree.t(:expiration) %><span class="required">*</span><br />
<%= text_field_tag "#{param_prefix}[expiry]", '', :id => 'card_expiry', :class => "required", :placeholder => "MM / YY" %>
<%= label_tag "card_expiry", Spree.t(:expiration) %><span class="required">*</span><br />
<%= text_field_tag "#{param_prefix}[expiry]", '', :id => 'card_expiry', :class => "required cardExpiry", :placeholder => "MM / YY" %>
</p>
<p class="field" data-hook="card_code">
<%= label_tag "card_code", Spree.t(:card_code) %><span class="required">*</span><br />
<%= text_field_tag "#{param_prefix}[verification_value]", '', options_hash.merge(:id => 'card_code', :class => 'required', :size => 5) %>
<%= text_field_tag "#{param_prefix}[verification_value]", '', options_hash.merge(:id => 'card_code', :class => 'required cardCode', :size => 5) %>
<%= link_to "(#{Spree.t(:what_is_this)})", spree.content_path('cvv'), :target => '_blank', "data-hook" => "cvv_link", :id => "cvv_link" %>
</p>

<%= hidden_field_tag "#{param_prefix}[cc_type]", '', :id => "cc_type" %>
<%= hidden_field_tag "#{param_prefix}[cc_type]", '', :id => "cc_type", :class => 'ccType' %>

<%= hidden_field param_prefix, 'first_name', :value => @order.billing_firstname %>
<%= hidden_field param_prefix, 'last_name', :value => @order.billing_lastname %>

0 comments on commit 38ea6ca

Please sign in to comment.