Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use classes alongside data-hook attributes for gateway partial #3182

Merged
merged 1 commit into from
May 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions frontend/app/views/spree/checkout/payment/_gateway.html.erb
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
<%= image_tag 'credit_cards/credit_card.gif', id: 'credit-card-image' %>
<% param_prefix = "payment_source[#{payment_method.id}]" %>

<div class="field field-required">
<div class="field field-required card_name" data-hook="card_name">
tvdeyen marked this conversation as resolved.
Show resolved Hide resolved
<%= label_tag "name_on_card_#{payment_method.id}", t('spree.name_on_card') %>
<%= text_field_tag "#{param_prefix}[name]", "#{@order.billing_firstname} #{@order.billing_lastname}", { id: "name_on_card_#{payment_method.id}", autocomplete: "cc-name" } %>
<%= text_field_tag "#{param_prefix}[name]", "#{@order.billing_firstname} #{@order.billing_lastname}", { id: "name_on_card_#{payment_method.id}", autocomplete: "cc-name", class: 'cardName' } %>
</div>

<div class="field field-required" data-hook="card_number">
tvdeyen marked this conversation as resolved.
Show resolved Hide resolved
<div class="field field-required card_number" data-hook="card_number">
<%= label_tag "card_number", t('spree.card_number') %>
<%= text_field_tag "#{param_prefix}[number]", '', {id: 'card_number', class: 'required cardNumber', size: 19, maxlength: 19, autocomplete: "cc-number", type: "tel" } %>

<span id="card_type" style="display:none;">
( <span id="looks_like" ><%= t('spree.card_type_is') %> <span id="type"></span></span>
<span id="unrecognized"><%= t('spree.unrecognized_card_type') %></span>
)
</span>
</div>

<div class="field field-required" data-hook="card_expiration">
<div class="field field-required card_expiration" data-hook="card_expiration">
<%= label_tag "card_expiry", t('spree.expiration') %>
<%= text_field_tag "#{param_prefix}[expiry]", '', id: 'card_expiry', class: "required cardExpiry", placeholder: "MM / YY", type: "tel" %>
</div>

<div class="field field-required" data-hook="card_code">
<div class="field field-required card_code" data-hook="card_code">
<%= label_tag "card_code", t('spree.card_code') %>
<%= text_field_tag "#{param_prefix}[verification_value]", '', {id: 'card_code', class: 'required cardCode', size: 5, type: "tel", autocomplete: "off" } %>
<%= link_to "(#{t('spree.what_is_this')})", spree.cvv_path, target: '_blank', "data-hook" => "cvv_link", id: "cvv_link" %>
Expand Down